1

When a DataGrid is bound to a PagedCollectionView the user can resort the data of a given column or collection of columns. This user action manipulates the SortDescriptions collection and when that happens I need to refresh the underlying data with a new query from the server.

Ideally I would attach an event handler to CollectionChanged event of the SortDescriptions property, but I can't since it's is protected.

What then is the correct method for tracking changes to the SortDescriptions collection of the PagedCollectionView?

Ralph Shillington
  • 20,718
  • 23
  • 91
  • 154
  • Are you using WCF RIA Services (DomainService on serverside and DomainContext on clientside)? – Jehof Mar 06 '13 at 13:13
  • Yes I am using RIA Services on the serverside and DomainContext on the client side. Although I'm not sure why that should matter? Perhaps there's a piece of plumbing that I'm fully understanding? – Ralph Shillington Mar 06 '13 at 13:23
  • No, i thought that the DomainCollectionView could help you to do want you want. But using this class you have the same problem. Thanks for your solution – Jehof Mar 07 '13 at 07:26

1 Answers1

1

Turns out it's a simple matter of casting the SortDescriptions property to an INotifyCollectionChanged which will expose the CollectionChanged event.

((INotifyCollectionChanged)Data.SortDescriptions).CollectionChanged += (s,e)=> { ... };
Ralph Shillington
  • 20,718
  • 23
  • 91
  • 154