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

windows contextmenustrip on radtreenode

5 Answers 101 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
pixelware
Top achievements
Rank 1
pixelware asked on 30 Apr 2009, 09:20 AM
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.

5 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 30 Apr 2009, 12:01 PM
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.
0
Mike
Top achievements
Rank 2
answered on 08 May 2009, 02:48 PM
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
0
Victor
Telerik team
answered on 08 May 2009, 04:09 PM
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.
0
Mike
Top achievements
Rank 2
answered on 08 May 2009, 04:24 PM
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
0
Victor
Telerik team
answered on 11 May 2009, 09:41 AM
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.
Tags
Treeview
Asked by
pixelware
Top achievements
Rank 1
Answers by
Victor
Telerik team
Mike
Top achievements
Rank 2
Share this question
or