private void ProcessItemSelection(object sender) { ColumnFilterItem filterValue = (ColumnFilterItem)((PopupForm)sender).SelectedFilterItem; if (filterValue == null) { return; } if (filterValue is ColumnFilterCustomItem && filterShowingColumn != null) { CustomFilterForm frm = CreateCustomFilterForm(); PopuplateFilterConditions(frm); if (frm.ShowDialog() == DialogResult.OK) { filterValue = GetCustomFilterValue(frm); AddSingleFilterCondition(frm.cbeFilterConditions.Text, filterValue); } } else if (!filterValue.IsEmpty && filterShowingColumn != null) { AddSingleFilterCondition("Equals", filterValue); } filterShowingColumn = null; }
protected virtual void PopuplateFilterConditions(CustomFilterForm frm) { frm.filterGroupPanel.Text = filterShowingColumn.GetCaption(); for (int i = 0; i < OwnerTreeList.ColumnFilterConditions.Count; i++) { if (OwnerTreeList.ColumnFilterConditions[i].Column == filterShowingColumn) { frm.cbeFilterConditions.Text = OwnerTreeList.ColumnFilterConditions[i].Condition.ToString(); frm.teValue.Text = OwnerTreeList.ColumnFilterConditions[i].Value.ToString(); break; } } }
protected virtual ColumnFilterItem GetCustomFilterValue(CustomFilterForm frm) { ColumnFilterItem filterValue; try { filterValue = new ColumnFilterItem(Convert.ChangeType(frm.teValue.EditValue, filterShowingColumn.ColumnType), frm.teValue.Text); } catch { filterValue = new ColumnFilterItem(frm.teValue.Text, frm.teValue.Text); } return(filterValue); }