
I have a visual studio like docking layout.
Right clicking on controls that are placed within a RadPane always triggers a context menu that belongs to the RadPane itself ("Movable, Dockable, ..., Hide") and is not the built in context menu of that particular control where the event was triggered from (eg TextBox, FlowDocument, TreeView).
Is there a way to stop this behaviour? I guess it must be something really trivial, I am sorry for that.
Thanks for your kind help.
Marc
Edit: Handling MouseRightButtonUp in the toplevel parent container under RadPane and setting Handled to true will suppress the radpane context menu, but the context menues for any other control like treeviews, textboxes and flowdocuments as well.
11 Answers, 1 is accepted
Thank you for contacting us.
To remove the ContextMenu from the Pane you could set the ContextMenuTemplate property to null. Also, you could refer to the following forum post: http://www.telerik.com/community/forums/wpf/docking/hide-radpane-context-menu-q1-10.aspx
If you have any other questions please let us know.
Kind regards,
Konstantina
the Telerik team

Hello, thanks for your answer,
but I did not intend to remove the context menu. It is fine if it is displayed after right clicking on the RadPane header. I just don't want to have the RadPane associated context menu to show up when right clicking on controls that are placed within a RadPane. This way the context menu of the particular control is being suppressed, so that I don't see commands related to that control (cut copy paste commands for textbox controls, copy and annotation commands for a flow document control).
I managed to disable showing the radpane context menu on these controls as I mentionend by handling the rightmousebuttonup event (e.Handled = true) in the parent container that is placed on the radpane, but now no context menu at all shows up.
If I would not handle this event, the radpane context menu would show up where ever I right click in the space that is occupied by the child controls in that particular radpane.
docking
- radpane (context menu shows up = ok)
-- grid (handles rightmousebuttonup)
--- textbox (no context menu shows up = bad)
--- flowdocument (no context menu shows up = bad)
- radpane (context menu shows up = ok)
-- grid (handles rightmousebuttonup)
--- treeview (no context menu shows up = bad)
In the example in the forum post is illustrated how to keep the ContextMenu of the Pane only on the Header and in the DropDown button. Then, if you put something in the Content of the Pane and set a ContextMenu to it, it works as you require.
Please find attached a sample project which illustrates that.
If you have further questions let us know.
Regards,
Konstantina
the Telerik team

Thanks again for your reply.
This example so far does what it should do. And after replacing the already built-in context menu with a context menu via the ContextMenuTemplate property of radpane my example works as well.
But I think the context menu implementation of raddocking suffers from a shortcoming unless I am not misunderstanding parts of the concept. Let me explain:
If you delete "ContextMenuTemplate="{StaticResource ContextMenuTemplate}", the example does exactly what you would not expect:
The built-in context menu of radpane is shown on every right click on any control that is placed in the radpane content. To overcome this nasty behavior you have to actually re-implement the already existing context menu for radpane via the ContextMenuTemplate. So you are rewriting exactly the same context menu that already existed before. Right? This not only blows up the code as I have to this for every radpane, it is repeating something that is already there.
<!--
Old behavior (radpane context menu shows up on every control:
<telerikDocking:RadPane Header="Drop Down menu">
-->
<!-- Expected behavior: -->
<telerikDocking:RadPane Header="Drop Down menu" ContextMenuTemplate="{StaticResource ContextMenuTemplate}">
<StackPanel>
<!-- TextBox context menu now shows up -->
<TextBox Text="Test" Width="250" Height="30"/>
<!-- FlowDocument context menu now shows up -->
<FlowDocumentReader>
<FlowDocument>
<Section>
<Paragraph>
Text ... and even more text
</Paragraph>
</Section>
</FlowDocument>
</FlowDocumentReader>
</StackPanel>
</telerikDocking:RadPane>
Yes, you are right that this approach repeats what is already there. We are aware of this issue. It is logged in our Public Issue Tracking System. You can view it here. You can vote for it, track its status and see when it is going to be implemented.
If you have any other questions please feel free to ask again.
Greetings,
Konstantina
the Telerik team

We think it's a little bit strange that we have to vote for reparing bugs.
We haven't scheduled yet this feature in our future development plans. If we receive more clients' requests we will consider including it sooner. You can view our product's roadmap for more information about our future development plans: http://www.telerik.com/products/wpf/whats-new/roadmap.aspx
Please let us know if you have any other questions about our controls.
Best wishes,
Konstantina
the Telerik team

Could you please explain how exactly you want the ContextMenu to behave in the DocumentPane, as the default behaviour of it is to have a ContextMenu only in its header.
Looking forward to your reply.
Regards,
Konstantina
the Telerik team

I'm putting a Pane (not DocumentPane) in the DocumentHost, and selecting text in a textbox does not give me a Cut, Copy, Paste context menu. I still get the Pane's context menu no matter where I right-click in the Pane. If the Pane is not in the defined DocumentHost using the ContextMenuTemplate it works as expected (it only appears from the header).
I'd like it to work like the example provided. You get default textbox context menus when inside a textbox and a Pane context menu when right-clicking the Pane header.
Please use the RadDocumentPane, instead of the RadPane in the DocumentHost and the scenario will work as expected.
Please let us know if you have further questions.
Regards,
Konstantina
the Telerik team