Hi
When switching from multi to single sort the un-selected fields SortStatus get cleared and the selected field's SortStatus changes to the next SortStatus . How can i change it that the selected field's SortStatus is always eg. ascending? I've tried clearing FieldLayouts SortedFields and adding a new FieldSortDescription as well as overriding OnSorting and passing a new SortingEventArgs but they didn't work.
H Mheusser,
You can wire up the XamDataGrid's sorting event and replace the existing sort.
Here is a code snippet:
void xamDataGrid1_Sorting(object sender, Infragistics.Windows.DataPresenter.Events.SortingEventArgs e)
{
e.Cancel =
true;
e.ReplaceExistingSortCriteria =
FieldSortDescription fsd = new FieldSortDescription();
fsd.Direction = e.SortDescription.Direction;
fsd.Field = xamDataGrid1.FieldLayouts[0].Fields[
"SSN"];
fsd.FieldName =
"SSN";
xamDataGrid1.FieldLayouts[0].SortedFields.Add(fsd);
xamDataGrid1.FieldLayouts[0].SortedFields.Add(e.SortDescription);
}
Sincerely, MattDeveloper Support Engineer
how can i do that with xamgrid in silver-light ?
Hello,
Thank you for your post. I have been looking into it and I suggest you look in the Feature Browser of WPF 11.2 under xamGrid / Organization / Sorting section, where it is shown how to enable MultipleSort. You just need to hold Ctrl after Sort by one Column to be able to Sort by second one. Please let me know if this helps you or you need further clarifications on this matter.
Looking forward for your reply.