user4136548
user4136548

Reputation: 117

C# WPF How to modify the ComboBox's selected item's color?

I am having trouble with the ComboBox's selected item color... By default, when you select an item from the ComboBox, it's Black. How do I change the color of the item to White? I cannot seem to modify it. What's the deal?

Upvotes: 1

Views: 2459

Answers (1)

Dennis
Dennis

Reputation: 37800

In the simplest case you can write this in XAML:

    <ComboBox ItemsSource="{Binding DropDowmItems}" Foreground="Red">
        <ComboBox.ItemContainerStyle>
            <Style TargetType="{x:Type ComboBoxItem}">
                <Setter Property="Foreground" Value="Black"/>
            </Style>
        </ComboBox.ItemContainerStyle>
    </ComboBox>

In the case of item template, you need to modify that template.

Upvotes: 4

Related Questions