Hello to all. I put a stackpanel in a menutool, but when I press it, the stackpanel closes, is there a way to not close the menutool and stackpanel when I press the stackpanel or something inside when I click it? thank you
PERFECT ! thank you !!!
Hello Flavio,
I apologize, it appears that the method that I had attached only seems to work if you click directly on the StackPanel that acts as the content of the menu item, which does not take up the entirety of the space of that particular menu item. I had not realized this before.
Instead of doing this, I would recommend using an ItemContainerStyle for the parent MenuTool. You can set this to a Style that targets ToolMenuItem and set its "StaysOpenOnClick" property to true. This will cause your menu items to remain open when you click them.
I have attached an updated version of the sample project to demonstrate. I hope this helps you.
Please let me know if you have any other questions or concerns on this matter.
3666.XamRibbonMenuToolNoClose.zip
it does not work :( I saw that there is xammenu, with that I succeed?
In order to prevent the MenuTool from closing when clicking the StackPanel inside, I would recommend hooking into the PreviewMouseUp event of your StackPanel and marking it handled by setting the e.Handled property to true, where "e" is the event arguments of the PreviewMouseUp event. This will prevent the normal MouseUp event from bubbling up to the menu item that will normally close the MenuTool.
I have attached a sample project to demonstrate the above.
XamRibbonMenuToolNoClose.zip