Reputation: 147340
Simple question here: what does the StaysOpen
property of the ContextMenu
(or equivalently Popup
) control actually do? I have tried observing the difference in behaviour, but I notice none whatsoever.
MSDN states the following:
true if the menu should stay open until the IsOpen property changes to false; otherwise, false. The default is false.
However, this is really quite vague, and is of no help to me. I was previously guessing that the popup would only be closed when IsOpen
is set to false from code - and not when it loses focus/mouse capture (my desired behaviour), but this seems to not be the case.
Could someone please explain what exactly this property is meant to do? Ideally, an exampe identify that difference in behaviour would be most helpful. Finally, if you have any suggestions how I might get my desired behaviour, that would be great.
Upvotes: 1
Views: 2927
Reputation: 147340
Seems like the answer is that because ContextMenu
captures the mouse, the popup inevitably closes because the control is automatically wired to close the popup when the mouse loses capture. A design flaw, perhaps? It seems that it can however be overcome by using a primitive Popup
control, or a ToolTip
when appropiate.
Upvotes: 1