2

I have an ElementHost object in a WinForm dialog. This elementhosts child is a Popup. I want to hide or close the Popup when the user clicks anywhere. I can do it when the click happened in the Popup. How to close it when the user clicks outside the popup, on a WinForm control?

Miklós Balogh
  • 2,164
  • 2
  • 19
  • 26

1 Answers1

1

Did you try StaysOpen=false?

Daniel Rose
  • 17,233
  • 9
  • 65
  • 88
  • I don't know where to put this statement. Adding event handler which sets the StaysOpen property to false to every controls click event impossible. If Popup would be placed in a pure wpf control tree it would be easy because of the Routed event strategy. But its "grandparent" is a WinForm control. – Miklós Balogh Oct 04 '11 at 09:16
  • That statement is a property of the Popup. So you set it whereever you create the popup. – Daniel Rose Oct 04 '11 at 10:02
  • Uhh, I just realized that I confused the meaning of the StaysOpen property. Thanks. – Miklós Balogh Oct 04 '11 at 10:28