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

  • 相关阅读:
    lnmp thinkphp在linux上支持pathinfo
    position
    whereis命令
    Css transition
    CSS3 2D 转换
    asp.net缓存(转)
    Quartz.net开源作业调度框架使用详解(转)
    .Net开源工作流Roadflow的使用与集成(转)
    反射中 GetCustomAttributes
    ASP.NTE 5 Target framework dnx451 and dnxcore50(转)原文:http://www.cnblogs.com/xishuai/p/aspnet5-target-framework-dnx451-and-dnxcore50.html
  • 原文地址:https://www.cnblogs.com/ZJ199012/p/3696906.html
Copyright © 2011-2022 走看看