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 is clicked. I have exposed the command object from my view model and just need to bind it to the image control.
Is it possible to bind this command object to an image control? If so any advice would be appreciated.
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: