gpt4 book ai didi

c# - 为什么我的背景颜色在 ComboBox 中不起作用

转载 作者:行者123 更新时间:2023-12-04 11:56:13 32 4
gpt4 key购买 nike

我的组合框唯一不工作的部分是背景颜色。我希望整个东西都是黄色的。但折叠的部分仍然只是灰色。

<ComboBox Height="25" Width="125" Background="Yellow">
<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<Setter Property="Background" Value="Yellow"/>
<Setter Property="BorderBrush" Value="Yellow"/>
</Style>
</ComboBox.ItemContainerStyle>
<ComboBoxItem Content="One"/>
<ComboBoxItem Content="Two"/>
<ComboBoxItem Content="Three"/>
</ComboBox>

最佳答案

也许这可以帮助你:

<ComboBox Height="25" Width="125" Background="Yellow"
Style="{StaticResource {x:Static ToolBar.ComboBoxStyleKey}}">
<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<Setter Property="Background" Value="Yellow"/>
<Setter Property="BorderBrush" Value="Yellow"/>
</Style>
</ComboBox.ItemContainerStyle>
<ComboBoxItem Content="One"/>
<ComboBoxItem Content="Two"/>
<ComboBoxItem Content="Three"/>
</ComboBox>

关于c# - 为什么我的背景颜色在 ComboBox 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39021205/

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