【发布时间】:2013-03-15 11:21:39
【问题描述】:
我想改变 ListBoxItem 的背景颜色
搜索后我决定使用这个
<ListBox>
<ListBox.Resources>
<!-- Background of selected item when focussed -->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
Color="Blue" />
<!-- Background of selected item when not focussed -->
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}"
Color="Blue" />
</ListBox.Resources>
<TextBlock>fdfsdf1</TextBlock>
<TextBlock>fdfsdf3</TextBlock>
<TextBlock>fdfsdf5</TextBlock>
<TextBlock>fdfsdf3</TextBlock>
<TextBlock>fdfsdf4</TextBlock>
</ListBox>
当一个ListBoxItem专注时,背景是蓝色的预期,但是当所选的ListBoxItem丢失焦点时,背景会变为灰色。如何让背景失去焦点时保持蓝色?
【问题讨论】: