CollectionViewSource does not re-sort on property change
Have you tried refreshing your collectionviewsource?
this.TruckSource.View.Refresh();
All answers I found mentioned View.Refresh()
but that's not very good solution for big lists. What I ended up doing was to Remove()
and Add()
this item. Then it was properly repositioned without reloading whole list.
Word of caution! It works for what I do, but in your case removing object and re-adding may cause side effect depending how your code written. In my case it's a list with UI effect where new items show up with transition so refreshing will show transition on whole list where remove/add nicely shows how item get's repositioned.
Late answer, but with 4.5 the ListCollectionView (the default implementation for a ListBox and CollectionViewSource.View) new properties were added to make this possible.
You can use the IsListSorting and ListSortingProperties to enable automatic resorting. And no, it does not rebuild the view
list.SortDescriptions.Add(new SortDescription("MyProperty", ListSortDirection.Ascending));
list.IsLiveSorting = true;
list.LiveSortingProperties.Add("MyProperty");
This should resort when the property MyProperty
changes.