【发布时间】:2017-06-12 16:05:18
【问题描述】:
当用户将鼠标移到项目上时,我正在尝试实现组合框的透明突出显示。我需要它是透明的,因为组合框中的每个项目都已经具有在下拉菜单中显示为背景的颜色。
<ComboBox x:Name="comboBox1" HorizontalAlignment="Left" Margin="84,70,0,0" VerticalAlignment="Top" Width="230" FontWeight="ExtraBold">
<ComboBox.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}">Transparent</SolidColorBrush>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}">Black</SolidColorBrush>
</ComboBox.Resources>
<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<Style.Triggers>
<DataTrigger Binding="{Binding Value}" Value="Agriculture">
<Setter Property="Background" Value="Green" />
</DataTrigger>
使用此代码,我只能得到覆盖突出显示项目背景的白色,如下所示:
有什么建议吗?
【问题讨论】: