使用SurfaceListBox的WPF-高亮显示颜色选择
我需要帮助来更改SurfaceListBox选择的颜色 目前,我使用的是:使用SurfaceListBox的WPF-高亮显示颜色选择,wpf,listbox,transparent,Wpf,Listbox,Transparent,我需要帮助来更改SurfaceListBox选择的颜色 目前,我使用的是: <Style x:Key="styleSurfaceListBox" TargetType="{x:Type my:SurfaceListBox}"> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <Stac
<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>
我需要什么使选择的颜色透明?多亏了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>
再次感谢dvvrd 你可以找到答案,非常感谢!!!太完美了!!!
SurfaceListBox1.ItemContainerStyle = (Style)this.Resources["item"]; //item is the KEY on my style.