无法设置多绑定,因为必须指定多值转换器 wpf

Cannot set multibinding because multivalue converter must be specified wpf

好的,在关注了关于这个问题的这两个帖子 [Post 1, ] 之后,我进入了以下方式。但是即使按照正确的实施方式,这个问题也让我大吃一惊。

所以这是我的转换器,它被添加到项目的 ViewModels 目录中:

public class ChangePasswordConverter : IMultiValueConverter
{
    public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
    {
        return ....
    }

    public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

下面是我的HomeWindow.xaml

<Controls:MetroWindow x:Class="KEOffice.Views.HomeWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
    xmlns:v="clr-namespace:KEOffice.Views"
    xmlns:vm="clr-namespace:KEOffice.ViewModels"
    xmlns:prism="http://prismlibrary.com/"
    prism:ViewModelLocator.AutoWireViewModel="True">

    <Window.Resources>
        <vm:ChangePasswordConverter x:Key="ChangePasswordConverter" />
    </Window.Resources>
    <!--But when I try to do this-->
    <Button Command="{Binding ChangePassword.UpdatePassword}">
           <Button.CommandParameter>
               <MultiBinding ConverterParameter="{StaticResource ChangePasswordConverter}">
                   <Binding Path="OldPass" ElementName="OldPass"/>
                   <Binding Path="NewPass" ElementName="NewPass"/>
                   <Binding Path="ConfirmPass" ElementName="ConfirmPass"/>
               </MultiBinding>
          </Button.CommandParameter>
    </Button>
</Controls:MetroWindow>

即使我已经对 viewmodels 给出了正确的引用,但在存在转换器并指定有效 StaticResource 的情况下,它会抛出 Cannot set multibinding because multivalue converter must be specified。我也做过重建、清理重建等,但仍然是同样的问题。我还需要注意什么才能使其正常工作?

你不用ConverterParameter指定转换器,你用Converter。