'How to create a race track scoreboard in WPF

I'm trying to develop a race track scoreboard like this:

enter image description here

I'm not sure what the best method for this is. I tried to create an ObservableCollection that is constantly updated; the problem is that when I try to sort the scoreboard dynamically by the drivers' best lap, the positions are always static.

I used a CollectionViewSource combined with a ListBox to sort the drivers by the Property BestLap, but it seems that the drivers' positions are sorted only when I run the program for the first time, then never again.

I also tried to sort the ObservableCollection constantly in the ViewModel, making the Driver class IComparable and creating a new ObservableCollection that sorts drivers by BestLap. I think there's a better method, however.

I tried finding a sample that does what I need but could not find one. Please let me know if you have any suggestions about how to do this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source