Still learning this stuff on WPF, themes, derivations, etc.
I understand basics on the “Themes\Generic.xaml”, and then setting your application’s app.xaml file to include the resource dictionary pointing to the theme in question.
So, thats fine from an application project perspective. Now, how about from a class library/dll file. I have a DLL project which I want to use as the basis of all controls in my project. In that, I have the Themes/Generic.xaml and have it coded up with some basics to confirm visual design implementation (originally confirmed ok, when tested under an App/exe project).
Now, I want this theme at a level BEFORE the actual application. Again, this is the baseline. Now, I add a second library of custom grouped controls (for example, a user control for address information… multiple address lines, city, state, zip, labels, etc). I want this second library to reference the first library with the themes, so I can see visually at design time what it will look like (alignments, colors, fonts, etc).
What / where should I be looking to let one DLL know about the merge dictionaries that are the basis in the first DLL. Hope this makes sense.
— EDIT — for clarification
First Class Library… “MyThemeLibrary” compiles into a .dll
In this dll is path/file of “/Themes/MyTheme.xaml”
As suggested by first answer, if I have a Resource Dictionary in the first library, I can reference it in anything else that I will derive from it. So, I have
<ResourceDictionary x:Name="MyGenericTheme"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Themes/MyTheme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Second Class Library… “SecondLevel” compiles into a .dll
In this, I have a user control that I want to put a grid for columns/rows, labels and textbox controls into. I want the controls to respect the colors, fonts, sizes, alignments as defined in the “MyTheme.xaml” of the first dll.
<UserControl x:Class="SecondLevel.multipleControlContainer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Label Content="Something"
Grid.Row="0" Grid.Column="0" />
<TextBox Text="Testing" Grid.Row="1" Grid.Column="1" />
</Grid>
</UserControl>
So, how / what should I do the necessary reference, declaration, inclusion of resource dictionary from the first library into the second.
make a reference to your dll and if you know where your theme is located you can do this one
do this in the App.xaml
EDIT after clarification (look at the comments)