none
Change the selection color in ComboBox RRS feed

  • Question

  •  

    Hi,

     

    I want to use a different color than the default Blue when selecting a text in a combo box.

    Is there any simple way besides register to all the relevant events and set the BackColor?

     

     

    Thanks

    Idit

    Monday, January 14, 2008 4:08 PM

Answers

  • The selection color is controlled by windows, so I don't think you can change it without painting it yourself.

     

    Monday, January 14, 2008 4:26 PM

All replies

  • The selection color is controlled by windows, so I don't think you can change it without painting it yourself.

     

    Monday, January 14, 2008 4:26 PM
  • Hi Idit,

     

    If you would like to use the CombBox with WPF, there is a simple way for you to change the default color when selecting a text in a CombBox as the following sample codes. Otherwise you need to consider Chris's suggestion. 

    Code Block

       <ComboBox Background="Red">

            <ComboBox.Resources>

              <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Yellow" />

              <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Green" />

              <SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="Red" />

            </ComboBox.Resources>

            <TextBlock>TEST</TextBlock>

            <TextBlock>TEST</TextBlock>

            <TextBlock>TEST</TextBlock>

            <TextBlock>TEST</TextBlock>

            <TextBlock>TEST</TextBlock>

            <TextBlock>TEST</TextBlock>

            <TextBlock>TEST</TextBlock>

        </ComboBox>

     

    Try to check out this blog for details - http://blogs.microsoft.co.il/blogs/tamir/archive/2007/04/10/How-to-change-listbox_2C00_-combobox-or-listview-selection-and-background-color.aspx

     

    Hope this helps,

    Regards,

    Wednesday, January 16, 2008 3:21 AM
  • Not the answer you might be looking for, but you can open the dialog by executing the file DESK.CPL.

    Wednesday, January 16, 2008 2:03 PM
  •  

    I am working in C# and not HTML page, so I need to do it in the code.

     

     

    Thanks

    Idit

    Sunday, January 20, 2008 7:00 AM