WPF Refresh CollectionView without explicit recreation (calling the Refresh () method)

Is it possible to refresh (refresh) a view without explicitly calling the Refresh () method? The problem is that it recreates the whole collection, and in the user interface the selected row becomes unselected. I have a complex list view (each row contains a different sub-listview), and when I call Refresh (), the selection in the substrings disappears. Clearing SortDescriptions and adding them manually again does not work for me (It seems that the Clear () and Add () sorting method methods refer to Refresh () internally)

So, any chance of getting a view updated without it?

My situation: Using Dispatcher.Timer, I update all the properties for each element manually (to avoid selection), then update one property of the list of elements (a property with a different collection, it is also updated manually), and then I need to update the view somehow when I call Refresh () on the subnet, everything is fine, but I also need to update the top-level collection to get the sort descriptions applied to the top-level collection, which are likely to have changed.

+6
source share
2 answers

Found a solution in this wonderful blog post: DrWPF

+8
source

Another option is to use ContinuousLinq to keep sorting / grouping at any time.

+1
source

Source: https://habr.com/ru/post/885422/


All Articles