Note: I have a ResourceDictionary and WPF Window (my View) and ViewModel, all declared within a WinForms application. Therefore I have no App.xaml.
I have the following converter declared:
Public Class DebugConverter
Implements IValueConverter
Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
Return value
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack
Return value
End Function
End Class
And then I try loading a ResourceDictionary at runtime (which I specified the build action as Resource and not Page):
m_rdGridDictionary = New ResourceDictionary()
m_rdGridDictionary.Source = New Uri("pack://application:,,,/WPF/Helpers/GridResourceDictionary.xaml")
In the ResourceDictionary I have it declared as such:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cnv="clr-namespace:Positron.Cad.WindowGUI.WPFConverters">
<cnv:DebugConverter x:Key="DebugConverter"/>
</ResourceDictionary>
But when I try loading the ResourceDictionary, it cannot find the converter:
Would anyone know what is wrong with this scenario? They both exist in the same namespaces, so that shouldn't be the problem.