windows contextmenustrip on radtreenode

6 posts, 0 answers
  1. pixelware
    pixelware avatar
    2 posts
    Member since:
    Nov 2006

    Posted 30 Apr 2009 Link to this post

    Good morning Telerik Team,

    I'm wondering if it's possible to use a Windows ContextMenuStrip on RadTreeNode control. I see it's possible to use it on the Radtreeview control, but I need context menus on the RadTreeNodes too.

    Thanks,

    Teba.
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 30 Apr 2009 Link to this post

    Hello Pixelware,

    Thank you for using our support system.

    You can assign a RadDropDownMenu to a RadTreeNode. You cannot assign a Winforms ContextMenu because RadTreeNode does not inherit from Control class and we have not explicitly implemented usage of a standard menu there. Please share with us what is stopping you from using a RadDropDownMenu for your tree nodes. Your feedback would be greatly appreciated. I am looking forward to your reply.

    Sincerely yours,
    Victor
    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. UI for WinForms is Visual Studio 2017 Ready
  4. Mike
    Mike avatar
    76 posts
    Member since:
    Nov 2004

    Posted 08 May 2009 Link to this post

    Hi Telerik,

    Am I missing something...  In version 6.1.0.0 of WinControls I see RadDropDownMenu control in the choose toolbox items dialog in VS2008, but...  We have recently upgraded to version 2009.1.9.414 and I no longer can find the RadDropDownMenu control.

    So...  How do I add a context menu to a RadTreeView using version 2009.1.9.414?

    Many thanks,
    ~Mike
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 08 May 2009 Link to this post

    Hi Mike,

    Thank you for writing.
     
    You can add a context menu to a node like this:
     
    RadDropDownMenu m = new RadDropDownMenu();  
    m.Items.Add(new RadMenuItem("MenuItem1"));  
    m.Items.Add(new RadMenuItem("MenuItem2"));  
    m.Items.Add(new RadMenuItem("MenuItem3"));  
    this.radTreeView1.Nodes[0].ContextMenu = m;  
     
     
    and you can add a context menu to RadTreeView like this:
     
    RadContextMenu m = new RadContextMenu();  
    m.Items.Add(new RadMenuItem("MenuItem1"));  
    m.Items.Add(new RadMenuItem("MenuItem2"));  
    m.Items.Add(new RadMenuItem("MenuItem3"));  
     
    RadContextMenuManager manager = new RadContextMenuManager();  
    manager.SetRadContextMenu(this.radTreeView1, m); 
     
    Please write back if you need further assistance.

    Greetings,
    Victor
    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.
  6. Mike
    Mike avatar
    76 posts
    Member since:
    Nov 2004

    Posted 08 May 2009 Link to this post

    Okay, so you no longer provide a control?

    Could you give me an example of wiring events for my context menu items?  IE:  MenuItem1_Click event and a dynamically created object.

    Sorry, event writting on dynamic object is a new concept for me.

    ~Mike
  7. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 11 May 2009 Link to this post

    Hello Mike,

    Yes, certainly. Here is how to do this:

    public Form1()  
    {  
        InitializeComponent();  
        RadMenuItem menuItem = new RadMenuItem("Click me!");  
        menuItem.Click += new EventHandler(menuItem_Click);  
    }  
     
    void menuItem_Click(object sender, EventArgs e)  
    {  
        // Do something when clicked  

    Please note that for .NET related concepts you should refer to Microsoft Developer Network, as you will find answers more quickly than waiting for us to respond on the forum. For using events you can review this page. Do not hesitate to write again if you need assistance with our controls.

    Kind regards,
    Victor
    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready