We're writing an application for a non-computer savvy user base. As a result I need to add a "Default Sort" button to our UI that will manually sort our xamGrid by multiple columns (we can't expect our users to know ctrl+click on multiple columns). Is there a way I can invoke a call to sort on the grid and provide an IComparer?
Thanks,
Mike.
Hi Mike,
The FieldSettings object exposes SortComparer and SortComparisonType properties. You can then specify the sorting criteria thru the FieldLayout's SortedFields collection e.g.
Field fld = this.xamDataGrid1.FieldLayouts[0].Fields["CustomerName"];
fld.Settings.SortComparisonType = FieldSortComparisonType.CaseInsensitive;
FieldSortDescription fsd = new FieldSortDescription();
fsd.Field = fld;
fsd.Direction = "Descending";
this.xamDataGrid1.FieldLayouts[0].SortedFields.Add( fsd);