Vista MessageBox

Hello,

I am using WPF on Vista. However, when I call MessageBox.Show, the message box on the screen is using the Windows 2000 theme (gray). Is there a way to have "nice looking" vista message boxes in WPF.

[233 byte] By [Tom] at [2008-1-6]
# 1
It is odd that the message box uses the 2000 theme. Is the rest of your app using the Vista theme? You can make it use any schema you want though by overriding the contect template for the control.
Zodd at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 2

The rest of the app is using the Vista theme.

I don't use any template.

Am I the only one to get this behavior?

Tom at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 3

Hello, WPF MessageBox uses Win32 MessageBox. That means, it doesn’t use WPF themes. The same goes with other common dialogs such as OpenFileDialog. To enable aero theme on those Win32 dialogs, you need to add a manifest file to your application, and add the following:

<dependency>

<dependentAssembly>

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

</dependentAssembly>

</dependency>

Now rebuild your application and run it, your MessageBox should have aero theme. But when you debugging the application, the aero theme seems still not be applied to common dialogs. Only when running the application without debugging will it be applied.

Yi-LunLuo-MSFT at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 4
Could u pls give details ... ?
How to do that exactly ?
logN at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 5
Will the application still work under XP then?
Tom at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 6
Sure it will. Manifests are common for XP. And .NET Framework 1.0 developers had to add the same manifests to their apps since Application didn't provide EnableVisualStyles prop.

To logN: http://blogs.msdn.com/subhagpo/archive/2004/05/17/133464.aspx

eisernWolf at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified