I have an assembly (named "MyCompany") that I made for referencing from several other projects, where I want to put common classes and resources.
There I have a Recursos.xaml with the following:
<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="/Resources/Icons.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="estiloColumnaTitulo" TargetType="{x:Type GridViewColumnHeader}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Foreground" Value="#FF377099"/>
</Trigger>
</Style.Triggers>
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#FF56A8E2" />
<Setter Property="FontFamily" Value="Segoe UI Light" />
<Setter Property="FontSize" Value="14" />
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Height" Value="25" />
</Style>
<Style x:Key="estiloFila" TargetType="{x:Type ListViewItem}">
<Setter Property="BorderThickness" Value="0 0 0 1"/>
<Setter Property="BorderBrush" Value="#FFB6D0E2"/>
</Style>
</ResourceDictionary>
This file compile action is set to Resource as suggested in another similar questions that I have seen.
In my project, besides having added the reference (classes are working fine), I have the follwing:
<Application x:Class="Inventarios.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="Application_Startup">
<Application.Resources>
<ResourceDictionary Source="pack://application:,,,/MyCompany;component/Recursos.xaml"/>
</Application.Resources>
</Application>
It says error when trying to find resource dictionary 'pack://application:,,,/MyCompany;component/Recursos.xaml'
I have also tried:
<ResourceDictionary Source="/MyCompany;component/Recursos.xaml"/>
With same result... I know there are A LOT of questions with the same problem, but none of them gives me a working answer.