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
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);