I have a WPF application where i show a dialog with
nrDialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
bool? dialogResult = nrDialog.ShowDialog();
The dialog is a simple Window object with properties
Title="NewReportDialog" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" ResizeMode="NoResize">
The windows works as normal modal dialog and locks mainwindow as it should , but when i click on the application icon on the taskbar, Windows 7, the modal dialog goes out of focus and the only way to get the dialog back in to focus is to use ALT-Tab
Anyone has a solution?
Try to set the Owner of the dialog Window to be the main application window. This should solve the issue.
Probably something like:
Where this is the main window instance. You can replace it with something more relevant to your case.
You can get the main application window using: Application.Current.MainWindow