My Generic.xaml
starts growing pretty large and i am searching for ways to split it up.
The first thing i tried was the most obvious to me: use ResourceDictionary.Merge
to do the trick.
However, when doing this, the styles set in those XAML files are not applied.
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="clr-namespace:SimplifySoft.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MyAssembly;component/Path/Control1.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MyAssembly;component/Path/Control2.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MyAssembly;component/Path/Control3.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Naturally, i first expected a mistake of mine in configuration of those. To confirm wether it was, i altered the file to something like this:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="clr-namespace:SimplifySoft.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<SolidColorBrush x:Key="MySolidColorBrushKey" Color="Red" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
as this neither is working, i am now here and asking:
How to properly Split up the generic.xaml file
Please note that using just the plain ResourceDictionary works perfectly fine and as expected, but due to the size of the file i start getting trouble editing the default styles.
Also note that the files refered in the Source
parameter are having the Build Action Resource
and are ResourceDictionaries
themself.
The Generic.xaml
has the Build Action Page
Thanks for your time :)