We have a RadListBox bound to a ObservableCollection of models. We would like sort them based on a property. The property value can also change. Is there any way to sort them?
What we are trying to do is create a "mover" to rank items, is a RadListBox not the best choice?
The RadListBox control itself doesn't have a built-in sorting feature, but you can use a collection view implementation like QueryableCollectionView (QCV) that provides support for this. Note that with the QueryableCollectionView an update of the underlying property value (used in the sorting), won't update the current view automatically. You should force this manually by calling the Reset method of the SortDescriptors collection of the QCV.
queryableCollectionView.SortDescriptors.Reset();
In case you need the view to get updated automatically on property changed, you can use the native ListCollectionView implementation. For example:
You can see this approach in the attached project. I hope it helps.
Regards,
Martin Ivanov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.