WPF Combo box custom template for mouseover main button not dropdown items, styled in the combobox itself

15 views Asked by At

I have combobox items styled the way I want them, but I am stuck getting the main button itself styled the same way. Is there an efficient way of adding my existing styling to the main combobox button without grabbing an entire template?

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="400" Width="400">
    <Canvas>
       <ComboBox Canvas.Left="169" Canvas.Top="170" Foreground="#555555">
            <ComboBox.ItemContainerStyle>
                <Style TargetType="{x:Type ComboBoxItem}">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                                <Border Background="#333333" BorderBrush="#333333">
                                    <ContentPresenter/>
                                </Border>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsMouseOver" Value="true">
                                        <Setter Property="Background" Value="#222222" />
                                        <Setter Property="Foreground" Value="#DDDDDD" />
                                    </Trigger>
                                    <Trigger Property="IsEnabled" Value="false">
                                        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ComboBox.ItemContainerStyle>
            <ComboBoxItem IsSelected="True">123</ComboBoxItem>
            <ComboBoxItem>456</ComboBoxItem>
            <ComboBoxItem>789</ComboBoxItem>         
        </ComboBox>
    </Canvas>
</Window>
0

There are 0 answers