How do I get a white WPF ComboBox DropDown arrow color?
I am trying to work out a style for a ComboBox
that has a navy background with white text, so I want the drop down arrow to be white also (the xaml I have so far is below).
<Style x:Key="ComboBoxStyle" TargetType="ComboBox">
<Setter Property="Background" Value="{StaticResource head开发者_如何学编程erBrush}"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="{StaticResource headerBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="MinWidth" Value="100"/>
<Setter Property="Height" Value="21"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="Margin" Value="3"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="ComboBoxItemStyle" TargetType="ComboBoxItem">
<Setter Property="Background" Value="AliceBlue"/>
<Setter Property="Foreground" Value="Navy"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
</Style>
ADDED code to set the ControlTemplate
?
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Path x:Name="Arrow" Fill="White"/>
</ControlTemplate>
</Setter.Value>
</Setter>
You need to edit the ControlTemplate of ComboBox and you can see a the Arrow as a Path. So change the Fill property of the Path to your desired arrow color. See sample ControlTemplate here http://msdn.microsoft.com/en-us/library/ms752094.aspx
精彩评论