I have a class library project that is common to several other projects. It's assembly name is "MyCompany" and its default namespace also "".
Then in one of these other projects (namespace "MyCompany.Something") I have the dll referenced, and I want to use a resource dictionary that I have in "MyCompany".
I found this: Add ResourceDictionary to class library
So I did exactly what it says, my xaml file located at "MyCompany" root directory is named "Recursos.xaml", built action set to Resource, not copy and blank custom tool and custom tool namespace, with the following content:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
<ResourceDictionary Source="pack://application:,,,/Resources/Icons.xaml"/>
</ResourceDictionary.MergedDictionaries>
-- some other styles...
</ResourceDictionary>
Then, in my WPF app project, I have in App.xaml the following:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MyCompany;component/Recursos.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Just added there the Controls.xaml for testing purposes. That one works, but mine doesn't:
An error occurred while finding the resource dictionary "pack://application:,,,/MyCompany;component/Recursos.xaml"
So I don't know why it doesn't recognize it. The reference is working as I can use every class from it.