This is a migrated thread and some comments may be shown as answers.

RadPane context menu in every child control

11 Answers 251 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Marc Sommer
Top achievements
Rank 1
Marc Sommer asked on 14 Sep 2010, 11:09 PM
Hello,

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

Sort by
0
Konstantina
Telerik team
answered on 15 Sep 2010, 03:45 PM
Hello Marc,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Marc Sommer
Top achievements
Rank 1
answered on 15 Sep 2010, 04:08 PM

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)

      

0
Accepted
Konstantina
Telerik team
answered on 16 Sep 2010, 03:29 PM
Hello Marc,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Marc Sommer
Top achievements
Rank 1
answered on 16 Sep 2010, 04:55 PM

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>

0
Konstantina
Telerik team
answered on 17 Sep 2010, 11:37 AM
Hello Marc,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rieni De Rijke
Top achievements
Rank 1
answered on 30 Nov 2010, 08:42 AM
Is there any news about this?
We think it's a little bit strange that we have to vote for reparing bugs.
0
Konstantina
Telerik team
answered on 01 Dec 2010, 10:35 AM
Hi Rieni,

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
Browse the videos here>> to help you get started with RadControls for WPF
0
Rayne
Top achievements
Rank 1
answered on 07 Dec 2010, 07:32 PM
This doesn't work if the Pane is inside a DocumentHost. It works the same as using {x:Null} - no context menu. At least it didn't for me when I added a DocumentHost to the sample project.
0
Konstantina
Telerik team
answered on 09 Dec 2010, 01:16 PM
Hi Rayne,

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
Browse the videos here>> to help you get started with RadControls for WPF
0
Rayne
Top achievements
Rank 1
answered on 09 Dec 2010, 02:23 PM
For this to work in the DocumentHost, does the Pane have to be a DocumentPane or can it be a regular Pane?

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.
0
Konstantina
Telerik team
answered on 10 Dec 2010, 12:55 PM
Hello Rayne,

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
Browse the videos here>> to help you get started with RadControls for WPF
Tags
Docking
Asked by
Marc Sommer
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Marc Sommer
Top achievements
Rank 1
Rieni De Rijke
Top achievements
Rank 1
Rayne
Top achievements
Rank 1
Share this question
or