This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, When an IObservableCollection Here is a sample of the markup I am using (I make sure the events are fired from the dispatcher thread)
Note that the elements are sorted just fine when the grid is first populated, or when the user clicks on the headers, but any subsequent change to a binding will clear the sort. In this example, each item in my IObservableCollection (NearQuotes) has a Value property containing another object. Value fires NotifyPropertyChanged and triggers the binding re-evaluation. Thanks, |
|
|
Hello, Thanks for contacting us about this. Please have a go at setting the ReSortOnCollectionChanged property on the DataGrid control to true and see if that solves the issue. If not, please send us a simple repro project. -Jason Fauchelle |
|
|
Hi Jason, Here is a pared-down repro for this issue: MainWindow.xaml
MainWindow.xaml.cs
|
|
|
Hello, Thanks for the repro code. Previously I was focusing on the case where the collection changes - which is fixed by the ReSortOnCollectionChanged property. Looks like your main issue is on changing a property on an item which I'd missed from your original post. This is functionality we do not plan to add, but fortunately is very easy for you to achieve the result you need. In the example of your repro, the issue is solved if you add the following code after setting the Ticking property: Quotes.Move(0, 0); This is a no-op that triggers the DataGrid to update the sorting. This is possible due to ReSortOnCollectionChanged being set to true. Sorry this is not something we do for you, but I hope this work around will work for you. -Jason Fauchelle |
|
|
Thanks, this works indeed abeit is slightly awkward as I use a lot of binding expressions to define sorting in the view. This now lives in the ViewModel. |
|