Question

I have my MainApplication Window that launches a new Window with .ShowDialog() so that it is modal.

UploadWindow uploadWindow = new UploadWindow();
uploadWindow.ShowDialog();

Now users are often leaving this window open and it can get lost under other windows. When the MainApplication is clicked you get an error-like beep and are unable to interact with it, so the modal window is blocking properly as expected, but it would be nice if the modal window was focused at this point to show the user it was still open.

Currently it just looks as if the MainApplication window has locked up.

Was it helpful?

Solution

Try setting the dialog's owner:

var uploadWindow = new UploadWindow();
uploadWindow.Owner = this;
uploadWindow.ShowDialog();

OTHER TIPS

I have the problem, that I can't use this, if someone have the same problem, you can use

Window.GetWindow(this)

Since I am using MVVM, I'm not creating the code from the GUI. I used this.

var uploadWindow = new UploadWindow();
uploadWindow.Owner = Application.Current.MainWindow;
uploadWindow.ShowDialog();

If all of the above solutions tried and still facing the same problem then here is your tested and verified solution go to your window xaml and add

ResizeMode = "NoResize"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top