views:

362

answers:

1

Hello all!

I posted a comment to Microsoft that the Dialog Boxes in WPF are not VisualStyle enabled.

Joe Castro posted a workaround there which I don't really understand how to achieve, can anyone help?

Here is he's response:

For app compat reasons applications don't by default use v6 of the system common controls (available since XP). This doesn't really apply to WPF, but you also only see it in a few situations when using the native controls so it's not as prevalent as WinForms where their APIs are just wrapping the standard controls.

To fix this in WPF you need to explicitly opt-in to v6 comctl32 by specifying it in a manifest in your exe. This has to be done on the exe, so WPF can't do it as part of their DLLs. EnableVisualStyles does this at runtime but this way is generally better.

E.g., something like:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<description>MyExe.exe</description>
<dependency>
    <dependentAssembly>
     <assemblyIdentity
         type="win32"
         name="Microsoft.Windows.Common-Controls"
         version="6.0.0.0"
         processorArchitecture="*"
         publicKeyToken="6595b64144ccf1df"
         language="*"/>
    </dependentAssembly>
</dependency>
</assembly>