Silverlight中资源文件的引用

简介: 原文http://blog.csdn.net/taomanman/article/details/6777291 1、新建一个资源文件,比如: Gaugestyle.xaml和MenuButton.

http://blog.csdn.net/taomanman/article/details/6777291

 

1、新建一个资源文件,比如: Gaugestyle.xamlMenuButton.xaml


2、在App.xaml中添加该资源:

[csharp] view plain copy
  1. <Application  
  2.     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
  3.     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
  4.     x:Class="spjl1.App">  
  5.     <Application.Resources>  
  6.         <!-- Resources scoped at the Application level should be defined here. -->  
  7.         <ResourceDictionary>  
  8.             <ResourceDictionary.MergedDictionaries>  
  9.                 <ResourceDictionary Source="Gaugestyle.xaml"/>  
  10.                 <ResourceDictionary Source="MenuButton.xaml"/>  
  11.             </ResourceDictionary.MergedDictionaries>  
  12.         </ResourceDictionary>  
  13.     </Application.Resources>  
  14. </Application>  

3、在页面文件后台中使用:
[csharp] view plain copy
  1. ResourceDictionary resources = new ResourceDictionary();  
  2. resources.Source = new Uri("/spjl1;component/MenuButton.xaml", System.UriKind.Relative);  
  3. RadWindow1.Style = resources["ChildWindowStyle1"] as Style; 
 

目录
相关文章
|
Windows
艾伟_转载:Silverlight陷阱:注意程序集引用问题
  假定我要用Silverlight类库实现一些通用控件,然后在应用程序中引用这个控件库。当然,控件通常也要访问其他一些第三方或开源的开发包,例如Silverlight Toolkit。   于是这个项目的依赖关系如下: Silverlight Application => Silverlight Control => Silverlight Toolkit。
978 0
Silverlight添加服务引用Service Reference, 出现“自定义工具错误,无法生成服务引用”错误的解决办法
自定义工具错误: 无法生成服务引用“*****”的代码  WCF Service或WebService中包含一些比较复杂的逻辑定义,并且引用了一些自己定义的组件,项目本身是可以编译通过的,但是就是无法被添加Service Reference。
751 0
Silverlight中资源文件的引用
1、新建一个资源文件,比如: Gaugestyle.xaml和MenuButton.xaml 2、在App.
522 0

热门文章

最新文章