Hello,
I am having a problem with grouping. The listview is splitting up every single item and not grouping the like ones together. It works if I get rid of the KeySelector, but then I cannot get my group headings to show to both the icon and text. My code is below:
Code Behind:
todayListView.DataSource.GroupDescriptors.Add(new GroupDescriptor()
{
PropertyName = "PartOfTheDay",
KeySelector = (object obj1) =>
{
var temp = (obj1 as item);
return temp;
},
});
<syncfusion:SfListView
AbsoluteLayout.LayoutBounds="0.0, 0.0, 1.0, 1.0"
AbsoluteLayout.LayoutFlags="All"
x:Name="todayListView" Style="{StaticResource ListViewStyle}"
VerticalOptions="FillAndExpand"
SelectedItem="{Binding SelectedItem}" ItemsSource="{Binding Items}"
ItemTemplate="{StaticResource dataTemplate}"
AutoFitMode="DynamicHeight">
<syncfusion:SfListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout BackgroundColor="{StaticResource SecondaryBackgroundColor}">
<StackLayout Orientation="Horizontal" VerticalOptions="CenterAndExpand" Padding="10,10,10,5">
<app:CustomImage Source="{Binding Key.HeaderIcon}" TintColor="{Binding Key.HeaderColor}" VerticalOptions="Center" HeightRequest="20" />
<Label Text="{Binding Key.HeaderText}" Style="{StaticResource SecondaryCaptionStyle}" VerticalOptions="Center" TextColor="{Binding Key.HeaderColor}" />
</StackLayout>
<BoxView Style="{StaticResource BoxviewSeperator}" />
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</syncfusion:SfListView.GroupHeaderTemplate>