我意識到還有其他問題具有相同的標題,但是我嘗試了所有這些解決方案都無濟於事。我正在嘗試使用我製作的轉換器。我的其他轉換器工作正常,這個新的是一個前一個複製粘貼,名稱已更改,返回值更改。命名空間「clr -....」中不存在名稱「DoublerConvert」
XAML
xmlns:local="clr-namespace:ARC"
<local:DoublerConvert x:Key="DoubleConverter"/> 'Doesn't work
<local:ValueConverter x:Key="NegativeConverter"/> 'Works fine
CODE
Public Class ValueConverter
Implements IValueConverter
Public Function ProvideValue(serviceProvider As System.IServiceProvider) As Object
Return Me
End Function
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
Dim OldWidth As Integer = value
OldWidth = -OldWidth
Return OldWidth
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException
End Function
End Class
Public Class DoublerConvert
Implements IValueConverter
Public Function ProvideValue(serviceProvider As System.IServiceProvider) As Object
Return Me
End Function
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
Dim OldWidth As Integer = value
Return 2 * OldWidth
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException
End Function
End Class
您是否確保重建包含轉換器代碼的程序集? – WildCrustacean
是的,我有。我嘗試過清洗,重建以及全部保存>退出>再次啓動VS>清理>重建 – JosephGarrone
這兩個類是否包含在相同的代碼文件中?仔細檢查兩者是否具有相同的名稱空間定義。這是一個常見的問題,像轉換器那樣移動,但它們的名稱空間沒有更新,然後當您在新位置添加新的名稱空間時,即使它們位於同一文件夾中,名稱空間也不同於原始位置。 –