我还是没明白。你能否告诉我如何覆盖 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>