WPF MessageBox window style

Solution 1:

According to this page, WPF picks up the old styles for some of the controls.

To get rid of it, you have to create a custom app.manifest file (Add -> New item -> Application Manifest File) and paste the following code in it (right after the /trustInfo - Tag ):

<!-- Activate Windows Common Controls v6 usage (XP and Vista): -->
<dependency>
  <dependentAssembly>
    <assemblyIdentity
      type="win32"
      name="Microsoft.Windows.Common-Controls"
      version="6.0.0.0"
      processorArchitecture="*"
      publicKeyToken="6595b64144ccf1df"
      language="*"/>
  </dependentAssembly>
</dependency>

Then you have to compile your solution with this app.manifest (set it in the project properties -> Application -> Point to the new manifest in "Icons and manifest").

If you start your application now it should look like the WinForms- MessageBox.

Solution 2:

The reason that the WinForms one works the way that it does is because visual styles are turned on (i.e. using Common Controls v6) in its Main function. If you remove the call to System.Windows.Forms.Application.EnableVisualStyles(), then the WinForms Message Box will look just like the WPF one.

This doesn't happen for a WPF app, possibly because all of the WPF controls are rendered so there is no need to use the new version of Common Controls.

You might try calling EnableVisualStyles() somewhere in the start up of your WPF application. I don't know if it will work or not, but it's worth a try. This will require a reference to System.Windows.Forms, though.