gpt4 book ai didi

wpf - 如何改变Combobox下拉面板的背景色

转载 作者:行者123 更新时间:2023-12-04 02:11:16 39 4
gpt4 key购买 nike

我想更改组合框下拉面板的背景颜色。
我正在使用 WPF。
我读过这篇文章

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>

我已经得到了图片中的结果。 enter image description here

我希望整个面板都是蓝色的,包括单个项目周围的小边框。
如何更改我的代码以解决我的问题?
谢谢

最佳答案

您看到的是容器缺少边框颜色。设置 BorderBrush值到 Blue ItemContainerStyle 需要什么删除 White看边界。

关于wpf - 如何改变Combobox下拉面板的背景色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38094770/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com