// open context menu
var contextMenu = new ContextMenu();
var versionsMenu = new ToolStripDropDownMenu() {Text = "Version"};
StaticHelpers.GetPackageVersions(textBlockSelected.Text).ForEach(f=> versionsMenu.Items.Add(f));
var scheduleMenu = new ToolStripMenuItem {Text = "Schedule"};
var argumentsMenu = new ToolStripMenuItem() {Text = "Arguments"};
var removeMenu = new ToolStripMenuItem {Text = "Remove"};
//show context menu
contextMenu.Items.Add(versionsMenu);
contextMenu.Items.Add(scheduleMenu);
contextMenu.Items.Add(argumentsMenu);
contextMenu.Items.Add(removeMenu);
//add handlers
// executeMenu.Click += (o, args) => { ExecutePackage(sender); };
//open context menu
contextMenu.IsOpen = true;
我尝试了MenuItems而不是ToolStripMenuItem或ToolStripDropDownMenu,但在任何地方都找不到关于如何嵌套这些内容的任何文档或示例,例如,当用户右键单击我的一个控件时,我想显示此菜单:
如果用户将鼠标悬停在版本上,我希望扩展另一个contextMenu并显示以下内容:
如何实现此功能?