如何更改Combobox下拉面板的背景颜色 [英] How change the background color of the dropdown panel of Combobox
本文介绍了如何更改Combobox下拉面板的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要更改组合框的drowpdown面板的背景颜色。
我使用WPF。
我已阅读这篇文章
我想整个面板都是蓝色的,包括单个项目周围的小边框。
如何更改我的代码以解决我的问题?
谢谢解决方案您看到的是容器 。将
ItemContainerStyle $ c>所需的
BorderBrush
值设置为Blue
$ c>删除白色
边框。I want to change the background color of the drowpdown panel of the combobox. I'm using WPF. I've read this post
and I've written this 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>
I have obtained the result in the picture.
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
解决方案What you are seeing is a missing border color of the container. Set the
BorderBrush
value to theBlue
for what is needed by theItemContainerStyle
to remove theWhite
looking border.这篇关于如何更改Combobox下拉面板的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文