zoukankan      html  css  js  c++  java
  • Silverlight Telerik 学习之主题的设置

    Telerik控件版本:RadControls for Silverlight Q1 2013

    当前的Telerik 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。

    Transparent - 引用 Telerik.Windows.Themes.Transparent.dll。

    Vista - 引用 Telerik.Windows.Themes.Vista.dll。

    Windows 7 - 引用 Telerik.Windows.Themes.Windows7.dll。

    Window 8 - 引用Telerik.Windows.Themes.Windows8.dll。

    Windows8 Touch -引用Telerik.Windows.Themes.Windows8Touch。

    Metro(obsolete) - 引用Telerik.Windows.Themes.Metro.dll。应该替换成windows8主题。

    创建一个Silverlight工程,引用需要的dll

    Common Styling Theming Setting Built In Theme 010

    下图是Windows8 Touch的效果

    1.设置特定的XAML内置样式(这样只改变指定控件样式)

    <UserControl x:Class="Test.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls">
        <Grid x:Name="LayoutRoot">
    
           <telerik:RadTabControl x:Name="tab1"  telerik:StyleManager.Theme="Windows8Touch">
                <telerik:RadTabItem Header="导航一"></telerik:RadTabItem>
                <telerik:RadTabItem Header="导航二"></telerik:RadTabItem>
                <telerik:RadTabItem Header="导航三"></telerik:RadTabItem>
            </telerik:RadTabControl>
    
        </Grid>
    </UserControl>
    

    或者通过后台代码控制 StyleManager.SetTheme( tab1, new VistaTheme() );

    2.设置应用程序内置主题后台代码(这样影响的是页面控件的样式)

    public partial class MainPage : UserControl
        {
            public MainPage()
            {
                StyleManager.ApplicationTheme = new Windows8TouchTheme();
                InitializeComponent();
            }
            
        }

    或者

    public partial class App : Application
    {
        public App()
        {
            this.Startup += this.Application_Startup;
            this.Exit += this.Application_Exit;
            this.UnhandledException += this.Application_UnhandledException;
    
            StyleManager.ApplicationTheme = new Windows8TouchTheme();
    
            InitializeComponent();
        }
    }

    3.自定义主题

    如果觉得这些样式满足不了要求可以自己定义一些主题

    创建一个自定义主题类

    然后在自定义主题类的构造函数中指定source

    [ThemeLocation( ThemeLocation.BuiltIn )]
    public class CustomTheme : Telerik.Windows.Controls.Theme
    {
    }
    public CustomTheme()
    {
        this.Source = new Uri( "/Telerik.Windows.Themes.CustomTheme;component/themes/Generic.xaml", UriKind.Relative );
    }

    参考文章 http://www.telerik.com/help/silverlight/common-styling-apperance-setting-theme.html

  • 相关阅读:
    常见规格液晶显示器尺寸/点距/分辨率
    Disk genius(Diskgenius)修复硬盘分区表
    IIS上注册.Net
    PowerDesigner中如何导入表结构
    关于VS命名空间的引用
    启动Word时出现“复制文件或文件夹时出错"对话框?
    能够删除的安卓(Android)系统自带程序详细列表和说明
    五种方法 解决Windows最大终端连接数
    查看本机打开的端口
    RAID技术概述
  • 原文地址:https://www.cnblogs.com/ZJ199012/p/3696906.html
Copyright © 2011-2022 走看看