Hi Everyone,
I am unable to open control specific context menu under XamDockManager. In floating state when I right click on any popup element on window it shows dockpanel context menu.
I have created a sample application depicting the problem we are facing, In a dock panel when you click the icon, it will open up a popup, this popup contains a textbox which should have it's own contextmenu but on right click it shows the contextmenu of dockpanel. Your help will be really appreciated.
Hello Gottfried Gillich,
Thank you for providing a sample!
I have taken a look at your scenario and what you could do is to handle the ContextMenuOpening event for both the Border and the TextBox elements.
Please note that e.Handled should be set to "true" that will prevent the showing of the dockPanel context menu. Afterwards, the context menu's IsOpen is set to true that will display the specific context menu.
Please take a look at the modified attached sample let me know if you have any questions on this matter.
Hello Martin,
Thank you for the prompt answer.
We are still struggling with the issue
In the sample you provided, StayOpen property of popup is removed as opposed to our approach, because on clicking somewhere else on screen we want to close the popup. So we want to keep the StayOpen = False or you can suggest a work around.
The second problem is that the default commands for text box are disabled which should be enabled in case when some text is selected so seems like it is not state aware even though now it knows the controls. e.g. if we select a text in the textbox and right click the context menu displayed have all three options (cut, copy paste) disabled .
If you could you assist us in regards to work with StayOpen property to False, and the default commands should work fine.
P.S: We have tried the follwoing solution.1: Set StayOpen=True, same as the way you provided the sample. On LostFocus event, window IsOpen is set to false which hide it but in our scenario it is quite possible that user opened the popup and never have focused on the popup window in which case LostFocus event won't fire.