I'm currently trying to solve an issue as follows:
I have no parent window, i just right click on the second screen which opens a WPF ContextMenu (from a native C++ mother app) which actually does not appear on the second screen but on the first.
- I tried using the mouse coordinates. does not work because ContextMenu will stay on the first screen.
- Placing an invisible helper window on the second screen, setting this as a parent and opening the ContextMenu at the coordintes relative to the second screens upper left corner works fine. But i don't want to use the helper window.
So now: How can i put the ContextMenu on the second screen without a parent window. Is there some way to tell the menu what screen to use? Maybe there are some Parameters i can use from the the "CustomPopupPlacementCallback" in the ContextMenu?
Any help would be appreciated :-D
cheers!
From msdn:
Also from MSDN
More reading: ContextMenu class, PlacementMode Enumeration (actually seems useful).
Also, remember that this is actually shown inside a Popup.
Might not be relevant, but Nmaait's answer in the following link uses some win32 calls to get the position of the mouse. Maybe you can leverage this in order to get your context menu where you want it to be:
drop-a-window-into-another-window