I have an UserControl
that contains a ToggleButton
and a Popup
attached to it. Something like this:
<ToggleButton x:Name="TogglePopupButton"
IsChecked={Binding ShowPopup}/>
<Popup x:Name="MyPopup"
IsOpen={Binding ElementName="TogglePopupButton", Path="IsChecked"}>
<!--Some code in here -->
</Popup>
My application monitors a few things and then set the ShowPopup
property when something goes wrong and the message is shown in the pop-up.
When the ShowPopup
property is set by some event handler, can we open the Popup
control without having it focused? I would like to keep the focus on the Main Window.
I tried some ideas, like getting the popup window handle and use Windows API to show the popup window not-active and activate the main window, handle focus changed event, changing Focusable
, etc., but without success…
Should I change the Popup
to something else?
Thanks