您的位置:首页 > Web前端 > HTML

Silverlight Telerik控件学习:主题Theme切换html教程

2015-06-27 08:54 603 查看
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
  {
  }
  然后在这个类的构造函数里指明Source
  public CustomTheme()
  {
  this.Source = new Uri( "/Telerik.Windows.Themes.CustomTheme;component/themes/Generic.xaml", UriKind.Relative );
  }
  后面的事情,就跟前面提到的1,2中完全一样了

原文地址 wpf123
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: