为什么WPF不在Windows 8中显示Windows 8样式按钮

时间:2022-09-29 22:22:05

This is a Windows 8 style button:

这是一个Windows 8风格的按钮:

为什么WPF不在Windows 8中显示Windows 8样式按钮

And this is a button in .NET 4.5 WPF app:

这是.NET 4.5 WPF应用程序中的一个按钮:

为什么WPF不在Windows 8中显示Windows 8样式按钮

Any ideas why WPF doesn't show the native Windows 8 style buttons? Is there a way to fix this?

任何想法为什么WPF不显示本机Windows 8样式按钮?有没有办法来解决这个问题?

2 个解决方案

#1


9  

What you can do is use a custom WPF styling from HERE.

你可以做的是使用HERE的自定义WPF样式。

Below is a screenshot of the styles as applied to the same WPF application in multiple states. The top is obviously Aero themed, and the bottom set is with the newly applied styles.

下面是应用于多个状态的同一WPF应用程序的样式的屏幕截图。顶部显然是Aero主题,底部设置是新应用的样式。

为什么WPF不在Windows 8中显示Windows 8样式按钮

And here is a link to the XAML.

这里是XAML的链接。

#2


2  

WPF does not use any native Windows controls - it comes with its own controls and styles for different Windows versions. On Windows 7 you can find the following assemblies

WPF不使用任何本机Windows控件 - 它为不同的Windows版本提供了自己的控件和样式。在Windows 7上,您可以找到以下程序集

PresentationFramework.Aero.dll
PresentationFramework.Classic.dll
PresentationFramework.Luna.dll
PresentationFramework.Royale.dll

and I guess there is a new one for Windows 8. Because WPF is not build upon native controls it is possible to have a XP-style WPF application on Windows 7 and a Windows-7-style application on Windows XP.

我认为Windows 8有一个新版本。由于WPF不是基于本机控件构建的,因此可以在Windows 7上安装XP风格的WPF应用程序,在Windows XP上安装Windows-7风格的应用程序。

If you want to match the native Windows 8 UI better than what WPF offers out of the box, you will have to create your own styles - probably based on the styles provided by WPF.

如果您想要比WPF提供的开箱即用更好地匹配原生Windows 8 UI,您将必须创建自己的样式 - 可能基于WPF提供的样式。

#1


9  

What you can do is use a custom WPF styling from HERE.

你可以做的是使用HERE的自定义WPF样式。

Below is a screenshot of the styles as applied to the same WPF application in multiple states. The top is obviously Aero themed, and the bottom set is with the newly applied styles.

下面是应用于多个状态的同一WPF应用程序的样式的屏幕截图。顶部显然是Aero主题,底部设置是新应用的样式。

为什么WPF不在Windows 8中显示Windows 8样式按钮

And here is a link to the XAML.

这里是XAML的链接。

#2


2  

WPF does not use any native Windows controls - it comes with its own controls and styles for different Windows versions. On Windows 7 you can find the following assemblies

WPF不使用任何本机Windows控件 - 它为不同的Windows版本提供了自己的控件和样式。在Windows 7上,您可以找到以下程序集

PresentationFramework.Aero.dll
PresentationFramework.Classic.dll
PresentationFramework.Luna.dll
PresentationFramework.Royale.dll

and I guess there is a new one for Windows 8. Because WPF is not build upon native controls it is possible to have a XP-style WPF application on Windows 7 and a Windows-7-style application on Windows XP.

我认为Windows 8有一个新版本。由于WPF不是基于本机控件构建的,因此可以在Windows 7上安装XP风格的WPF应用程序,在Windows XP上安装Windows-7风格的应用程序。

If you want to match the native Windows 8 UI better than what WPF offers out of the box, you will have to create your own styles - probably based on the styles provided by WPF.

如果您想要比WPF提供的开箱即用更好地匹配原生Windows 8 UI,您将必须创建自己的样式 - 可能基于WPF提供的样式。