Thought
Thought

Reputation: 5846

How do i change a combobox arrow color, in windows 8 store app

I have this combobox in a windows store app project

<ComboBox  Grid.Row="2" x:Name="ContactoSelect" Width="200" Height="50" Margin="114,10,27,510" SelectedIndex="0" Background="White" SelectionChanged="ContactoSelect_SelectionChanged">
    <x:String>Item 1</x:String>
    <x:String>Item 2</x:String>
    <x:String>Item 3</x:String>
</ComboBox>

i would like to change the color of the arrow, that is black by default. How can i do that?

Upvotes: 3

Views: 2377

Answers (2)

Trisped
Trisped

Reputation: 6003

If you want to change the arrow for all ComboBox objects in your project you could add the following line to your App.xaml file and change "#FF000000" to the color you want.

<SolidColorBrush x:Key="ComboBoxArrowForegroundThemeBrush" Color="#FF000000" />

You might also be able to do this on a page/control level by specifying it in the resources.

From ComboBox styles and templates under Dark theme brushes

Upvotes: 0

user3279683
user3279683

Reputation: 261

Right click on the control from the Design view

Select the option Edit Style>Edit a copy

A style will be created for the control in the xaml inside Page.Resources as ComboBoxStyle1(name varies according to your x:name)

You will find

<TextBlock x:Name="DropDownGlyph" Grid.Column="1" Foreground="{StaticResource ComboBoxArrowForegroundThemeBrush}" FontWeight="Bold" FontSize="{StaticResource ComboBoxArrowThemeFontSize}" FontFamily="{StaticResource SymbolThemeFontFamily}" HorizontalAlignment="Right" IsHitTestVisible="False" Margin="0,0,6,4" Text="&#xE011;" VerticalAlignment="Center"/>

Change the Foreground to the desired color you want. eg: Foreground="Red" or any other resource binding.

You can define the style globally in your App.xaml so that it can be used else where as below

    <ComboBox HorizontalAlignment="Left" Margin="187,130,0,0" VerticalAlignment="Top" Width="120" Style="{StaticResource ComboBoxStyle1}"/>

Upvotes: 5

Related Questions