5
如何在列表框上設置樣式以獲取選定項目的邊框?在列表框中圍繞selecteditem設置邊框WPF
如何在列表框上設置樣式以獲取選定項目的邊框?在列表框中圍繞selecteditem設置邊框WPF
最簡單的方法是在ItemContainerStyle添加觸發器爲IsSelected
爲ListBox
<ListBox ...>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="BorderBrush" Value="Red"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="BorderThickness" Value="1"/>
</Trigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
<!--...-->
</ListBox>
FocusVisualStyle可能是你在找什麼。
OMG它的工作,它是那麼容易?!?! :D你搖滾M8! – syncis 2011-02-13 14:07:27