I have a WPF application..In which I have an Image control in Xaml file.
On right click of this image I have a context menu.
I would like to have same to be displayed on "Left click" also.
How do I do this in MVVM way ?
I have a WPF application..In which I have an Image control in Xaml file.
On right click of this image I have a context menu.
I would like to have same to be displayed on "Left click" also.
How do I do this in MVVM way ?
Hey I came across the same problem looking for a solution which I didn't find here.
I don't know anything about MVVM so it's probably not MVVM conform but it worked for me.
Step 1: Give your context menu a name.
Step 2: Double click the control object and insert this code. Order matters!
Step 3: Enjoy
This will react for left & right click. It's a button with a ImageBrush with a ControlTemplate.
You can do this by using the MouseDown event of an Image like this
And then show the ContextMenu in the EventHandler in code behind