Silverlight Telerik控制項學習:主題Theme切換

來源:互聯網
上載者:User
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中完全一樣了

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.