简体   繁体   中英

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?

Under WinForms I could consult the SourceControl of the ContextMenuStrip to find this information.

TIA, Martin.

I think, what you're looking for is the PlacementTarget -property of the ContextMenu.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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