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
下面是切換方法:
一、局部切換/設置法
<telerik:RadButton Height="20" Width="80" Content="彈出" telerik:StyleManager.Theme="Windows7" Click="RadButton_Click" />
這個比如css中的內聯樣式,僅影響當前控件
二、全局切換/設置法
在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全局文件
三、自定義主題
若是內置的主題你都以爲不滿意,還能夠自定義,方法以下:
先定義一個主題類
public class CustomTheme : Telerik.Windows.Controls.Theme
{
}
而後在這個類的構造函數裏指明Source
public CustomTheme()
{
this.Source = new Uri( "/Telerik.Windows.Themes.CustomTheme;component/themes/Generic.xaml", UriKind.Relative );
}
後面的事情,就跟前面提到的1,2中徹底同樣了css
原文地址 wpf123函數