【WPF】ResourceDictionaryの多階層マージ
<Window x:Class="ResourceDictionaryTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<Grid.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Dictionary2.xaml"/> <!-- Dictionary2.xamlの内容をマージ -->
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Grid.Resources>
<Label Style="{StaticResource LabelStyle}"/> <!-- Dictionary1.xamlに定義されているResourceを参照できる。 -->
</Grid>
</Window>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Dictionary1.xaml"/> <!-- Dictionary1.xamlの内容をマージ -->
</ResourceDictionary.MergedDictionaries>
<Style x:Key="LabelStyle" TargetType="{x:Type Label}">
<Setter Property="Content" Value="{StaticResource Name}"/>
</Style>
</ResourceDictionary>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib">
<System:String x:Key="Name">aikazuyendo</System:String>
</ResourceDictionary>