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

Context Menu in code

1 Answer 76 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 1
Don asked on 02 Nov 2009, 10:53 PM
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

1 Answer, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 03 Nov 2009, 07:37 AM
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.
Tags
Menu
Asked by
Don
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Share this question
or