How to make a Modal Dialog in WPF

The Scenario

I have created a c# WPF application. The app has an “About” page that I want to show as a modal dialog.

The Problem

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();

In WPF its the same concept but syntactically slightly different:

  About aboutWindow = new About();
  aboutWindow.Owner = this;

This will open the window as a modal dialog.

One other setting to play with on the About window is WindowsStartUpLocation

  • CenterScreen
  • CenterOwner
  • Manual

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.