ContextMenu not closing properly when using complex template (Unity)
Posted: 01 Sep 2017, 17:22
Hi,
I'm having a case where the context menu won't close after it has been open, when I put a button (or anything more than a label) inside a MenuItem header.
Things will behave properly until I click on the content (the button here). After this, the menu won't close with a click outside of it.
Clicking on the zone between the button and the edge of the menu causes things to work properly again.
Would there be anything I forgot, to get a consistent behaviour?
Thanks a lot,
Pierre
My WPF code:
I'm having a case where the context menu won't close after it has been open, when I put a button (or anything more than a label) inside a MenuItem header.
Things will behave properly until I click on the content (the button here). After this, the menu won't close with a click outside of it.
Clicking on the zone between the button and the edge of the menu causes things to work properly again.
Would there be anything I forgot, to get a consistent behaviour?
Thanks a lot,
Pierre
My WPF code:
Code: Select all
<Border Background="#22000000">
<Border.ContextMenu>
<ContextMenu>
<MenuItem>
<MenuItem.Header>
<Button Content="something"/>
</MenuItem.Header>
</MenuItem>
</ContextMenu>
</Border.ContextMenu>
</Border>