WPF Popup and WindowsFormsHost Problem (unresponsive or doesn't close on click outside popup)

235 Views Asked by At

my issue is basically a duplicate of unresolved WPF Popup and WindowsFormsHost Problem , but I was hoping after 10+ years somebody might know an answer.

I'm adding a WindowsFormsHost inside a popup.

var host = new WindowsFormsHost();
System.Windows.Forms.MaskedTextBox mtbDate = new System.Windows.Forms.MaskedTextBox("00/00/0000");
host.Child = mtbDate;
colorPopup.Child = host;

and the popup is in xaml

<Popup x:Name="colorPopup" StaysOpen="True">
    <TextBox Margin="0,95,365,140"></TextBox>
</Popup>

If I set StaysOpen to False, I can interact with other elements in the popup but NOT with the hosted element. Popup closes when i click outside it.

If I set StaysOpen to True, I can interact with the hosted element but the popup doesn't close when clicked outisde the popup.

Any ideas, wallhacks or other gimmicks? I'm pretty desperate.

Note: interaction with the element is not an issue if it's outisde of the popup or if I use new Window instead of popup, but using the popup would be ideal.

0

There are 0 best solutions below