.net WPF的Windows7主题?

.net WPF的Windows7主题?,.net,wpf,windows,themes,wpftoolkit,.net,Wpf,Windows,Themes,Wpftoolkit,有没有办法让WPF应用程序看起来像是在Windows7上运行的,即使它是在XP上运行的?我正在寻找某种主题,我可以直接粘贴进去。我知道Codeplex()上的themes项目,但它缺乏对DataGrid的支持,这是我急需的。我在想也许Windows7主题只是一个简单的端口,或者已经存在于某个文件中 更新 使用@Lars Truijens的想法,我能够让Windows 7查找主要控件,但不幸的是,它不适用于我需要的WPF ToolkitDataGrid控件 DataGrid看起来像这样,带有Ae

有没有办法让WPF应用程序看起来像是在Windows7上运行的,即使它是在XP上运行的?我正在寻找某种主题,我可以直接粘贴进去。我知道Codeplex()上的themes项目,但它缺乏对
DataGrid
的支持,这是我急需的。我在想也许Windows7主题只是一个简单的端口,或者已经存在于某个文件中


更新

使用@Lars Truijens的想法,我能够让Windows 7查找主要控件,但不幸的是,它不适用于我需要的WPF Toolkit
DataGrid
控件

DataGrid
看起来像这样,带有Aero主题

DataGrid
应该是这样的

所以,如果有人有任何想法,我仍然在寻找解决这个问题的方法。也许有人对Aero主题进行了扩展,涵盖了WPF工具包控件?再次感谢您提供的任何信息


更新2-数据网格问题已解决

要使Aero主题与DataGrid或任何其他WPF工具包控件一起工作,您只需添加第二个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>

WPF在所有Windows版本上都带有标准Windows主题。例如,您可以通过以下步骤在Windows XP上创建Aero主题(Vista和Windows 7使用该主题):

  • 根据需要将PresentationFramework.Aero添加到应用程序的引用列表中
  • 编辑你的App.xaml
  • 由此

    <Application.Resources>
      <!-- Your stuff here -->
    </Application.Resources>
    

    其他备选方案如下。确保根据需要将相应的程序集添加到应用程序的引用列表中

    <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"/>
    

    在Lars的回答和DanM的更新中增加一项:

    部署时,必须将aero Dll添加到安装目录

    您可以通过转到添加到引用中的PresentationFramework.Aero的属性并设置
    CopyLocal=True
    来完成此操作。
    然后,您必须转到正在使用的任何部署工具(我喜欢WIX…),并将其添加到部署文件列表中。

    转到您的解决方案/项目属性,在“引用”下,您将能够添加对PresentationFramework.Aero的引用。。。 在代码中应用它,它应该可以很好地工作


    我希望我的回答能帮助你

    我终于有机会尝试一下了。它确实有效,但正如我所担心的那样,对于
    DataGrid
    控件无效。请查看我的更新。
    DataGrid
    w/Aero主题的外观仍然是XP。很好,我刚刚偶然发现了
    DataGrid
    问题的解决方案:
    。我还将更新我的问题。您应该将动态引用转换为完整引用,否则需要部署PresentationFramework.aero。在这里查看我的答案:它给了我
    FileNotFoundException:无法加载文件或程序集的PresentationFramework.Aero
    我认为PresentationFramework.Aero不需要部署。据了解,它包含在.NET framework中。如果使用完整引用,则不需要部署PresentationFramework.aero。在这里看到我的答案:你的更新2救了我的命!!!谢谢你发布更新!
    <Application.Resources>
      <ResourceDictionary>
        <!-- Put your stuff here instead -->
    
        <ResourceDictionary.MergedDictionaries>
          <ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml"/>
        </ResourceDictionary.MergedDictionaries>
      </ResourceDictionary>
    </Application.Resources> 
    
    <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"/>