Hi, Clay:
I try to blank out the "Custom" option from the filter dropdownlist, but found one bug.
The original RecordFilterDescriptor Collection Editor Panel will pop up against whatever at selected index 1, the just blocked "Custom" position. I guess something in the Model also need changed.
Best wishes.
Ronnie Lu
>If you want to provide your own empty string, then you can set this property:
>
>
>CustomFilterBarCellModel model = this.gridGroupingControl1.TableModel.CellModels["CustFilterBarCell"] as CustomFilterBarCellModel;
>model.SelectEmptyText = "SomeEmptyText";
>
>
>Similarly, model.SelectAllText and model.SelectCustomText will let you control the text that appears for these options as well.
>
>If you want to omit them entirely, then one way would be to add this override to teh custom cell model. Then if you set any of teh properties mentioned above to be teh empty string, then that empty option will not appear in teh drop list.
>
>//these members used in renderer''s ListBoxMouseUp
>internal int offset = 0;
>internal int customOption = 1;
>internal int allOption = 0;
>public override void FillWithChoices(ListBox listBox, GridStyleInfo style, out bool exclusive)
>{
> base.FillWithChoices (listBox, style, out exclusive);
> this.offset = 0;
> this.customOption = 1;
> if(this.SelectAllText.Length == 0)
> {
> listBox.Items.RemoveAt(0);
> this.offset += 1;
> this.customOption -= 1;
> this.allOption = -1;
> }
> if(this.SelectCustomText.Length == 0)
> {
> this.customOption = -1;
> listBox.Items.RemoveAt(1 - offset);
> this.offset += 1;
> }
> if(this.SelectEmptyText.Length == 0)
> {
> listBox.Items.RemoveAt(2 - offset);
> this.offset += 1;
> }
>}
>
>If you remove any of the options, then things have to be adjusted in the renderer''s ListBoxMouseUp override using the values saved in the cellmodel.
>
>
>protected override void ListBoxMouseUp(object sender, MouseEventArgs e)
>{
> GridTableCellStyleInfo tableStyleInfo = (GridTableCellStyleInfo) StyleInfo;
> GridTableCellStyleInfoIdentity tableCellIdentity = tableStyleInfo.TableCellIdentity;
> if( this.ListBoxPart.SelectedIndex == filterModel.customOption)
> {
> MyFilterBarCustomDlg dlg = new MyFilterBarCustomDlg();
> dlg.colLabel.Text = tableCellIdentity.Column.MappingName;
> dlg.SetStrings(filterModel.FilterBarStrings);
> if(dlg.ShowDialog() == DialogResult.OK)
> {
> //apply the filter
> tableCellIdentity.Table.TableDescriptor.RecordFilters.Add(dlg.FilterString);
> }
> }
> else
> {
> if( this.ListBoxPart.SelectedIndex == filterModel.allOption)
> tableCellIdentity.Table.TableDescriptor.RecordFilters.Clear();
>
> int index = this.ListBoxPart.SelectedIndex;
> if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex > filterModel.offset)
> index += filterModel.offset;
> CurrentCell.CloseDropDown(PopupCloseType.Done);
> Model.Select(tableCellIdentity, index);
> SetTextBoxText(GetFilterBarText(StyleInfo), false);
> }
>}
>