我对WPF主题和WPF外观之间的区别的理解如下:

  • WPF外观是应用程序加载的一组资源。
  • WPF主题是操作系统处理的一组资源。

  • 要加载皮肤,我可以仅调用Application.Current.Resources.MergedDictionaries.Add(mySkin);

    但是,我看不到任何加载主题的方法。

    是否有文件记载或提供?

    我应该访问System.Windows.SystemResources内部类吗?

    最佳答案

    您可以将它们作为ResourceDictionary加载:

    <Window
      x:Class=”TestProject.Window1?
      xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
      xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”>
      <Window.Resources>
        <ResourceDictionary
        Source=”/presentationframework.aero;component/themes/aero.normalcolor.xaml” />
      </Window.Resources>
    </Window>
    

    注意:您需要参考PresentationFramework.Aero.dll。

    10-08 08:41
    查看更多