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
HI,
I am just following up on this forum thread.
Please let me know if I can provide further assistance regarding this issue.
Thanks for the response. The solution worked.
I've got further question with regards to this. When i'm in multi sort selecting another field, the selected field doesn't get the unselected status even though i've set LabelClickAction to SortByMultipleFieldsTriState. Is there a way to change this or is the above solution the only way?