I have created a c# WPF application. The app has an “About” page that I want to show as a modal dialog.
The issue is when the “About” dialog is open and the user Alt+Tab’s the “About” dialog is visible as a separate tile in the Alt+Tab list. The about dialog also has a url link. Clicking this opens a browser window. When the user Alt+Tab’s back to the application the about dialog is visible whilst the calling app is now behind the web browser.
Firstly, in WPF create your dialog as a “Window” control.
In windows forms you would do:
frmAbout about = new frmAbout(); about.ShowDialog(this);
In WPF its the same concept but syntactically slightly different:
About aboutWindow = new About(); aboutWindow.Owner = this; aboutWindow.ShowDialog();
This will open the window as a modal dialog.
One other setting to play with on the About window is WindowsStartUpLocation
Setting it as “CenterOwner” will open in the centre of the calling Window. I set mine to centre screen as it looked a bit funny starting centre of the owner.