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?

Parents Reply
  • 138253
    Verified Answer
    Offline posted in reply to Arkadiusz

    Hello,

    I have modified the sample I sent you before, so now it has the functionality you want. When you use the UI of the XamDataGrid, the built-in filtering doesn’t filter the XDG. I made the clear buttons to be visible, when a value is entered in the some of the Textboxes. All you need to do is write your custom filtering for the data source. In the sample there is example with the equals filter operator. Here you can see how to filter your CollectionView:

    http://msdn.microsoft.com/en-us/library/ms752348.aspx

    Please let me know if this helps you or you need further assistance on this matter.

    Looking forward for your reply.

Children