GrapeCity MultiRow Windows Forms Documentation
FilteringTextBoxCell Class
Members  Example 


Represents a special TextBoxCell that supports filtering of the specified Cells in all Rows using a specified condition.
Object Model
FilteringTextBoxCell ClassGcMultiRow ClassCellStyle ClassCellNote ClassSection ClassCellStyle ClassMultiRowTouchToolBar ClassValidatorCollection ClassCellValidator Class
Syntax
<DefaultPropertyAttribute("FilteringCellName")>
<DesignerAttribute(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="GrapeCity.Win.MultiRow.Design.FilteringTextBoxCellDesigner,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
<ToolboxBitmapAttribute()>
<SRDescriptionAttribute("Enables the user to filter rows by entering text. ")>
<ToolboxItemFilterAttribute(FilterString="GrapeCity.Win.MultiRow.Template7", FilterType=ToolboxItemFilterType.Custom Or  _
    ToolboxItemFilterType.Prevent Or  _
    ToolboxItemFilterType.Require)>
<BindableCellAttribute(False)>
Public Class FilteringTextBoxCell 
   Inherits TextBoxCell
   Implements IFilteringCell 
Dim instance As FilteringTextBoxCell
[DefaultProperty("FilteringCellName")]
[Designer(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="GrapeCity.Win.MultiRow.Design.FilteringTextBoxCellDesigner,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
[ToolboxBitmap()]
[SRDescription("Enables the user to filter rows by entering text. ")]
[ToolboxItemFilter(FilterString="GrapeCity.Win.MultiRow.Template7", FilterType=ToolboxItemFilterType.Custom | 
    ToolboxItemFilterType.Prevent | 
    ToolboxItemFilterType.Require)]
[BindableCell(false)]
public class FilteringTextBoxCell : TextBoxCell, IFilteringCell  
Remarks
You can add a FilteringTextBoxCell in the ColumnHeaderSection or ColumnFooterSection. Specify the FilteringCellIndex or FilteringCellName to indicate which cells in the rows are filtered. Then specify the FilterComparisonOperator to indicate the filtering condition. If you want to customize a filtering operation, set the FilterComparisonOperator property to FilterComparisonOperator.Custom. Then implement an System.Collections.IComparer set to CustomComparisonOperator.
Example
The following code example shows how to use a filter text box cell to filter and how to customize the properties of this cell.
using System;
using System.Drawing;
using System.Windows.Forms;

namespace GrapeCity.Win.MultiRow.SampleCode
{
    public class FilteringTextBoxCellDemo : Form
    {
        private GcMultiRow gcMultiRow1 = new GcMultiRow();

        private Label descriptionLable = new Label();

        public FilteringTextBoxCellDemo()
        {
            this.Text = "FilteringTextBoxCell Demo";
            this.Size = new Size(350, 400);

            // Add MultiRow to form
            this.gcMultiRow1.Dock = DockStyle.Fill;
            this.Controls.Add(this.gcMultiRow1);

            descriptionLable.Height = 40;
            descriptionLable.BackColor = SystemColors.Info;
            descriptionLable.Dock = DockStyle.Bottom;
            descriptionLable.Text = "Edit values of cells in the Yellow section to perform filter";
            this.Controls.Add(descriptionLable);

            this.Load += new EventHandler(Form1_Load);

            gcMultiRow1.CellValueChanged += new 
EventHandler<CellEventArgs>(gcMultiRow1_CellValueChanged);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            TextBoxCell nameTextBoxCell = new TextBoxCell();
            TextBoxCell departmentTextBoxCell = new TextBoxCell();
            CheckBoxCell genderCheckBoxCell = new CheckBoxCell();

            Cell[] comboBoxCells = new Cell[] { nameTextBoxCell, departmentTextBoxCell, genderCheckBoxCell };

            Template template1 = Template.CreateGridTemplate(comboBoxCells);

            ColumnHeaderSection filterRow = new ColumnHeaderSection();
            filterRow.Height = 21;

            // Filter row can be edited.
            filterRow.ReadOnly = false;
            filterRow.Selectable = true;
            filterRow.BackColor = Color.Yellow;

            filterRow.Cells.Add(CreateTextFilterCell());
            filterRow.Cells.Add(CreateComboBoxFilterCell());
            filterRow.Cells.Add(CreateCheckBoxFilterCell());

            filterRow.Cells[0].Location = nameTextBoxCell.Location;
            filterRow.Cells[1].Location = departmentTextBoxCell.Location;
            filterRow.Cells[2].Location = genderCheckBoxCell.Location;

            template1.ColumnHeaders.Add(filterRow);

            gcMultiRow1.Template = template1;

            this.gcMultiRow1.ColumnHeaders[0][0].Value = "Name";
            this.gcMultiRow1.ColumnHeaders[0][1].Value = "Department";
            this.gcMultiRow1.ColumnHeaders[0][2].Value = "Gender";

            this.FillData();
        }
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports GrapeCity.Win.MultiRow

Public Class FilteringTextBoxCellDemo
    Inherits Form
    Friend WithEvents gcMultiRow1 As New GcMultiRow()

    Private descriptionLable As New Label()

    Public Sub New()
        Me.Text = "FilteringTextBoxCell Demo"
        Me.Size = New Size(350, 400)

        ' Add MultiRow to form
        Me.gcMultiRow1.Dock = DockStyle.Fill
        Me.Controls.Add(Me.gcMultiRow1)

        descriptionLable.Height = 40
        descriptionLable.BackColor = SystemColors.Info
        descriptionLable.Dock = DockStyle.Bottom
        descriptionLable.Text = "Edit values of cells in the Yellow section to perform filter"
        Me.Controls.Add(descriptionLable)
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim nameTextBoxCell As New TextBoxCell()
        Dim departmentTextBoxCell As New TextBoxCell()
        Dim genderCheckBoxCell As New CheckBoxCell()

        Dim comboBoxCells As Cell() = New Cell() {nameTextBoxCell, departmentTextBoxCell, 
genderCheckBoxCell}

        Dim template1 As Template = Template.CreateGridTemplate(comboBoxCells)

        Dim filterRow As New ColumnHeaderSection()
        filterRow.Height = 21

        ' Filter row can be edited.
        filterRow.ReadOnly = False
        filterRow.Selectable = True
        filterRow.BackColor = Color.Yellow

        filterRow.Cells.Add(CreateTextFilterCell())
        filterRow.Cells.Add(CreateComboBoxFilterCell())
        filterRow.Cells.Add(CreateCheckBoxFilterCell())

        filterRow.Cells(0).Location = nameTextBoxCell.Location
        filterRow.Cells(1).Location = departmentTextBoxCell.Location
        filterRow.Cells(2).Location = genderCheckBoxCell.Location

        template1.ColumnHeaders.Add(filterRow)

        gcMultiRow1.Template = template1

        Me.gcMultiRow1.ColumnHeaders(0)(0).Value = "Name"
        Me.gcMultiRow1.ColumnHeaders(0)(1).Value = "Department"
        Me.gcMultiRow1.ColumnHeaders(0)(2).Value = "Gender"

        Me.FillData()
    End Sub
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         GrapeCity.Win.MultiRow.Cell
            GrapeCity.Win.MultiRow.TextBoxCell
               GrapeCity.Win.MultiRow.FilteringTextBoxCell

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

FilteringTextBoxCell Members
GrapeCity.Win.MultiRow Namespace
Cell Class
TextBoxCell Class

 

 


Copyright © GrapeCity, inc. All rights reserved.