I have a class library which contains a ResourceDictionary
that holds some Styles
.
The dictionary references a Converter
, that's defined in the same assembly, like so:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converter="clr-namespace:Lib.Resources.Converters">
<converter:TextSizeConverter x:Key="LabelTextSizeConverter" />
<Style TargetType="{x:Type Label}">
<Setter Property="FontSize"
Value="{Binding ActualWidth, RelativeSource={RelativeSource Self}, Converter={StaticResource LabelTextSizeConverter}}" />
</Style>
<ResourceDictionary />
When I try to load the dictionary in another project I get a XamlParseException
stating that the Converter
is of an unknown type.
var rd = new ResourceDictionary()
{
Source = new Uri("pack://application:,,,/Lib.Resources;component/Styles/Label.xaml")
};
Resources.MergedDictionaries.Add(rd);
I tried various BuildActions
for the converter without any success.
Is there a way to fix this, or do I need to approach this in a completely different way?