telerik的RadControls for Silverlight內建了以下幾種主題樣式:
Office Black - 這是預設值,無需載入其它任何dll檔案.
Office Blue - 需要引用 Telerik.Windows.Themes.Office_Blue.dll.
Office Silver - 需要引用 Telerik.Windows.Themes.Office_Silver.dll.
Summer - 需要引用 Telerik.Windows.Themes.Summer.dll.
Vista - 需要引用 Telerik.Windows.Themes.Vista.dll.
Windows 7 - 需要引用 Telerik.Windows.Themes.Windows7.dll.
Transparent - 需要引用 Telerik.Windows.Themes.Transparent.dll
下面是切換方法:
1、局部切換/設定法 <telerik:RadButton Height="20" Width="80" Content="彈出" telerik:StyleManager.Theme="Windows7" Click="RadButton_Click" />這個好比css中的內聯樣式,僅影響當前控制項
2、全域切換/設定法在App.xaml.cs檔案中App的建構函式裡加一行代碼,參考下面: public App()
{
StyleManager.ApplicationTheme = new Windows7Theme();
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException; InitializeComponent();
}這個好比網頁製作中用link ref引用的css通用檔案
3、自訂佈景主題如果內建的主題你都覺得不滿意,還可以自訂,方法如下:先定義一個主題類public class CustomTheme : Telerik.Windows.Controls.Theme
{
}然後在這個類的建構函式裡指明Sourcepublic CustomTheme()
{
this.Source = new Uri( "/Telerik.Windows.Themes.CustomTheme;component/themes/Generic.xaml", UriKind.Relative );
}後面的事情,就跟前面提到的1,2中完全一樣了