September 2012
Intermediate to advanced
464 pages
10h 55m
English
Controls deriving from Selector such as ListBox and CombobBox have rich template support with the ItemTemplate property. There is no direct support, however, for customizing the way a selected item is rendered. At first, this seems easily fixable with a property trigger for the Selector.IsSelected property; however, due to the way the default ListBoxItem/ComboBoxItem control template is designed, the result is suboptimal. Let's see how to customize selection rendering despite this inconvenience.
Run Visual Studio and open the CH08.DataTriggerDemo project.
We'll customize the appearance of selection in the ListBox used to show books with a fancy DataTemplate: