2012-03-08 50 views

回答

7

你可以做到这一点,如下所示:

<Application 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
    mc:Ignorable="d" 
    x:Class="SilverlightApplication.App"> 
     <Application.Resources> 
      <telerik:MetroTheme x:Key="Theme" IsApplicationTheme="True"/> 
     </Application.Resources> 
</Application> 
+0

谢谢!我错过了IsApplicationTheme属性。 – redman 2012-03-08 12:31:40

2

这并没有在第一次为我工作。它扔了follwoing例外:

{System.Collections.Generic.KeyNotFoundException:给定的关键是 不存在的字典。在 System.Collections.Generic.Dictionary`2.get_Item(TKEY的键)在 System.Windows.ResourceManagerWrapper.GetResourceForUri(URI xamlUri, 类型组件类型)}

设置属性“Telerik.Windows.Controls.Theme。 ApplicationThemeSetter' 抛出一个异常。 [Line:53 Position:70]

我试过在App.xaml和Generic.xaml中声明它,但结果相同。

我也试着主题设置在XAML,如:

<t:RadGridView t:StyleManager.Theme="Windows8Theme" ..../> 

但是,这并没有影响。

注:我使用的是2012的Q3

我终于解决了这个问题。你必须包含主题DLL。所以在我的情况下,我想使用Windows8Theme,我需要添加一个参考Telerik.Windows.Themes.Windows8.dll。如果Telerik的代码抛出一个异常说多少,但是“嘿”,这将是有益的,那只是我。

  • 拉沙德
+1

您应该首先阅读文档[如在此处](http://docs.telerik.com/devtools/silverlight/controls/radtabcontrol/styling-and-appearance/using-themes) – 2015-06-02 00:36:40