c# - Silverlight Context Menu IsOpen Exception? -
i have project templated silverlight control. when add dll project (with templated control) in mainpage , want open context menu right click, error:
mainpage.xaml
<mycontrols:draw x:name="ctrdraw"></mycontrols:draw>
draw.cs (templated silverlight control)
_contextmenu.isopen = true; --> error
errormessage
errmsg "unhandled error in silverlight application code: 4004 category: managedruntimeerror message: das festlegen von eigenschaft 'system.windows.frameworkelement.style' hat eine ausnahme ausgelöst."
init:
private contextmenu _contextmenu; private menuitem _contextmenuitem;
event:
private void map_mouserightbuttonup(object sender, graphicmousebuttoneventargs e) { _contextmenu = new contextmenu(); _contextmenuitem = new menuitem(); _contextmenuitem.header = "edit"; _contextmenu.items.add(_contextmenuitem); _contextmenuitem.click += new routedeventhandler(menuitem_click);
.....
Comments
Post a Comment