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 7715591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:25:28+00:00 2026-06-01T02:25:28+00:00

I have a Combobox in WPF-MVVM and i have styled the combobox with changes

  • 0

I have a Combobox in WPF-MVVM and i have styled the combobox with changes in the popdown box and textbox of combobox.

When i scroll the combobox listitem thier background is pink is what i have chnaged. But after selecting a item from the combobox list, the selected value in combobox item has blue background. which is the default for a combobbox in both Windows Form and WPF.

See the image for more details.

enter image description here

How can i change that selectedtext background color in the combobox textbox control

The combobox has

IsEditable=True property set

  • 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-06-01T02:25:29+00:00Added an answer on June 1, 2026 at 2:25 am
    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Brushes.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    
        <ControlTemplate TargetType="ToggleButton" x:Key="ComboBoxToggleButtonTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="20" />
                </Grid.ColumnDefinitions>
                <Border BorderBrush="{StaticResource LightBrush}" 
                        CornerRadius="0" 
                        BorderThickness="1"
                        Name="Border" 
                        Background="{StaticResource WhiteBrush}" 
                        Grid.ColumnSpan="2" />
                <Border Margin="1"
              BorderBrush="{StaticResource DarkBrush}"
              CornerRadius="0"
              BorderThickness="0"
              Background="{StaticResource WhiteBrush}"
              Grid.Column="0" />
                <Path          
              Data="M0,0L4,4 8,0z"
              HorizontalAlignment="Center"
              Fill="{DynamicResource DefaultBrush}"
              Name="Arrow"
              VerticalAlignment="Center"
              Width="8"
              Grid.Column="1" />
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="ToggleButton.IsChecked" Value="True">
                    <Setter Property="Panel.Background" TargetName="Border" Value="{DynamicResource DefaultBrush}"/>
                    <Setter Property="Shape.Fill" TargetName="Arrow" Value="{StaticResource WhiteBrush}"/>
                    <Setter Property="Border.BorderBrush" TargetName="Border" Value="{DynamicResource DefaultBrush}"/>
                    <Setter Property="Border.BorderThickness" TargetName="Border" Value="1,1,1,0"></Setter>
                </Trigger>
                <Trigger Property="UIElement.IsEnabled" Value="False">
                    <Setter Property="Panel.Background" TargetName="Border" Value="{StaticResource DisabledBackgroundBrush}"/>
                    <Setter Property="Border.BorderBrush" TargetName="Border" Value="{StaticResource DisabledBorderBrush}"/>
                    <Setter Property="TextElement.Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                    <Setter Property="Shape.Fill" TargetName="Arrow" Value="#66FFFFFF"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>    
        <ControlTemplate TargetType="TextBox" x:Key="ComboBoxTextBoxTemplate">
            <Border
            Name="PART_ContentHost" Background="{DynamicResource LightDefaultBrush}"
            Focusable="False" />                
        </ControlTemplate>    
        <Style TargetType="{x:Type ComboBoxItem}">
            <Setter Property="UIElement.SnapsToDevicePixels" Value="True"/>
            <Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="TextElement.Foreground"  Value="{StaticResource ForeGroundBrush}"/>
            <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True"/>
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                        <Border
                  Name="Border"
                  SnapsToDevicePixels="True"
                  Padding="3,2,2,2">
                            <ContentPresenter
                    ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
                    Content="{TemplateBinding ContentControl.Content}" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="ComboBoxItem.IsHighlighted" Value="True">
                                <Setter Property="Panel.Background" TargetName="Border" Value="{DynamicResource DefaultBrush}"/>                            
                                <Setter Property="TextElement.Foreground" Value="White"></Setter>
                            </Trigger>
                            <Trigger Property="UIElement.IsEnabled" Value="False">
                                <Setter Property="TextElement.Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type ComboBox}">
            <Setter Property="UIElement.SnapsToDevicePixels" Value="True"/>
            <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True"/>
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
            <Setter Property="TextElement.Foreground" Value="{StaticResource ForeGroundBrush}"/>
            <Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="Height" Value="25"></Setter>
            <Setter Property="Margin" Value="0,2,0,2"></Setter>
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ComboBox">
                        <Grid>
                            <ToggleButton
                    ClickMode="Press"
                    Name="ToggleButton"
                    IsChecked="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                    Focusable="False"
                    Grid.Column="2"
                    Template="{StaticResource ComboBoxToggleButtonTemplate}"/>
                            <ContentPresenter
                    Margin="3,3,23,3"
                    HorizontalAlignment="Left"
                    Name="ContentSite"
                    VerticalAlignment="Center"
                    ContentTemplate="{TemplateBinding ComboBox.SelectionBoxItemTemplate}"
                    Content="{TemplateBinding ComboBox.SelectionBoxItem}"
                    IsHitTestVisible="False" />
                            <TextBox
                    Margin="3,1,1,1"
                    Visibility="Hidden"
                    HorizontalAlignment="Left"
                    Name="PART_EditableTextBox"
                    Background="Transparent"
                    VerticalAlignment="Center"
                    Style="{x:Null}"
                    IsReadOnly="False"
                    Focusable="False"
                    xml:space="preserve"                            
                    Template="{StaticResource ComboBoxTextBoxTemplate}"/>
                <Popup
                    Placement="Bottom"
                    Name="Popup"
                    Focusable="False"               
                    AllowsTransparency="True"               
                    IsOpen="{TemplateBinding ComboBox.IsDropDownOpen}"
                    PopupAnimation="Slide">
                  <Grid
                      MinWidth="{TemplateBinding FrameworkElement.ActualWidth}"
                      MaxHeight="{TemplateBinding ComboBox.MaxDropDownHeight}"
                      Name="DropDown"
                      SnapsToDevicePixels="True">
                    <Border
                        BorderBrush="{DynamicResource DefaultBrush}"
                        BorderThickness="1,1,1,1"
                        Name="DropDownBorder"
                        Background="{StaticResource WhiteBrush}"/>
                    <ScrollViewer Margin="1,0,1,0"
                        SnapsToDevicePixels="True">
                      <ItemsPresenter
                          KeyboardNavigation.DirectionalNavigation="Contained" />
                    </ScrollViewer>
                  </Grid>
                </Popup>
              </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="ItemsControl.HasItems" Value="False">
                                <Setter Property="FrameworkElement.MinHeight" TargetName="DropDownBorder" Value="95"/>
                            </Trigger>
                            <Trigger Property="UIElement.IsEnabled" Value="False">
                                <Setter Property="TextElement.Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                            </Trigger>
                            <Trigger Property="ItemsControl.IsGrouping" Value="True">
                                <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                            </Trigger>
                            <Trigger Property="Window.AllowsTransparency" SourceName="Popup" Value="True">
                                <Setter Property="Border.CornerRadius" TargetName="DropDownBorder" Value="0"/>
                                <Setter Property="Border.BorderThickness" TargetName="DropDownBorder" Value="1,0,1,1"/>
                                <Setter Property="FrameworkElement.Margin" TargetName="DropDownBorder" Value="0,0,0,0"/>
                            </Trigger>
                            <Trigger Property="ComboBox.IsEditable" Value="True">
                                <Setter Property="KeyboardNavigation.IsTabStop" Value="False"/>
                                <Setter Property="UIElement.Visibility" TargetName="PART_EditableTextBox" Value="Visible"/>
                                <Setter Property="UIElement.Visibility" TargetName="ContentSite" Value="Hidden"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </ResourceDictionary>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an editable combo box in wpf-mvvm application. I would like to add
I have a wpf-mvvm application. In that I have follwoing... <Combo box> item 1
I have below combo box in mvvm-wpf application. I need to implement Text search
I have a WPF/MVVM (using MVVM-Light) app setup with a ComboBox that is inside
I have a WPF ComboBox and am using MVVM to bind the ItemsSource and
I have seen this post: WPF ComboBox: background color when disabled and some others...
I want to have a wpf combobox that displays the dropdown list box with
I have a ComboBox in WPF which is databound, and has data template which
I have a WPF ComboBox named cbFileSize. I try to get is selected value
I have a WPF combobox <ComboBox Name=cmbExpression IsEditable=True/> Now I have written some text

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.