如何调用Windows主题在WPF?

问题描述:

嗨伙计,我试图调用了我在WPF 3.5元素窗口的当前主题。

Hi Folks I am trying to invoke the current theme of windows for my elements in WPF 3.5.

当用户改变窗口的主题我的应用程序也应改变根据这一主题。

as the user change the window theme my application should also be changed according to the theme.

我使用的样式。

请帮我。

您可以定义不同的外观通过添加一个资源字典的主题文件夹基于桌面主题。桌面主题确定哪些资源字典使用。这里是一个列表中的资源字典文件名和桌面主题:

You can define a different look and feel based on the desktop theme by adding a resource dictionary to the Themes folder. The desktop theme determine which resource dictionary is used. Here is a list the resource dictionary file names and the desktop themes:


  1. Classic.xaml - 经典Windows 9x中/ 2000的外观在Windows XP

  2. Luna.NormalColor.xaml - 。在Windows XP中默认的蓝色主题

  3. Luna.Homestead.xaml - 在Windows XP橄榄主题

  4. Luna.Metallic.xaml - 在Windows XP中银主题

  5. Royale.NormalColor.xaml - 在Windows XP Media Center Edition的默认主题

  6. Zune.NormalColor.xaml - 在Windows XP Zune播放器的默认主题

  7. Aero.NormalColor.xaml - 在Windows Vista上
    默认主题..

  1. Classic.xaml – "Classic" Windows 9x/2000 look on Windows XP.
  2. Luna.NormalColor.xaml – Default blue theme on Windows XP.
  3. Luna.Homestead.xaml – Olive theme on Windows XP.
  4. Luna.Metallic.xaml – Silver theme on Windows XP.
  5. Royale.NormalColor.xaml – Default theme on Windows XP Media Center Edition.
  6. Zune.NormalColor.xaml – Default theme on Windows XP Zune.
  7. Aero.NormalColor.xaml – Default theme on Windows Vista ...

您可以阅读有细节(的 http://blogs.msdn.com/wpfsdk/archive/2007/07/31/using-themes-with-custom -controls.aspx

You can read details there (http://blogs.msdn.com/wpfsdk/archive/2007/07/31/using-themes-with-custom-controls.aspx)