4

分離された .xml 内に多数の Xaml ベクター アイコンがあります.xamlwindowこのディレクティブを使用して、それらを内部にロードします。

<Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/ScreenToGif;component/Themes/IconSet.xaml"></ResourceDictionary>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>

私はたくさんのウィンドウを持っているので、このコードをApp.xaml.

私はこれを試しています:

<Application.Resources> <!-- Error, The property "Resources" can only be set once. -->
    <ResourceDictionary x:Key="IconSet"> <!--Not sure why this?-->
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Mine;component/Themes/Theme.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>

<!--Here goes the rest of the file, with Style and DropShadowEffect... -->
</Application.Resources>

だからここに問題があります:

すべての例で属性を使用していませんが、x:Key属性が必要であるというエラーが表示されます。それをすると、複数のプロパティを持つことはできないと言われますResource...

4

1 に答える 1

22

コメントのテキストを参照してください

<Application.Resources>    
    <ResourceDictionary>           
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Mine;component/Themes/Theme.xaml"/>
        </ResourceDictionary.MergedDictionaries>

        <!--You have to add other style here only-->

    </ResourceDictionary>

<!--Not Here-->

</Application.Resources>

于 2014-11-30T16:42:31.310 に答える