Mám veľa oddelených vektorových ikon Xaml .xaml
, Načítam ich do môjho window
pomocou tejto smernice:
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/ScreenToGif;component/Themes/IconSet.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
Mám veľa okien, takže by som chcel jednoducho vložiť tento kód do systému Windows App.xaml
.
Snažím sa toto:
<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>
Takže tu je problém:
Všetky príklady sa nepoužívajú a x:Key
atribútu, ale dáva mi chybu, keď hovorí, že potrebujem. Keď to urobím, hovorí sa mi, že nemôžem mať viac vlastností Resource
...
odpovede:
15 pre odpoveď č. 1Prečítajte si komentovaný text
<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>