If the choice is not important, it is better to use the ItemsControl element wrapped in a ScrollViewer. This combination is lighter than Listbox (which is actually derived from ItemsControl already), and its use will eliminate the need to use a cheap hack to override the behavior that is already missing in ItemsControl.
In cases where the behavior of the choice is really important, then this clearly will not work. However, if you want to change the background color of the selected element so that it is not visible to the user, then this would only confuse them. In cases where you intend to change some other feature to indicate that the item is selected, then some other answers to this question may be more relevant.
Here is a skeleton about how the markup should look:
<ScrollViewer> <ItemsControl> <ItemsControl.ItemTemplate> <DataTemplate> ... </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </ScrollViewer>
user3308241 Dec 13 '14 at 21:36 2014-12-13 21:36
source share