【问题标题】:Syntax error while implement IMultiValueConverter-WPF实现 IMultiValueConverter-WPF 时出现语法错误
【发布时间】:2016-02-14 10:09:44
【问题描述】:

我是 WPF 的新手,我想实现 IMultiValueConverter

On MainWindow.xaml.cs:
public class CanSelectNextPage2 : IMultiValueConverter
{
    public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        if (values[0] is bool && values[1] is bool && values[2] is string && values[3] is string && values[4] is string)
            if (((bool)values[0] || (bool)values[1]) &&
                (values[2] != null) && (values[3] != null) && (values[4] != null)
                (values[2].ToString().Length > 1) &&
                (values[3].ToString().Length > 1) &&
                (values[4].ToString().Length > 1))
            {
                return true;
            }

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

我遇到了语法错误:

(values[4] != null)

错误是:需要方法名称

有人可以帮忙吗?

【问题讨论】:

    标签: wpf data-binding multibinding


    【解决方案1】:

    您在(values[4] != null) 之后缺少&& 运算符。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-22
      • 1970-01-01
      • 1970-01-01
      • 2021-11-18
      • 1970-01-01
      • 1970-01-01
      • 2016-09-08
      相关资源
      最近更新 更多