Michael Hedgpeth
Michael Hedgpeth

Reputation: 7862

How to enable visual styles in WPF for common dialogs?

When using the wpf elements of my application, everything styles to the operating system, but when I use an OpenDialog or a MessageBox, it renders the older Windows 9X way. Is there an easier way I can do an Application.EnableVisualStyles() equivalent call to make the message boxes and dialogs look the same as the rest of the application?

Upvotes: 8

Views: 7340

Answers (3)

nullpointer
nullpointer

Reputation: 694

Im my case in used Winforms controls inside WPF then apply EnableVisualStyles()...

Upvotes: 0

Botz3000
Botz3000

Reputation: 39600

You need to add a manifest to your assembly. You can do this via Add New Item-->General-->Application Manifest file.

Then add the following somewhere inside the asmv1 tag in the manifest file:

<dependency>
    <dependentAssembly>
        <assemblyIdentity name="Microsoft.Windows.Common-Controls" version="6.0.0.0" type="win32" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" />
    </dependentAssembly>
</dependency>

Upvotes: 22

Related Questions