WPF MessageBox looks unmanageable and WindowsForms MessageBox looks pretty good

For some reason WPF MessageBox looks worse than WindowsForms. WPF has no visual style.

How can Windows style be applied to WPF MessageBox?

WindowsForms

WindowsForms

WPF

WPF

+3


source to share


1 answer


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

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

      



In "Project Properties" specify "Manifest" in the newly created file. This is not necessary so that the manifest can be simply deployed along with the EXE file.

Note. This manifest can be used for any executable, not just WPF, which needs to be "styled".

+5


source







All Articles