Posted 14 years ago
by Vincent van Rooijen

In the samplebrowser of the Silverlight studio is only an in xaml defined nested menu available.
I need the generate a context menu dynamically so I tried this:
var contextMenu = new ActiproSoftware.Compatibility.ContextMenu();
var menuItem = new ActiproSoftware.Compatibility.MenuItem() { Header = "menu" };
var subMenuItem = new ActiproSoftware.Compatibility.MenuItem() { Header = "sub menu" };
menuItem.Items.Add(subMenuItem);
contextMenu.Items.Add(menuItem);
When you hover over the item with header "menu" and try to open the sub menu item, you get an ArgumentException: Value does not fall within the expected range.
I need the generate a context menu dynamically so I tried this:
var contextMenu = new ActiproSoftware.Compatibility.ContextMenu();
var menuItem = new ActiproSoftware.Compatibility.MenuItem() { Header = "menu" };
var subMenuItem = new ActiproSoftware.Compatibility.MenuItem() { Header = "sub menu" };
menuItem.Items.Add(subMenuItem);
contextMenu.Items.Add(menuItem);
When you hover over the item with header "menu" and try to open the sub menu item, you get an ArgumentException: Value does not fall within the expected range.