我想更改组合框下拉面板的背景颜色。
我正在使用 WPF。
我读过这篇文章
背景颜色项目组合框 WPF https://stackoverflow.com/questions/27963236/backgroundcolor-items-combobox-wpf
我写了这段代码:
<ComboBox
Width="{StaticResource UnityX3}"
styles:Typhography.TypeSize="Body1"
Margin="12 0 0 0"
Foreground="{StaticResource Viola1Brush}"
DisplayMemberPath="AuthorName"
SelectedItem="{Binding Path=ConsoleViewModel.AnswersViewModel.SelectedAuthor}"
ItemsSource="{Binding ConsoleViewModel.AnswersViewModel.Authors}"
Grid.Column="1">
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="Background" Value="Blue" />
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>
I have obtained the result in the picture.
我希望整个面板是蓝色的,包括单个项目周围的小边框。
我如何更改我的代码以解决我的问题?
谢谢
您看到的是缺少边框颜色容器。设置BorderBrush
的价值Blue
需要什么ItemContainerStyle
删除White
寻找边界。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)