WPF Popup hiding problem

后端 未结 6 1609
耶瑟儿~
耶瑟儿~ 2021-01-13 22:59

Suppose you have a ToggleButton for opening a Popup, same behaviour as all known elements as ComboBox etc.

... which is this c

6条回答
  •  太阳男子
    2021-01-13 23:11

    You could just bind the Popups StaysOpen property to the Buttons IsMouseOver property. This way, the popup will close whenever you click something outside the popup (IsMouseOver = false = StaysOpen) and it will close the Popup when clicking the ToggleButton (IsMouseOver = true = StaysOpen). This way, even the clicks outside the Popup will be handled.

    
    
    

提交回复
热议问题