3

我意识到还有其他具有相同标题的问题,但是我尝试了所有这些解决方案均无济于事。我正在尝试使用我制作的转换器。我的另一个转换器工作正常,这个新转换器是前一个转换器的复制粘贴,名称已更改,返回值已更改。

XAML

xmlns:local="clr-namespace:ARC"
    <local:DoublerConvert x:Key="DoubleConverter"/> 'Doesn't work
    <local:ValueConverter x:Key="NegativeConverter"/> 'Works fine

代码

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
4

2 回答 2

18

您尝试杀死 XDesProc.exe 并重新加载您的 xaml。

于 2013-03-07T04:53:43.223 回答
0

我在 c# 中遇到了同样的错误。我已经阅读了很多关于这个问题的信息。那么我做了什么来解决它?我运行了干净的项目,然后构建了项目。VS 向我展示了错误列表,我修复了每个错误!每个!之后我的解决方案构建成功!希望它对你有用!

于 2013-05-05T09:21:27.777 回答