Hello,
we currently have a couple of DLLs containing logic for different projects. One of these includes converters, styles and similar items.
While trying to use these converters from the DLL, the xaml designer underlines where converters are used.
The resource "...Converter" could not be resolved.
In the xaml files, where the converters are used, is a resourcedictionary defined.
<UserControl.Resources><ResourceDictionary><ResourceDictionary.MergedDictionaries><ResourceDictionary Source="/ASSEMBLY;component/Themes/Generic.xaml" /></ResourceDictionary.MergedDictionaries></ResourceDictionary></UserControl.Resources>
Inside of this Generic.xaml - in the DLL/Assembly - are resourcedictionaries defined.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ASSEMBLY"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:syswin="clr-namespace:System.Windows;assembly=PresentationFramework"
xmlns:converters="clr-namespace:ASSEMBLY.Converters"><ResourceDictionary.MergedDictionaries><!-- converters --><ResourceDictionary Source="/ASSEMBLY;component/Converters/Converters.xaml" /><!-- other dicts --></ResourceDictionary.MergedDictionaries></ResourceDictionary>
In the Converters.xaml are the converters defined.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:ASSEMBLY.Converters"><BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" /><converters:CustomConverterClass x:Key="CustomConverter" /></ResourceDictionary>
How can I fix this xaml designer bug ?
Some websites suggested using DynamicResource, but that's not going to work, as the designer apparently encounters an exception.
XamlParseException: A 'DynamicResourceExtension' cannot be set on the 'Converter' property of type 'Binding'. A 'DynamicResourceExtension' can only be set on a DependencyProperty of a DependencyObject.
Stacktrace [...]
InnerException: None
Example of converter-usage:
<DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock ToolTip="{Binding Path=ToolTip, Converter={StaticResource SomeConverter}}"
Text="{Binding Path=Text, Converter={StaticResource SomeConverter} }" /></DataTemplate></DataGridTemplateColumn.CellTemplate>
.