This is my XAML:
This is basically the same as the one given in the SfListViewSample.<Grid>
<listView:SfListView x:Name="listView" ItemSize="65" GroupHeaderSize="60"
ItemsSource="{Binding UsersList}" ItemSpacing="0,0,5,0"
AllowGroupExpandCollapse="True"
IsStickyGroupHeader="True">
<listView:SfListView.DataSource>
<dataSource:DataSource>
<dataSource:DataSource.GroupDescriptors>
<dataSource:GroupDescriptor PropertyName="Group"/>
</dataSource:DataSource.GroupDescriptors>
</dataSource:DataSource>
</listView:SfListView.DataSource>
<listView:SfListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout BackgroundColor="#E4E4E4">
<Label Text="{Binding Key}"
FontSize="22"
FontAttributes="Bold"
VerticalOptions="Center"
HorizontalOptions="Start"
Margin="20,0,0,0" />
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</listView:SfListView.GroupHeaderTemplate>
<listView:SfListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
---------
</ViewCell.View>
</ViewCell>
</DataTemplate>
</listView:SfListView.ItemTemplate
</listView:SfListView>
</Grid>
Am I missing something here? I just copied the XAML code from working fine example of contacts from the example provided by SyncFusion.private ObservableCollection<UserDetails> _users;public ObservableCollection<UserDetails> UsersList{get { return _users; }set{_users= value;RaisePropertyChanged(() => UsersList);}}
Hi Customer,Thank you for using Syncfusion products.Query 1:We have analyzed the reported query with the given code snippet and we suspect that the issue may arise with the Group property which has bind to the GroupDescriptor. Can you please check whether you have provided data to Group property because if the group’s Key value is null, groups are not created. The group header contains GroupResult(Contains the Key and grouped items based on the property which has bind to GroupDescriptor) as binding context and other than binding context, it won’t bind the data. So, we recommend you to group the items based on property in the Model class which has underlying data. For your reference, we have prepared an sample as like your code snippet in which Model class is not implemented with INotifyPropertyChanged interface and bind the Group property to GroupDescriptor’s PropertyName and the group headers are created properly. You can download the sample from the below link.Could you please check with the sample?. If you face any issue, please modify the above sample to reproduce the issue and update us with replication procedure. So, that we could able to analyze the issue better and update you with appropriate solution.Query 2:Currently SfListView do not have support for “HasUnevenRows”. We have already considered this as feature request and we are implementing the feature “Automatically fit the item height based on content” and it will be available in our upcoming 2017 Volume 1 SP 2 release which is scheduled to be rolled out by end of this month.Please let us know if you require further assistance.Regards,Dinesh Babu Yadav
Hi Customer,Sorry for the inconvenience caused.We have confirmed that the issue with “GroupHeader is not updated when groupdescriptor is removed and then added at runtime in UWP platform” is a defect and we have logged a defect report. The fix for the reported issue will be available in our upcoming 2017 Volume 1 SP 2 release which is scheduled to be rolled out by end of this month. We will appreciate your patience until then.Please let us know if you require further assistance.Regards,Dinesh Babu Yadav
private void ListView_ItemTapped(object sender, Syncfusion.ListView.XForms.ItemTappedEventArgs e)
{
if (e.ItemData is GroupResult)
return;
viewModel.Contactsinfo.Remove(e.ItemData as Contacts);
}
private void RemoveItemInGroup_Clicked(object sender, EventArgs e)
{
var item = listView.DataSource.DisplayItems[1] as Contacts;
viewModel.Contactsinfo.Remove(item as Contacts);
DisplayAlert("Add Item in Group", "Added Item is " + item.Name + item.Group, "Ok");
} |
Hi Customer,Apologies for the delay caused.We have analyzed the reported issue “Group header gets cleared when underlying data is removed at runtime” with the given information at different possible scenarios in our sample. In the sample, we have removed the item from the underlying collection by a button click and on tapping the ListViewItem as like below code snippet. But we didn’t face any issue. For your reference, we have attached the sample and you can download the same from the below link.Code Example[C#]
private void ListView_ItemTapped(object sender, Syncfusion.ListView.XForms.ItemTappedEventArgs e){if (e.ItemData is GroupResult)return;viewModel.Contactsinfo.Remove(e.ItemData as Contacts);}private void RemoveItemInGroup_Clicked(object sender, EventArgs e){var item = listView.DataSource.DisplayItems[1] as Contacts;viewModel.Contactsinfo.Remove(item as Contacts);DisplayAlert("Add Item in Group", "Added Item is " + item.Name + item.Group, "Ok");}Could you please check with the above sample?. If the issue still reproduces at your end, please modify the above sample to reproduce the issue and update us with replication procedure or video link. So, that we could able to analyze the issue better and update you with appropriate solution. And also can you share the below details?
- Can you share the SfListView version? We have tested in latest version(v15.1.0.37).
- In which ListView LayoutManager you have tested? We have tested in both Linear Layout and GridLayout.
- Can you share the Xamarin Form version? We have tested in (v2.3.3.180).
- If possible, can you please modify the sample which replicates the issue?
Please let us know if you require further assistance.Regards,Dinesh Babu Yadav