如何更改所选ComboBox项的背景颜色?w [英] How to change the background color of a selected ComboBox item? uwp

查看:110
本文介绍了如何更改所选ComboBox项的背景颜色?w的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Windows 10移动设备开发应用程序,并且正在努力处理ComboBox控件的样式,更具体地说,是所选项目的背景色.

I'm developing an application for a Windows 10 Mobile device and I'm struggling to handle the styling for the ComboBox control, more specifically, the selected item's background color.

无需编辑广告的前景"或背景"属性控制;

Without editing the Foreground or Background properties of the control;

在选择任何项目之前如何显示组合框:

展开的组合框

以"2"作为所选项目的组合框

我似乎找不到控件的任何属性,例如SelectedItemBackgroundColor,并且更改前景"和背景"属性不会影响该问题.

I can't seem to find any properties for the control such as SelectedItemBackgroundColor and changing the Foreground and Background properties doesn't affect the problem.

推荐答案

如果您查看

If you look into the documentation, you can see the default style of ComboBoxItem uses the SystemControlHighlightListAccentLowBrush brush as the background of SelectedItem. You can redefine this resource in your app or you can copy the default Style and replace the Background brush in Selected VisualState with a custom brush.

这篇关于如何更改所选ComboBox项的背景颜色?w的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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