WPF menu item that doesn't close when clicked

前端 未结 2 979
再見小時候
再見小時候 2021-01-04 19:14

Is it possible to make a WPF menu item that, when clicked, does not close the dropdown menu?

Imagine a Preferences menu, with several checkbox-style preference setti

相关标签:
2条回答
  • 2021-01-04 19:40

    Would the Popup visual be of any use here? You can show it at any position above your window. IIRC you must tell the popup to close yourself, so you can define when the popup is closed.

    Using proper layout you can make it look like a menu or dropdown thing.

    0 讨论(0)
  • 2021-01-04 19:45

    MenuItem has a Property called StaysOpenOnClick which seems to be what you're looking for

    So, to stop MenuItem from closing Menu/ContextMenu on click

    <MenuItem Header="MenuItem That Doesn't Close On Click"
              StaysOpenOnClick="True"
              .../>
    
    0 讨论(0)
提交回复
热议问题