Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6385755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:56:22+00:00 2026-05-25T02:56:22+00:00

I would like to customize the default – OnMouseOver-color for the Combobox and also

  • 0

I would like to customize the default – “OnMouseOver”-“color” for the Combobox and also the “Background” color for the list that drops down in the combobox ..can we customize the above mentioned properties of combobox..If yes, please help me..
the following is my Xaml code for the combobox :

<ComboBox Name="CmbBox1" BorderBrush="Black" Margin="1,1,1,1"
                      ItemsSource="{Binding}">
                <ComboBox.Style>
                    <Style TargetType="{x:Type ComboBox}">
                        <Style.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" Value="Red"/>
                        </Trigger>
                        </Style.Triggers>
                    </Style>
                </ComboBox.Style>
                    <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Background="{Binding Background}" Foreground="Black" FontSize="10"  TextAlignment="Left" 
                                               FontWeight="Black" Text="{Binding}"></TextBlock>

                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:56:23+00:00Added an answer on May 25, 2026 at 2:56 am

    Here is one way to do what I think you’re after. I made a few changes to your ComboBox.

    Added comments in the Xaml code so it should be pretty self explanatory

    Edit. This didn’t work under Windows 7 because of the ButtonChrome that is deep within the ComboBox Template. You could either re-template the whole thing, or use this workaround which uses some code behind.

    First, add a reference to PresentationFramework.Aero
    Then subscribe to the Loaded event of the ComboBox and disable the ButtonChrome and bind the MainGrid background in the event handler like this

    private void CmbBox1_Loaded(object sender, RoutedEventArgs e)
    {
        ComboBox comboBox = sender as ComboBox;
        ToggleButton toggleButton = GetVisualChild<ToggleButton>(comboBox);
        ButtonChrome chrome = toggleButton.Template.FindName("Chrome", toggleButton) as ButtonChrome;
        chrome.RenderMouseOver = false;
        chrome.RenderPressed = false;
        chrome.RenderDefaulted = false;
        chrome.Background = Brushes.Transparent;
        Grid MainGrid = comboBox.Template.FindName("MainGrid", comboBox) as Grid;
        Binding backgroundBinding = new Binding("Background");
        backgroundBinding.Source = comboBox;
        MainGrid.SetBinding(Grid.BackgroundProperty, backgroundBinding);
    }
    
    private static T GetVisualChild<T>(DependencyObject parent) where T : Visual
    {
        T child = default(T);
        int numVisuals = VisualTreeHelper.GetChildrenCount(parent);
        for (int i = 0; i < numVisuals; i++)
        {
            Visual v = (Visual)VisualTreeHelper.GetChild(parent, i);
            child = v as T;
            if (child == null)
            {
                child = GetVisualChild<T>(v);
            }
            if (child != null)
            {
                break;
            }
        }
        return child;
    }
    

    Xaml

    <ComboBox Name="CmbBox1" BorderBrush="Black" Margin="1,1,1,1"
              ItemsSource="{Binding Source={x:Static Fonts.SystemFontFamilies}}"
              Loaded="CmbBox1_Loaded"
              Width="150">
        <ComboBox.Resources>
            <SolidColorBrush x:Key="MouseOverBrush"
                             Color="Red"/>
            <SolidColorBrush x:Key="DropDownListBrush"
                             Color="Green"/>
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
                             Color="Transparent"/>
        </ComboBox.Resources>
        <ComboBox.ItemContainerStyle>
            <Style TargetType="ComboBoxItem">
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type ComboBox}},
                                                    Path=IsDropDownOpen}"
                                 Value="True">
                        <Setter Property="Background" Value="{StaticResource DropDownListBrush}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ComboBox.ItemContainerStyle>
        <ComboBox.Style>
            <Style TargetType="{x:Type ComboBox}">
                <Style.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Background" Value="{StaticResource MouseOverBrush}"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </ComboBox.Style>
        <ComboBox.ItemTemplate>
            <DataTemplate>
                <Border x:Name="border" SnapsToDevicePixels="True">
                    <TextBlock Foreground="Black" FontSize="10"  TextAlignment="Left" 
                               FontWeight="Black" Text="{Binding}"></TextBlock>
                </Border>
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type ComboBoxItem}}, Path=IsMouseOver}" Value="True">
                        <Setter TargetName="border" Property="Background" Value="{StaticResource MouseOverBrush}"/>
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>
        </ComboBox.ItemTemplate>
    </ComboBox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to customize the background (and maybe the border too) of all
I would like to customize an off-the-shelf software that has a Lite Edition and
I would like to find a way to customize the default error html <div
I have a default tableview style with 4 entries and would like to customize
I have a 1920x1200 screen an would like to customize VS2008 code windows to
I'm working on a website for a client, and I would like to customize
I would like to write a shell extensions to completely customize the display of
Would like to get a list of advantages and disadvantages of using Stored Procedures.
I am wondering if it is possible to customize the default InfoWindow that pops
I am creating an android that acts as a media center. I would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.