I have a DataTemplate containing an Image. To the Image I added a ContextMenu with a MenuItem. To the MenuItem I associated a command. I then handle the command in the view using the DataTemplate.
In the CanExecute handler I have e.CanExecute = true. But the Executed handler is never executed. If I remove the Command assignment the MenuItem, the Menu is shown correctly when I right-click on the Image.
What am I doing wrong?
Thanks!
I figured this out – After e.CanExecute = true; I had a MessageBox.Show, and this was preventing the Executed from being called. I am not sure why though.