ListBoxItem IsSelected style
Posted
by plotnick
on Stack Overflow
See other posts from Stack Overflow
or by plotnick
Published on 2010-04-06T22:49:57Z
Indexed on
2010/04/06
22:53 UTC
Read the original article
Hit count: 481
I still didn't get it. Could you please show me exactly how to override ListBox's default behavior. Everytime when ListBoxItem is selected the Border's background should be changed. Not the background of the whole row but only background of the border which's specified.
<ListBox ItemsSource="{Binding Source={StaticResource AssetsViewSource}}">
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderThickness="2" BorderBrush="Black">
<StackPanel>
<TextBlock Text="Name: " />
<TextBlock Text="{Binding Name}" />
</StackPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
© Stack Overflow or respective owner