I have a WPF main window that has a grid and i have added a WPF pop up to ask the user for extra info when a button is clicked. But the problem is that when other desktop windows are moved over the pop up, the pop up covers the other desktop windows. How to fix this so the pop up is only top most of the WPF main window and not other desktop windows. The pop up is behaving like the task manager when set to always on top!
If you use the below code you will see that the pop up stays on top. So move any other desktop window over the pop up and the pop up will cover the other desktop application! Note that i do not want to use StaysOpen="False".
<Grid>
<Popup Name="myPopup" Placement="Center" IsOpen="True">
<StackPanel Background="Green" >
<TextBox Width="200" Margin="0,0,10,0"/>
<Button Name="closePopupBtn" Content="close" Width="100" />
</StackPanel>
</Popup>
</Grid>
You have set the Owner property in the popup window. In your Popup Window,
this.owner = instanceOfParentWindow;
This is also similar to your question.
Popup always stays on top
Here they create a custom popup using user32.dll
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With