如何强制在 Windows Server 2003 上为 WPF 应用程序使用 Windows 7 主题 [英] How to force to have Windows 7 theme on Windows Server 2003 for a WPF application

查看:33
本文介绍了如何强制在 Windows Server 2003 上为 WPF 应用程序使用 Windows 7 主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此处输入代码有什么方法可以让 WPF 应用看起来像是在 Windows 7 上运行,即使它在 Windows Server 2003 上运行?

enter code hereIs there any way to make a WPF app look like it's running on Windows 7 even if it's running on Windows Server 2003?

我面临的问题是,由于控件上的 Windows Server 2003 上的默认样式,很难看到它们上的文本内容.例如 - 组合框

The propblem I am facing that due to default style on windows server 2003 on controls, its very hard to see the text content on them. For ex - Combo box

文本前景以黑色可见,突出显示的动画颜色为深蓝色,这使得文本内容几乎不可见.

The text foreground is visible in black and highlighed animation color is dark blue which makes the text content hardly visible.

我尝试定义以下设置,但没有用

I have tried defining the following settings but it did not work

  1. 编辑 App.Xaml 并将其更改为

  1. Edit the App.Xaml and change it to

将引用程序集 PresentationFramework.Aero 的 Copy Local 属性设置为 True.

Set the Copy Local property of referenced assembly PresentationFramework.Aero to True.

请指教.

推荐答案

WPF 默认带有以下主题集:Classic、Aero Normal、Luna Homestead、Luna Metatallic、Luna Normal、Roayle Normal....允许 WPF 控件以匹配特定主题的外观.

WPF ships by default with these theme sets: Classic, Aero Normal, Luna Homestead, Luna Metatallic, Luna Normal, Roayle Normal....which allows WPF controls to match the look of a particular theme.

您可以通过将主题在其主题程序集中定义的资源加载到您的 App.Resources 中来强制 WPF 使用特定主题,以便您的控件使用这些主题样式.

You can force WPF to use a specific theme by getting the Resources which a theme has defined in its theme assembly to be loaded into your App.Resources so your controls will use those themed styles.

查看这些链接了解更多信息:

See these links for more info:

http://arbel.net/2006/11/03/forcing-wpf-to-use-a-specific-windows-theme/

如果您需要访问原始 WPF 主题设计,则可以从以下位置下载它们:

If you ever need access to the raw WPF theme designs, then you can download them from:

这篇关于如何强制在 Windows Server 2003 上为 WPF 应用程序使用 Windows 7 主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆