I have created a MarkupExtension
that exposes a Converter property of the Type IValueConverter
, the Intellisens in visual studio finds it but when I try to compile I get the following error: Unknown property 'Converter' for type 'MS.Internal.Markup.MarkupExtensionParser+UnknownMarkupExtension' encountered while parsing a Markup Extension.
EnumItemSourceBinding:
Public Class EnumItemSourceBinding
Inherits MarkupExtension
Implements INotifyPropertyChanged
Private mEnumType As Type
Private mConverter As IValueConverter
<DefaultValue(CObj(Nothing))>
Public Property EnumType As Type
Get
Return mEnumType
End Get
Set(value As Type)
mEnumType = value
OnPropertyChanged(NameOf(EnumType))
mBindingChanged = True
End Set
End Property
<DefaultValue(CObj(Nothing))>
Public Property Converter As IValueConverter
Get
Return mConverter
End Get
Set(value As IValueConverter)
mConverter = value
OnPropertyChanged(NameOf(Converter))
mBindingChanged = True
End Set
End Property
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public Sub New()
MyBase.New()
End Sub
Public Sub New(enumType As Type)
MyBase.New()
mEnumType = enumType
End Sub
Private Sub OnPropertyChanged(ByVal propertyName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
End Sub
End Class
Xaml:
{local:EnumItemSourceBinding {x:Type local:BoundTextFields}, Converter={StaticResource EnumToTextConverter}}
Why do I get the compilation error?
It seems you can't define the MarkupExtension
in the same assembly where you want to use it so I had to split it out.