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
Sorting in the data source
posted

I'd like to perform sorting/filtering on the data source level. How can I accomplish that? Can I subscribe to some events or provide some special collection view for this purpose?

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into it and I suggest you use the following code:

     

    ICollectionView collectionView = CollectionViewSource.GetDefaultView(data);

     

    Where the “data” is an ObsevableCollection<T> e.g. and after you do that you can add SortDescriptions to the “collectionView” object and set it as a DataSource of the XamDataGrid. Please let me know if this helps you or you need further clarifications on this matter.

     

    Looking forward for your reply.

Children