WPF左键点按钮弹出菜单如何实现

2025-01-03 05:24:12
推荐回答(2个)
回答1:

XAML:




Code:
// 写在 Window_Loaded 事件中看效果
cmd.Click += (obj, args) => { menu.IsOpen = true; };

回答2:

Use Icommand, then btn command binding --> Icommand {}, get{...relaycommand(p->show())}

... show()
{
popup ContextMenu block
}