WPF window forefront Topmost Owner

WPF, if we want to have a window to the foreground, you can set Topmost = true;

However, this will have another problem, when you are this window will always be in the top level, even if you want to switch to another program time.

For example, you write your own program app1, there are two windows wind1 wind2 which wind2 of Topmost = true.

Then again you operate your own app1 time, wind2 always re wind1 earlier. So there is no problem.

But when you want to switch to another program, such as QQ time, wind1 or will be in front of the QQ interface. So when we go against the idea.

 

 

I just want wind2 in front wind1 when to switch to QQ, QQ I hope that in front of all the windows of my app1.

This demand, in fact, we do not need to use Topmost can wind2.Owner = wind1;. In this way, OK

And sometimes we click a button on the wind1 interface, pop wind2, this time, if no wind2.Owner = wind1; so, if you set the WindowStartupLocation wind2 = WindowStartupLocation.CenterOwner; is of no significance

Guess you like

Origin www.cnblogs.com/CSSZBB/p/12016152.html