I am testing being able to create a WPF control that can be used in an existing Winforms application. With this test, the goal is to have globally used WPF resource dictionary.
My first step of defining the style settings in the control works fine.
<UserControl.Resources>
<Style TargetType="Label">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="LightYellow"/>
<Setter Property="FontSize" Value="30"/>
</Style>
<Style TargetType="Label" x:Key="myHW">
<Setter Property="Foreground" Value="Green"/>
<Setter Property="Background" Value="LightBlue"/>
<Setter Property="FontSize" Value="30"/>
</Style>
<Style TargetType="Label" x:Key="StatusMessage">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="LightPink"/>
</Style>
</UserControl.Resources>
Second was to then extract the style information to a dictionary XAML file and then reference it via the resource dictionary. This step is not working.
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Dictionaries/ResourceTest.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
Assembly name: test2
Path inside project: /Dictionaries/ResourceTest.xaml
Error received in development is:
Exception: An error occurred while finding the resource dictionary "/Dictionaries/ResourceTest.xaml".
I have tried variations of the URI syntax as presented by Microsoft.
Does the build action type for the xaml relate to the issue?