Combobox Mouseover

后端 未结 1 1953
不思量自难忘°
不思量自难忘° 2021-01-14 18:26

I would like to change the background (mouseover) color of my combobox when i move with a mouse over it.

I have read many post on stackoverflow and

1条回答
  •  终归单人心
    2021-01-14 18:47

    Naive Solution: Just add brush to the resources and reference it from the Background property (via StaticResource binding) of the ComboBox:

    
    
        
        
    
    
        
    
    

    Problem: After item is selected the background color is reset back to the default color. The only solution to fix this is to override the default template of the combobox.

    Fix: Modify default ComboBox template. ComboBox default template is present on msdn. Here is the link - http://msdn.microsoft.com/en-us/library/ms752094(v=vs.100).aspx. See "ComboBox ControlTemplate Example" section.

    Related links:

    MouseOver highlighting style returning to default after a second (Caused by Aero?)

    http://social.msdn.microsoft.com/Forums/en/wpf/thread/a18891e9-8879-4819-9679-247341782f60

    0 讨论(0)
提交回复
热议问题