RadControls 主题在 Silverlight中的应用
2010-01-27 19:08
330 查看
RadControls 主题在 Silverlight中的应用 |
.每个主题是分布式的集合,其中包含一个generic.xaml文件,包含所有的控制风格。最简单的方法适用于一个单一的控件,我们的标准主题之一是设置StyleManager.Theme附加属性:
[XAML] | |
---|---|
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" ... <telerikNavigation:RadMenu telerik:StyleManager.Theme=””... /> <telerikNavigation:RadTreeView telerik:StyleManager.Theme=””... /> |
请注意,您需要在这种情况下引用Telerik.Windows.Themes.Vista.dll。 |
[XAML] | |
---|---|
<UserControl.Resources> <telerik:Theme x:Key=”” Source=”/Telerik.Windows.Themes.Vista;component/themes/generic.xaml”/> </UserControl.Resources> <telerikNavigation:RadMenu telerik:StyleManager.Theme=”{StaticResource VistaTheme}”... /> <telerikNavigation:RadTreeView telerik:StyleManager.Theme=”{StaticResource VistaTheme}”... /> |
例如,如果您的Silverlight应用程序集被命名为MyApplication.dll和自定义主题是放置在MyTheme.xaml,在/主题/ TelerikControls位于/文件夹中的项目, 开放的将是:/MyApplication;component/Themes/TelerikControls/MyTheme.xaml
<Button telerik:StyleManager.Theme=””Content=”me!”/>
从代码隐藏的主题是略有不同的方式设置:
[C#] | |
---|---|
RadMenu menu = new RadMenu();// Use VistaTheme or Office_BlackTheme, or SummerTheme StyleManager.SetTheme(menu, new VistaTheme()); |
[C#] | |
---|---|
Theme myTheme = new Theme( new Uri("", UriKind.RelativeOrAbsolute)); StyleManager.SetTheme(menu, myTheme); |
[C#] | |
---|---|
StyleManager.ApplicationTheme = new VistaTheme();or just new VistaTheme().IsApplicationTheme = true; |
请注意,您需要尽可能的设置好应用程序的主题。最好的地方是page constructor, 或者 Application.Startup event 。 |
[C#] | |
---|---|
public partial class Page : UserControl { public Page() { new VistaTheme().IsApplicationTheme = true; InitializeComponent(); } ... } |
.不幸的是,标准的控件没有用到应用主题,您将需要设置StyleManager.Theme在你的应用环境中 |
相关文章推荐
- silverlight:telerik RadControls for Silverlight 主题使用心得
- Silverlight:telerik RadControls for Silverlight 主题使用心得
- Telerik RadControls for Silverlight 4
- RadControls for Silverlight(学习1-RadGridView)
- RadControls for Silverlight(学习2-RadDataPager)
- Telerik RadControls for Silverlight Q3 2008可用,要是有20081117就更好了,有DATAGRID用
- 使用Silverlight Toolkit 应用以及动态切换主题
- (转)RadControls+for+Silverlight(学习1-GridView)
- silverlight:telerik RadControls中RadGridView的一个Bug及解决办法
- Silverlight:telerik RadControls中RadGridView的一个Bug及解决办法(转载)
- RadControls for Silverlight(学习1-GridView)
- RadControls for Silverlight发布测试版
- 【转】RadControls for Silverlight(学习1-GridView)
- RadControls for Silverlight 导出excel
- 【转】RadControls for Silverlight(学习2-RadDataPager)
- 使用RadControls for Silverlight 2009时报无法找到System.Web.Ria
- RadControls for Silverlight(学习1-GridView) (转载)
- SilverLight-DataControls:四、The PagedCollectionView(分页的集合视图) 对象
- Android theme应用主题实现
- 大数据时代数据管理与高效应用——人力资源主题交流会