For my WPF application I’m using MVVM, and now I want to show a generated context menu when the user right-clicks on something.
Routing the right-click to some action was easy, but how do I show a contextmenu which items are generated by the ViewModel?
I don’t even have an idea where to start to display a context menu, since I do not have direct access to the view in MVVM.
Apologies for the delay in replying, had to have a bit of an experiment to get it to work. Give the following code a go. I just set up my own rubbish data source just so I could display some sort of data. It only displays if I right click over the first column heading and no where else… which I think is what you want, right? Let me know how you get on…any probs will continue to have a think.