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.
Hello Gottfried,
Displaying the dock pane's context menu when right-clicking over the popup in order to display a specific context menu has been logged in our tracking system, with an issue ID of 219553. I have also created a support ticket on your behalf with number CAS-173307-R8H1V1 in order to link the development issue to it so that you are automatically updated when a Service Release containing your fix is available for download.
Regarding the disabled application commands, after commenting out the xaml code for specifying the context menu for border and textbox elements, right-clicking the selected text will display the default textbox' context menu with enabled Copy command. Please note that Cut and Paste commands will always be disabled because the IsReadOnly property is set to True. In this case, there is no need for creating a context menu.
Please take a look at the modified version of the sample and let me know if that works for you or if you need to specify a custom context menu for the textbox control.
Hi Martin,
Thanks for the fixation. I have tried to run my sample application with current release. It is working fine with given sample project, But now we're facing another issue. I have added an infragistics context menu on ContentPane too. Now when i tried to right click on popup it disapears the opened popup and shows the context menu for ContentPane. The modified sample project is attahced. Kindly have a look at the modified sample.
Thanks
Regards
What you could do is to handle the Opened and Closed events of the Popup and set the ContextMenuManager's ContextMenu to null in the Opened event handler and set it to the existing ContextMenu defined in the xaml in the Closed event handler.
Please take a look at the attached sample and let me know if you have any other questions on this matter.