Context Menu in code

2 posts, 0 answers
  1. Don
    Don avatar
    22 posts
    Member since:
    Oct 2007

    Posted 02 Nov 2009 Link to this post

    How To attach a context menu to a control in code? What property of the parent control should I use to attach the context menu. I tried the content Property but it comes back witha run time exception of "Value does not fall within range" exception.
     thanks Don
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 03 Nov 2009 Link to this post

    Hello Don,

    You should use RadContextMenu.ContextMenu attached property:

    var menu = new RadContextMenu();
    menu.Items.Add(...)
    ...
    element.SetValue(RadContextMenu.ContextMenu, menu);

    Best wishes,
    Valeri Hristov
    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.
  3. DevCraft banner
Back to Top