I have a ListBox with some ListBoxItems. Each ListBoxItem contains some text and a background image. When the user clicks a ListBoxItem I want to add an image on top of the ListBoxItem (it decorates the item with some additional looks).
I’m looking for a way to overlay the image onto the clicked ListBoxItem. That’s the code I have so far:
<ListBox Margin="0,34,0,25.113" Background="{x:Null}" BorderThickness="0">
<ListBoxItem Content="First Item" Height="71.96" Margin="0,10,0,0">
<ListBoxItem.Background>
<ImageBrush ImageSource="Untitled-4.png"/>
</ListBoxItem.Background>
</ListBoxItem>
</ListBox>
Put your
ListBoxItem.Contentin a panel which allows overlapping controls, such as aGrid, and make your top image’sVisibililtybe based onListBoxItem.IsSelectedEdit
You can also remove the blue background for the
SelectedItemby overwritting the HighlightBrush Color and making it Transparent