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
315
Custom sorting - prevent default but still have an indicator
posted

I would like to handle sorting in a custom way. I know I can use Sorting event for this and set e.Cancel = true. This way I can stop grid from performing sorting on its own.

The problem is that I would still like to have a sorting indicator in the header (near label). I can accomplish that by adding following line to the Sorting event handler:

e.FieldLayout.SortedFields.Add(e.SortDescription);

but after that the default sorting mechanism executes despite setting e.Cancel = true. What's your ideas on that?

  • 138253
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I handled the Sorting event, canceled it and added a SortDescription. As for the Filtering, I added a button and in its Click event I filtered the Records. Please let me know if this helps you or you need further assistance on this matter.

     

    Looking forward for your reply.

    XamDataGridFilteringAndSorting.zip
  • 315
    posted

    Also, the same question regarding filtering: how can I prevent datagrid from performing default filtering, but still have filter values displayed in UI? I want to perform custom filtering.