silverlight 自定义资源整理(待后续补充)

1、直接在控件(窗体)中定义 

<UserControl.Resources> 
<SolidColorBrush x:Key="TextBoxBackgroundColor" Color="LemonChiffon"/>
</UserControl.Resources>

<TextBox Background="{StaticResource TextBoxBackgroundColor}"/>

2、在资源字典中直接定义

<ResourceDictionary 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml">

<SolidColorBrush x:Key="TextBoxBackgroundColor" Color="LemonChiffon"/>
</ResourceDictionary>

3、在资源字典中嵌套定义其他资源文件

<Application.Resources> 
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Assets/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

优先级待整理后写上



posted @ 2011-11-08 16:29  niky  阅读(367)  评论(0编辑  收藏  举报