更改组合框下拉列表背景颜色 wpf xaml [英] change combobox dropdown list background color wpf xaml

查看:70
本文介绍了更改组合框下拉列表背景颜色 wpf xaml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改组合框下拉列表或包含单击组合框标题时打开的选项的弹出窗口的背景颜色.

i am trying to change the background color of combobox dropdown or the popup containing options that opens when combobox header is clicked.

<Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource MaterialDesignComboBox}">
    <Setter Property="Background" Value="White"></Setter>
</Style>

现在这个代码的和平改变了整个组合框的背景颜色.有没有办法保持标题的颜色透明并更改下拉菜单的颜色?

now this peace of code changes the background color of whole combobox . is there a way to keep the color of header transparent and change the color of dropdown ?

我在 xaml 工具包中使用材料设计进行样式

edit: i am using material design in xaml toolkit for styling

推荐答案

我发现的一种解决方法是覆盖 ComboBox.Resources 中的 MaterialDesignPaper 颜色:

One workaround that I've found is to override MaterialDesignPaper color in ComboBox.Resources:

<ComboBox.Resources>
    <SolidColorBrush x:Key="MaterialDesignPaper" Color="Red"/>
</ComboBox.Resources>

这篇关于更改组合框下拉列表背景颜色 wpf xaml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆