问题描述
我正在为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.
在选择任何项目之前如何显示组合框:
展开的组合框
以"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.
推荐答案
如果您查看文档,您会看到 ComboBoxItem
的默认样式使用 SystemControlHighlightListAccentLowBrush
画笔作为 SelectedItem 代码>.您可以在应用程序中重新定义该资源,也可以复制默认的
画笔>使用自定义画笔. Style
并在 Selected
VisualState
Background
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!