Define Group By from the xaml code

Apr 9, 2013 at 4:04 AM
Hi Team,

I need to define a data grid that is grouped by a predefined column. That means that I want to define the group by from the xaml if that is possible or from the code behind, and after that load the data to data grid, is that possible? is that is possible, who can I do that?
Apr 9, 2013 at 7:21 PM

I managed to do this in code via this line of code its simple.
 var cvs = CollectionViewSource.GetDefaultView(grid.ItemsSource);
            if (cvs != null)
                cvs.GroupDescriptions.Add(new PropertyGroupDescription("GameName"));
                cvs.GroupDescriptions.Add(new PropertyGroupDescription("Owner"));
I hope this helps you?