I am using the XamDataGrid to display a set of data. The grid let me group by by dragging
a particular field by dragging the header of that field into the group by area, but I
would like it to group by the field on load itself and have all the rows expanded.
Is there a way i can do that?
This is what it looks like now
I want it to look like this on load.
You can do somethin like below.
FieldSortDescription item = new FieldSortDescription(); item.IsGroupBy = true; item.Field = groupByField;//This is the field on which groupby is to be done item.FieldName = groupByField.Name; _grid.FieldLayouts[0].SortedFields.Add(item);
You need to create FieldSortDescription for each field on which you want to do group by and add it to SoretedFields Collection.
I'm not sure about expanding the rows but I found the example in this link http://help.infragistics.com/Help/NetAdvantage/WPF/2010.1/CLR3.5/html/Infragistics3.Wpf.DataPresenter.v10.1~Infragistics.Windows.DataPresenter.FieldSortDescription~IsGroupBy.html that allows you to group by a field on startup.