You can fix this with a manifest. See this article for step-by-step instructions: Why I get dialog boxes with old-style files and message boxes with WPF
Basically, you should add an XML file called a "manifest" to your application.
Update:
In fact, this is very easy to do in VS2008. Go to "Project Properties-> Application" and click on the "View UAC Settings" button. This will automatically create the application manifest file and open it. Edit this file as follows:
Only after the line:
</trustInfo>
Paste in the following dependency section:
<dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency>
My complete manifest is as follows:
<?xml version="1.0" encoding="utf-8"?> <asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> <requestedExecutionLevel level="asInvoker" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </asmv1:assembly>
After that, just create an application, launch it and run, the buttons of the MessageBox dialog will take on the style of the system theme.
source share