Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1945
Multiple Sort
posted

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. 

Parents
No Data
Reply
  • 28407
    posted

    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 =

     

    true;

     

     

     

    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,
     Matt
    Developer Support Engineer

     

      

Children