Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combobox change highlight color winRT (metro app)

I want to change the color of a combobox in a winRT (Windows Store application).

It looks like this. And I would like substitute the purple color.

A weird color

I tried:

<ComboBox>
    <ComboBox.Resources>
        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}">Red</SolidColorBrush>
    </ComboBox.Resources>
    <ComboBoxItem>One</ComboBoxItem>
    <ComboBoxItem>Two</ComboBoxItem>
</ComboBox>

This doesn't work because x:Static no more exist in Windows store application and if I use StaticResource, the resource "System.HighlightBrushKey" does not exist.

Thanks

like image 250
Roroto Avatar asked Mar 25 '13 10:03

Roroto


Video Answer


1 Answers

Seems like built-in resources names were changed, so now you need to override these brushes:

<SolidColorBrush x:Key="ComboBoxItemSelectedBackgroundThemeBrush" Color="#FF4617B4" />
<SolidColorBrush x:Key="ComboBoxItemSelectedPointerOverBackgroundThemeBrush" Color="#FF5F37BE" />

You can find full list of ComboBoxItem brushes here: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj709911.aspx

like image 102
takemyoxygen Avatar answered Sep 24 '22 22:09

takemyoxygen