This blog post demonstrates how to make the selected ListBoxItem in a ListBox display differently than unselected items. We will see how to add an extra Button to the selected item, but you can add whatever you want by using the technique shown below. This is what the demo app looks like when you run it and select an item:
The trick is to set the ListBox’s ItemTemplate to a DataTemplate which knows when to expose the extra visuals for the selected item(s). Here’s an example of a template which knows how to do that:
That DataTemplate creates two Grids. The outer Grid has two rows: the top row is for the normal item content, and the bottom row hosts the selected item’s extra content. The inner Grid is in the bottom row. That inner Grid has a Style which knows when to hide itself (i.e. when the ListBoxItem is not selected).
Here’s a ListBox which consumes that template:
Download the demo project here: Customized SelectedItem (Demo) Be sure to change the file extension from .DOC to .ZIP and then decompress it.