如何更改组合框的下拉面板的背景颜色 [英] How change the background color of the dropdown panel of Combobox
问题描述
我想改变ComboBox的drowpdown面板的背景色。
我使用WPF。
我读过这篇文章
I want to change the background color of the drowpdown panel of the combobox. I'm using WPF. I've read this post
<一个href=\"http://stackoverflow.com/questions/27963236/backgroundcolor-items-combobox-wpf\">BackgroundColor项目组合框WPF
和我写这code:
<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>
我想整个面板是蓝色的,包括围绕单个项目的小边框。
我怎样才能改变我的code,以解决我的问题?
谢谢
I want that the entire panel is blue, included the little border around the single item. How can I change my code in order to solve my problem? Thank you
推荐答案
你们看到的是容器的缺失边框颜色的。将 BorderBrush
值到蓝色
什么是由 ItemContainerStyle $ C需要$ c>来删除
白色
寻找边界。
What you are seeing is a missing border color of the container. Set the BorderBrush
value to the Blue
for what is needed by the ItemContainerStyle
to remove the White
looking border.
这篇关于如何更改组合框的下拉面板的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!