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中完全一样了
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有