Hi,
We have changed the old implementing context menu xamMenuItems to use Infragistic's xamContextMenu. However, we struggled to convert to show second context menu on context menu. Similar example would in Windows 10, when you right click on running application in the task bar it shows application menu to pin or launch. On application name you can do another right click which will display additional context menu with Open, run as Administrator and etc.
How to achieve this with xamContextMenu control?
Hello Tomas,
After some further testing and research, I found out that having two instances of different XamContextMenus is not possible, because once the second XamContextMenu opens the other one closes.
Another solution to this is to use nested XamMenuItems instead of showing a separate XamContextMenu, which in my opinion could be considered the simplest solution. To create a nested XamMenuItem simply another XamMenuItem should be inserted within its tag.
An alternative to it is using XamMenu by handling the MouseRightButton up on the control and showing the XamMenu in vertical orientation. After that the StaysOpenOnClick property should be set to true in order for the XamMenu to stay open when the right click is preformed. Again, the MouseRightButtonUp needs to be handled this time on the menu and the XamContextMenu should be shown to the user. Please note that the visibility and the opening/closing of the XamMenu need to be handled as well.
Please let me know if you have any questions or concerns.
Regards, Ivan Kitanov
Thanks for an example. This works great. However, is there any way to eliminate this limitation with disappearing menu?
best regards,
Tomas
I’ve tried implementing a XamContextMenu within another XamContextMenu by initializing it in code and then handling the RightMouseButtonUp event of the XamMenuItem or the XamContextMenu. Inside the event handler the mouse position should be captured after that in order to display the sub-context menu the coordinates of the mouse position should be set as Vertical and Horizontal offset of the sub-menu. After that the IsOpen property of the sub-menu needs to be set to true, in order to display it.
The only limitation to this approach is that once the sub-menu shows the main context menu disappears.
Below I am sending a small sample application that demonstrates what I have explained above.
Please test the sample on your side and let me know if you have any questions or concerns.
XamContextMenuWithinXamContextMenu.zip