0

我有一个 CollectionViewSource 填充了数据库中的业务对象。设置 AutoCompleteBox ValueMemberPath="LNAME" 对所有姓氏都适用。但是,我想同时搜索名字和订单号,而不必使用单选按钮或下拉菜单来定义搜索类型。

我已将 ValueMemberPath 更改为 ValueMemberBinding:

ItemsSource="{Binding Source={StaticResource TheCollectionViewSource}}"
ValueMemberBinding="{Binding Converter={StaticResource ValueMemberPathConverter}}"

我不确定如何在转换器中组合 LNAME、FNAME 等

public class Converter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return foo;
        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return foo;
        }
}
4

1 回答 1

1
public Binding ValueMemberBinding
    {
      get
      {
        return _valueBindingEvaluator != null ?
          _valueBindingEvaluator.ValueBinding : null;
      }
      set
      {
        if (_valueBindingEvaluator == null)
        {
          _valueBindingEvaluator = new BindingEvaluator<string>();
          AddLogicalChild(_valueBindingEvaluator);
        }
        _valueBindingEvaluator.ValueBinding = value;
      }
    }
于 2013-01-10T11:20:00.593 回答