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

RadTreeView.RadContextMenu is obsolete

2 Answers 153 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Jill-Connie Lorentsen
Top achievements
Rank 1
Jill-Connie Lorentsen asked on 16 Sep 2009, 11:45 AM

After upgrading to Q2 2009 SP1 I have problems with the drop down menu assigned to my tree view (RadTreeView.RadContextMenu = RadDropDownMenu)

I get an error saying that the RadTreeView.RadContextMenu is obsolete, and I should use the RadContextMenuManager instead.

Trying to compile results in an error "Cannot implicitly convert type 'Telerik.WinControls.UI.RadDropDownMenu' to 'Telerik.WinControls.UI.RadContextMenu' "

I do a lot of formatting on my RadDropDownMenu in code, so I hope there is a way to keep using it in my tree view?

Regards, Jill-Connie Lorentsen

2 Answers, 1 is accepted

Sort by
0
Jill-Connie Lorentsen
Top achievements
Rank 1
answered on 17 Sep 2009, 09:35 AM

I've done it "the hard way" and implemented use of RadContextMenuManager and RadContextMenu

JCL

0
Nikolay
Telerik team
answered on 18 Sep 2009, 12:24 PM
Hello Jill-Connie Lorentsen,

Generally, you can just change the type of your RadDropDownMenu to RadContextMenu and your code will compile correctly. For example, if you code is:
RadDropDownMenu dropDown = new RadDropDownMenu();  
 
dropDown.Items.Add(new RadMenuItem("First"));  
dropDown.Items.Add(new RadMenuItem("Second"));   
dropDown.Items.Add(new RadMenuItem("Third"));  
 
this.radTreeView1.RadContextMenu = dropDown; 

and you update to Q2 2009 SP1, you need to change it this way:
RadContextMenu dropDown = new RadContextMenu();  
 
dropDown.Items.Add(new RadMenuItem("First"));  
dropDown.Items.Add(new RadMenuItem("Second"));   
dropDown.Items.Add(new RadMenuItem("Third"));  
 
this.radTreeView1.RadContextMenu = dropDown; 

However, please note that as the warning says, the RadTreeView.RadContextMenu property will be removed in the next major release and you will need the RadContextMenuManager in order to create a RadContextMenu property.

If you have additional questions, feel free to contact me.

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Treeview
Asked by
Jill-Connie Lorentsen
Top achievements
Rank 1
Answers by
Jill-Connie Lorentsen
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or