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>
优先级待整理后写上