Restrict context menu for child controls

5 posts, 0 answers
  1. sunu
    sunu avatar
    19 posts
    Member since:
    Jun 2009

    Posted 03 Jun 2009 Link to this post


    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 :















    <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"/>




















    <radDock:RadDocumentPane Title="Object Designer">









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





























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



  2. Valeri Hristov
    Valeri Hristov avatar
    2252 posts

    Posted 03 Jun 2009 Link to this post


    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:

    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.
  3. Renier Pretorius
    Renier Pretorius avatar
    58 posts
    Member since:
    Apr 2010

    Posted 29 Nov 2010 Link to this post

    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?

  4. George
    George avatar
    1332 posts

    Posted 01 Dec 2010 Link to this post

    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 -

    I hope this helps.

    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  5. Renier Pretorius
    Renier Pretorius avatar
    58 posts
    Member since:
    Apr 2010

    Posted 01 Dec 2010 Link to this post

    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 ;-)
Back to Top