我的Windows窗体项目中有一个Janus多列组合框。我用这段代码来填充它:
mcbCustomerId.ValueMember = "ID"
mcbCustomerId.DisplayMember = "FarsiFamily"
mcbCustomerId.DataMember = "TblCustomer"
mcbCustomerId.DataSource = ds
我在这个组合框中有四列,但只有FarsiFamily组合框处于自动完成模式。我想为其他列设置自动完成模式。我怎么能这样做?
答案 0 :(得分:1)
您必须覆盖OnTextBoxTextChanged方法以遍历列并过滤列表。
以下是如何操作的示例:
public partial class MultiColumnSearchCombo : MultiColumnCombo
{
protected override void OnTextBoxTextChanged(EventArgs e)
{
GridEXFilterCondition internalFilter = new GridEXFilterCondition();
String str = TextBox.Text;
foreach (GridEXColumn column in DropDownList.Columns)
{
if (!column.Visible)
continue;
GridEXFilterCondition filterCondition = new GridEXFilterCondition(column, ConditionOperator.Contains, str);
internalFilter.AddCondition(LogicalOperator.Or, filterCondition);
}
DropDownList.ApplyFilter(internalFilter);
}
}