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

Restrict context menu for child controls

4 Answers 127 Views
Menu
This is a migrated thread and some comments may be shown as answers.
sunu
Top achievements
Rank 1
sunu asked on 03 Jun 2009, 12:30 PM

Hi

I have a master control GRID and within that I have two other controls. I have placed a context menu within the master control and have to restrict the menu in my other child controls

Please find the below code :

 

 

<radDock:RadDocking.DocumentHost>

 

 

 

<radDock:RadSplitContainer>

 

 

 

<telerik:RadContextMenu.ContextMenu>

 

 

 

<telerik:RadContextMenu x:Name="contextMenu">

 

 

 

<telerik:RadMenuItem Header="Add" x:Name="cMnuAdd">

 

 

 

<telerik:RadMenuItem Header="Class" x:Name="cMnuClass" Click="cMnuClass_Click"/>

 

 

 

<telerik:RadMenuItem Header="Association" x:Name="cMnuAssociation" Click="cMnuAssociation_Click"/>

 

 

 

</telerik:RadMenuItem>

 

 

 

</telerik:RadContextMenu>

 

 

 

</telerik:RadContextMenu.ContextMenu>

 

 

 

<radDock:RadPaneGroup>

 

 

 

<radDock:RadDocumentPane Title="Object Designer">

 

 

 

<radDock:RadDocumentPane.Content>

 

 

 

 

<ScrollViewer x:Name="ScrollViewer" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
<!-- Restrict the context menu here -->

 

 

 

<local:ObjectDesigner></local:ObjectDesigner>

 

 

 

</ScrollViewer>

 

 

 

</radDock:RadDocumentPane.Content>

 

 

 

</radDock:RadDocumentPane>

 

 

 

</radDock:RadPaneGroup>

 

 

 

</radDock:RadSplitContainer>

 

 

 

</radDock:RadDocking.DocumentHost>

Please let me know a solution for this. If this thread is already posted, then send me the link so that I can refer

Regards
SUNU

 

4 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 03 Jun 2009, 12:55 PM
Hello,

First I want to note that it is not a good idea to set properties on the RadSplitContainer and RadPaneGroup controls, since RadDocking can automatically dispose them if they are not needed, and later create new instances if needed. The code you sent will work if the users do not move the panes outside of the document host. I would recommend setting the context menu attached property on RadDocking, or on each RadPane/RadDocumentPane where it has to be displayed.

In case you use a single context menu for the whole RadDocking, or for a specific RadSplitContainer as in your code snippet, in the Opened event of RadContextMenu you can check if the user clicked on area where the menu should be visible or not and close it if needed using its IsOpen property.

For more information about the Opened event and a similar scenario, please, check my blog post:
http://blogs.telerik.com/valerihristov/posts/09-06-01/reusing_and_customizing_a_single_contextmenu_on_a_treeview_with_radcontrols_for_silverlight.aspx

All the best,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
answered on 29 Nov 2010, 09:38 AM
Hi Valeri,
I am just starting out with RadControls (and WPF for that matter). I had in my project a RadTreeView usercontrol on a TabControlItem with a custom context menu. I have now moved this control onto a RadPane in a RadDocking section, but now my context meny no longer fires, instead the RadPane's fire. Any pointers?

Regards
Renier
0
George
Telerik team
answered on 01 Dec 2010, 12:42 PM
Hello Renier,

Thank you for contacting us.

We are aware of this problem with RadDocking control. The RadPane's context menu overrides that you set to the RadTreeView control. I would suggest you to disable the RadPane's context menu. For more information, please refer to the following link - http://www.telerik.com/help/silverlight/raddocking-how-to-add-menu-items-to-the-radpanes-menu.html

I hope this helps.

Greetings,
George
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
answered on 01 Dec 2010, 12:48 PM
Hi George,

Thanks for the feedback. I actually came across the same solution searching through the knowledgebase. Worked like a charm with a few keywords. Don't know how anyone programmes without the internet ;-)
Tags
Menu
Asked by
sunu
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Renier Pretorius
Top achievements
Rank 2
Iron
Iron
Iron
George
Telerik team
Share this question
or