有没有办法让WPF应用程序看起来像在Windows 7上运行,即使它运行在XP上?我在找一种主题,我可以直接贴进去。我知道Codeplex (https://archive.codeplex.com/?p=wpfthemes)上的主题项目,但它缺乏对DataGrid的支持,这是我迫切需要的。我在想,也许Windows 7的主题只是一个简单的端口,或者已经存在于某个文件中。
更新
使用@Lars的想法,我能够让Windows 7查找主要控件,但不幸的是,它不适用于我需要的WPF DataGrid控件。
DataGrid 和Aero主题看起来是这样的

DataGrid 应该像这个

所以,如果有人有任何想法的话,我仍然在寻找解决这个问题的方法。也许有人已经为Aero主题构建了一个扩展,它涵盖了WPF工具包控件?再一次,任何你拥有的信息都是非常感谢的。
更新2- DataGrid问题解决了!
要使Aero主题与DataGrid或任何其他work控件一起工作,只需添加第二个Aero字典,因此您的App.xaml现在应该如下所示。
<Application.Resources>
...
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary
Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml" />
<ResourceDictionary
Source="pack://application:,,,/WPFToolkit;component/Themes/Aero.NormalColor.xaml" />
...
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>此外,我建议关闭DataGrid控件中的网格线(因为它们看起来很糟糕):
<DataGrid GridLinesVisibility="None" ...>发布于 2010-01-16 14:00:46
WPF附带了所有Windows版本的标准Windows主题。例如,可以在Windows XP上使用Aero主题( Vista和Windows 7使用该主题),具体步骤如下:
从这里开始
<Application.Resources>
<!-- Your stuff here -->
</Application.Resources>到这个
<Application.Resources>
<ResourceDictionary>
<!-- Put your stuff here instead -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources> 资料来源: http://mrpmorris.blogspot.com/2008/05/using-vista-aero-theme-in-xp-wpf-apps.html
下文的其他替代办法。请确保根据需要将相应的程序集添加到应用程序的引用列表中。
<ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml"/>
<ResourceDictionary Source="/PresentationFramework.Classic;component/themes/Classic.xaml"/>
<ResourceDictionary Source="/PresentationFramework.Royale;component/themes/Royale.NormalColor.xaml"/>
<ResourceDictionary Source="/PresentationFramework.Luna.Homestead;component/themes/Luna.Homestead.xaml"/>
<ResourceDictionary Source="/PresentationFramework.Luna.Metallic;component/themes/Luna.Metallic.xaml"/>
<ResourceDictionary Source="/PresentationFramework.Zune;component/themes/Zune.NormalColor.xaml"/>发布于 2011-05-15 10:18:32
除了Lars的答复和DanM的更新之外,还有一个补充:
部署时,必须将aero添加到安装dir。
您可以通过转到添加到引用中的PresentationFramework.Aero属性并设置CopyLocal=True来完成这一任务。然后,您将不得不使用任何部署工具(我喜欢WIX.)并将其添加到已部署文件的列表中。
发布于 2020-03-21 19:01:12
转到您的解决方案/项目属性,在“引用”下,您将能够添加对PresentationFramework.Aero的引用。在您的代码中应用它,它应该工作得很好。
我希望我的回答对你有帮助
https://stackoverflow.com/questions/2075720
复制相似问题