Hey all,
I would like to make a ListView with grouping enabled, so far, everything is good.
But I need to layout my own header with fixed height, and there is where the problem comes:
The header is drawn well, but it hides the first cell from the corresponding group. (My header is bigger than the default size)
My code looks like this:
GroupHeaderTemplate = new DataTemplate(() =>
{
var relativeLayout = new RelativeLayout
{
HeightRequest = Normalize(headerHeight),
VerticalOptions = LayoutOptions.Start,
Padding = 0
};
var bgImage = new Image
{
Source = new FileImageSource { File = LocalDataManager.CombineLibraryPath("bgImage.png") },
VerticalOptions = LayoutOptions.FillAndExpand,
Aspect = Aspect.AspectFill
};
relativeLayout.Children.Add(bgImage,
Constraint.Constant(0),
Constraint.Constant(0),
Constraint.RelativeToParent((parent) => parent.Width),
Constraint.RelativeToParent((parent) => parent.Height));
var nameLabel = new Label();
nameLabel.SetBinding(Label.TextProperty, "Label");
nameLabel.SetValue(Label.TextColorProperty, ThemeManager.GroupedListHeaderTextColor.ToColor());
nameLabel.SetValue(Label.XAlignProperty, TextAlignment.Start);
nameLabel.SetValue(Label.YAlignProperty, TextAlignment.Center);
relativeLayout.Children.Add(nameLabel,
Constraint.Constant(0),
Constraint.Constant(0),
Constraint.RelativeToParent((parent) => parent.Width),
Constraint.RelativeToParent((parent) => parent.Height));
return new ViewCell
{
Height = Normalize(headerHeight),
View = new StackLayout
{
HeightRequest = Normalize(headerHeight),
VerticalOptions = LayoutOptions.StartAndExpand,
Children = { relativeLayout }
}
};
})
Did I do anything wrong, or just the default height is supported?
Attached a file too.
Thanks in advance!