如何更改所选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.