IMul​​tiValueConverter值没问题,但CommandParameter为null

Ama*_*duh 3 wpf multibinding commandparameter

我试图通过IMultiValueConverter将几个值传递给命令(作为命令参数).这些值在通过转换器时是正确的,但是一旦调用了Can_Execute()和Execute()命令,我就会获得一个空对象数组.有任何想法吗?

XAML:

    <Button Content="+" HorizontalAlignment="Right" VerticalAlignment="Top" Width="23" Height="23" Margin="0,0,0,0">
        <Button.CommandParameter>
            <MultiBinding Converter="{StaticResource Converter_MultipleValues}">
                <Binding/>
            </MultiBinding>
        </Button.CommandParameter>
        <Button.Command>
            <Binding Path="Command_Add_Files" Source="{StaticResource Vm_FileList}"/>
        </Button.Command>
    </Button>
Run Code Online (Sandbox Code Playgroud)

IMul​​tiValueConverter类:

class cvt_multivalue : IMultiValueConverter {
    public object Convert (object[] Values, Type Target_Type, object Parameter, CultureInfo culture) {
        if (Target_Type != typeof (object)) throw new NotSupportedException ();
        return Values;
        }

    public object [] ConvertBack (object Value, Type [] Target_Type, object Parameter, CultureInfo culture) {
        throw new NotSupportedException ();
        }
    }
Run Code Online (Sandbox Code Playgroud)

当我没有使用MultiBinding和转换器时,代码工作得很好,但我需要MultiBinding,所以我可以将一些额外的信息传递给命令.

Ama*_*duh 6

返回Values.Clone()而不仅仅是转换器中的值似乎解决了问题,但我不确定这是否是最好的事情......