【发布时间】:2011-02-05 01:01:26
【问题描述】:
我还是没听懂。你能否告诉我如何覆盖 ListBox 的默认行为。 每次选择 ListBoxItem 时,都应更改边框的背景。不是整行的背景,而是指定的边框的背景。
<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>
【问题讨论】:
标签: wpf listbox styles listboxitem