I have a set of classes for working with menus that are quite like SoapBox's MenuItem classes. I don't have a context menu yet but I stumbled upon the SoapBox implementation and it seems ok, but cannot get it to work. I also found no sample of how to use it. Here's what I tried:
First I added all related classes to my project, and removed the Export attribute from ContextmenuView and ContextMenuWrapperView.
Then provide a working implementation for IContextMenu:
I changed the ContextMenuWrapperView.xaml to have a style key:
And put a ContextMenu in the xaml for a usercontrol on which I want a ContextMenu shown.
The DataContext of the usercontrol is set to a VM that has the context menu VM as a property:
The menu is populated with a couple of items, but when running this I can see a ContextMenuWrapper being instantiated, followed by a call to MyContextMenu, and ContextMenuWrapperView/ContextMenuView are instantiated as well, but the only thing shown upon right-clik is a menu with one empty item.
Any input would be greatly appreciated!