简体   繁体   English

WPF ContextMenu:我怎么知道是谁启动的?

[英]WPF ContextMenu: How can I tell who launched it?

I have a ContextMenu that can be opened from 2 different StackPanel's, how can I tell which panel actually launched the menu?我有一个 ContextMenu 可以从 2 个不同的 StackPanel 打开,我怎么知道哪个面板实际启动了菜单?

Under WinForms I could consult the SourceControl of the ContextMenuStrip to find this information.在 WinForms 下,我可以查阅 ContextMenuStrip 的 SourceControl 来查找此信息。

TIA, Martin. TIA,马丁。

I think, what you're looking for is the PlacementTarget -property of the ContextMenu.我认为,您正在寻找的是 ContextMenu 的PlacementTarget属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM