C# WPF ComboBox Mouse over color

前端 未结 4 1631
后悔当初
后悔当初 2021-01-18 07:49

When the mouse hover over my ComboBox, I get an awful blue/lightblue pair of color for the backgroung of my ComboBox. I tried the solutions here :ComboBox Mouse over color,

4条回答
  •  一整个雨季
    2021-01-18 08:44

    Your problem arises from ButtonChrome in the ToggleButton's template. Remove it from the ToggleButton.

       ComboBox -> ToggleButton -> ButtonChrome 
    

    Steps :

    1) Open Expression Blend and edit a copy of ComboBox's Style , This will give you the Style of the ComboBox + it's Template and all it's TemplateParts , Among them is the problematic ToggleButton.

    2) Locate the ToggleButton and it's Style called "ComboBoxReadonlyToggleButton" .

    3) In "ComboBoxReadonlyToggleButton" replace the Themes:ButtonChrome with a Border (like shown in the 3'rd block of code below.)

    The ComboBox's default template (Simplified !):

    
                                         
            
                .....
            
            
            
                             
    
    

    The toggle button Style + Template (Simplified !).

     
    

    What you need to do is to override the default ComboBox template and edit the toggle button's style by replacing ButtonChrome with a Border :

     
         
            
                  
                    
                        
                    
                               
            
        
    
    

提交回复
热议问题