WPF Image Command Binding

前端 未结 5 645
耶瑟儿~
耶瑟儿~ 2020-12-09 09:37

I\'m putting a WPF application together in which I have an image control which I want to bind a custom command object to from my view model that will execute when the image

5条回答
  •  醉酒成梦
    2020-12-09 09:47

    You need to put the image in a button, and bind the button to the command:

    
    

    If you don't want the standard button chrome, just change the template of the button with something like that:

    
        
            
        
    
    

    Note that you will also need to change other properties to override the default button style, otherwise the template above will use the default button background and border:

    
    

提交回复
热议问题