SyleProblem: Can't Change BackGround Of Particular button?

后端 未结 1 739
自闭症患者
自闭症患者 2021-01-25 01:17
  1. I have one ==> UserControl.
  2. Inside that UserControl ==> One ItemsControl.

    Now ItemsControl generating But

1条回答
  •  醉话见心
    2021-01-25 02:08

    You are overwritting the Button's Template in your Style, so the Background color never gets used

    Default button template looks like this:

    
    

    And you are overwritting the template to say

    
        
    
    

    You need to bind the Border's Background color to the {TemplateBinding Background} so that it uses the Button's background color.

    I would also suggest using a DataTrigger instead of code behind to change the background color of the button.

       
    

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