Define Group By from the xaml code

Apr 9, 2013 at 5: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?
Coordinator
Apr 9, 2013 at 8:21 PM
Hi,

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"));
                cvs.Refresh();
            }
I hope this helps you?

Regards,
bpoojary