RadTreeView.RadContextMenu is obsolete

3 posts, 0 answers
  1. Jill-Connie Lorentsen
    Jill-Connie Lorentsen avatar
    118 posts
    Member since:
    Nov 2008

    Posted 16 Sep 2009 Link to this post

    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. Jill-Connie Lorentsen
    Jill-Connie Lorentsen avatar
    118 posts
    Member since:
    Nov 2008

    Posted 17 Sep 2009 Link to this post

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

    JCL

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 18 Sep 2009 Link to this post

    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.
Back to Top