We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Listview is empty after implementing Group header template.

So the problem is that I was using xamarin forms listview and everything was working fine. Now I've decided to switch to sflistview and when I implemented group header template, the listview was empty. Here are the codes.

XAML.

<syncfusion:SfListView.GroupHeaderTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <Label Text="{x:Binding Key}" />
                        </ViewCell>
                    </DataTemplate>
 </syncfusion:SfListView.GroupHeaderTemplate>

Code behind.

var groupedData = return_response_data.OrderBy(x => x.Months)
                                  .ThenByDescending(x => x.Days)
                                  .GroupBy(x => x.DateSet)
                                  .Select(x => new ObservableGroupCollection<string, PhotoModel>(x))
                                  .ToList();

                var binding = new ObservableCollection<ObservableGroupCollection<string, PhotoModel>>(groupedData);

                InfoList.ItemsSource = binding;

Binding variable has two groups and 8 entries in each. My listview is showing me two empty frames right now. Don't know what's the problem. It was working fine with xamarin forms listview and I don't need group descriptor.

1 Reply

SP Subburaj Pandian Veluchamy Syncfusion Team May 24, 2019 12:31 PM UTC

Hi Wasif, 
  
Thank you for contacting Syncfusion support. 
  
We would like to inform you that in SfListView, you need to add GroupDescriptors to group the items based on its PropertyName. We have mentioned in detail regarding grouping ListView items and its customizations in our User Guide documentation. 
 
Please refer our UG for your reference from the following link, 
  
  
We hope this helps. Please let us know, if you need any further assistance. 
 
Regards,
Subburaj Pandian V 


Loader.
Live Chat Icon For mobile
Up arrow icon