How to inherit Button behaviour in WPF style?

前端 未结 3 1020
清歌不尽
清歌不尽 2021-01-21 01:13

I have overriden the WPF default Maximize, Minimize buttons like explained here. But, in my case, instead of using an Image to override background image for that bu

3条回答
  •  离开以前
    2021-01-21 01:40

    i think you should not override the template as it looses basic operations of the control what you should is set the contentTemplate not the template as contenttemplate defines how will your button will look like without halting its basic functions..

    this is how you can edit the contenttemplate of button..

     
    

    if you want to set how your button should look like in app.xaml just set it set its datatemplate like this..

            
                
                    
                        
                        
                    
                    
                    
                
            
    

    us this datatemplate on your button in xaml like this..

提交回复
热议问题