リソース・ディクショナリは、別個のXAMLファイル(リソース・ディクショナリ・ファイル)として作成することもできる。次のコードはそのファイル内容の例だ。 <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <SolidColorBrush x:Key="BlueBrush" Color="Blue"/> </ResourceDictionary> 上記のソースコードをファイル「ResourceDictionary1.xaml」に格納するとして、下記のように呼び出します。 例: <Grid> <Grid.Resources> <ResourceDictionary Source="ResourceDictionary1.xaml"/> </Grid.Resources> <Ellipse Fill="{StaticResource BlueBrush}" /> </Grid> 月額たった 1,050円で始められる本格的なお店のホームページ! コメント: |