效果:
前端写法:
也可以在后端动态生成:
//添加菜单栏 var menu = new MenuItem(); menu.Header = "menu1"; menu.Click += (s, e) => { //do something }; //menu.IsEnabled = true; myBorder2.ContextMenu = new ContextMenu(); myBorder2.ContextMenu.Items.Add(menu);
2024-02-26 21:52:22
效果:
前端写法:
也可以在后端动态生成:
//添加菜单栏 var menu = new MenuItem(); menu.Header = "menu1"; menu.Click += (s, e) => { //do something }; //menu.IsEnabled = true; myBorder2.ContextMenu = new ContextMenu(); myBorder2.ContextMenu.Items.Add(menu);