Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF MessageBox looks unstyled, while WindowsForms MessageBox looks good

For some reason, the WPF MessageBox looks worse than the one in WindowsForms. The WPF one doesn't have a visual style.

How can the Windows style be applied to the WPF MessageBox?

WindowsForms

WindowsForms

WPF

WPF

like image 754
bytecode77 Avatar asked Jan 05 '15 04:01

bytecode77


1 Answers

This issue can be fixed by adding an application manifest (Add -> New Item -> Application Manifest File)

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

Under "Project Properties", point "Manifest" to the file you just created. This is optional for that the manifest can also just be deployed along with the EXE file.

Note: This manifest can be used for any executable, not only WPF, that needs to be "styled".

like image 97
bytecode77 Avatar answered Sep 19 '22 23:09

bytecode77