Reordering Display Items for Derived ObservableCollection <T> in ItemsControl on PropertyChange
I have an ItemsControl element associated with a sorted (via CollectionViewSource) derived ObservableCollection of view models. In my derived collection class, I handle PropertyChanged on my view models. When some property (Order) has changed, I need a visualization of the controls to reflect the new sorted collection.
I understand that when processing PropertyChanged, I can call OnCollectionChanged with the specified Reset action; however, this leads to a loss of attention to control, which is undesirable for my situation.
In any case, I can cope with this change and have a smooth transition with the remaining cursor where it is (or, in the case of a bookmark, go to the next corresponding field).
What will change the property Order?
Perhaps you can reinstall your ItemsControl instead of sorting and updating your source.
I have done this in the past with TabControl. When a user drags a tab to a new location, it removes the actual TabItem from the TabControl and inserts it into the new location. SelectedTab never changed, so I didn't have to worry about changing focus.