How to group data of LIstview in WPF?
How to group data of Listview when data are bind from SQL Database
I used Collection View Source for that but it is not working
My Code lines are mentioned below :
CollectionViewSource viewSource = new CollectionViewSource { Source = ds };
viewSource.GroupDescriptions.Add(new PropertyGroupDescription("RequestID"));
ListView1.ItemsSource = viewSource.View;
but it not working properly , even data are not show in listview w开发者_JAVA百科hen Listview Item Source is bind with Collection View Source
Please help me out. Thanks a lot.
you can try the following
ICollectionView view = CollectionViewSource.GetDefaultView(ds);
view.GroupDescriptions.Add(new PropertyGroupDescription("RequestID"));
listview1.ItemsSource = view;
dont forget to set a grouping template. btw here is a related question with an complete anwser.
精彩评论