/// <summary> /// 过滤 /// </summary> /// <param name="sender"></param> private void Filter(object sender) { DevExpress.XtraEditors.GridLookUpEdit edit = sender as DevExpress.XtraEditors.GridLookUpEdit; DevExpress.XtraGrid.Views.Grid.GridView gridView = edit.Properties.View as DevExpress.XtraGrid.Views.Grid.GridView; System.Reflection.FieldInfo fi = gridView.GetType().GetField("extraFilter", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); DevExpress.Data.Filtering.BinaryOperator op1 = null; DevExpress.Data.Filtering.BinaryOperator op2 = null; op1 = new DevExpress.Data.Filtering.BinaryOperator("检索列名1", "%" + edit.AutoSearchText.ToUpper() + "%", DevExpress.Data.Filtering.BinaryOperatorType.Like); op2 = new DevExpress.Data.Filtering.BinaryOperator("检索列名2", "%" + edit.AutoSearchText.ToUpper() + "%", DevExpress.Data.Filtering.BinaryOperatorType.Like); string filterCondition = new DevExpress.Data.Filtering.GroupOperator(DevExpress.Data.Filtering.GroupOperatorType.Or, new DevExpress.Data.Filtering.CriteriaOperator[] { op1, op2 }).ToString(); fi.SetValue(gridView, filterCondition); gridView.ApplyColumnsFilter(); }