我需要帮助来改变SurfaceListBox选择的颜色。
现在我用这个:
<Style x:Key="styleSurfaceListBox" TargetType="{x:Type my:SurfaceListBox}">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Background="Transparent" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Style>
我需要选择哪种颜色透明?
答案 0 :(得分:0)
感谢dvvrd!
我创建了这样的SurfaceListBoxItem
样式:
<Style x:Key="item" TargetType="{x:Type my:SurfaceListBoxItem}" >
<Style.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Foreground" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter Property="Foreground" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
</Trigger>
<Trigger Property="IsEnabled" Value="true">
<Setter Property="Foreground" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Foreground" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />
</Trigger>
</Style.Triggers>
</Style>
然后我将其指向ItemContainerStyle
:
SurfaceListBox1.ItemContainerStyle = (Style)this.Resources["item"]; //item is the KEY on my style.
再次感谢dvvrd!