C # / WPF, how to make a window (created using Window.ShowDialog ()), the title lights up when you click on its parent window (e.g. MessageBox)?

I am trying to create my own MessageBox using a WPF window that is called using ShowDialog().

So far, I have managed to implement all but one.

As you know, when using it, MessageBox.Show("text");you cannot set the focus or click on the parent window (the one that called up MessageBox). If you try to click on the parent window, it MessageBoxwill flash briefly to warn you that you should close if at first.

Windows created using Window.ShowDialog();, however, does not show this behavior. In fact, until you can set focus on the parent window, the child (called with ShowDialog()) will never flash for a short time.

My question is, is there a way to implement this in WPF? I was looking for an answer, but I must admit, I'm at a standstill.

Thanks everyone!

+5
source share
2 answers

You need to install the Ownermodal window correctly , for example. using the following code from a native window:

Window win = new SomeModalWindow();
win.Owner = this;
win.ShowDialog();
+11
source

Owner Window Window. . MSDN .

+3

All Articles