menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SearchController - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SearchController

    Represents the class that used to perform the search operation in the SfDataGrid.

    Inheritance
    System.Object
    SearchController
    Implements
    System.IDisposable
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.WinForms.DataGrid
    Assembly: Syncfusion.SfDataGrid.WinForms.dll
    Syntax
    public class SearchController : IDisposable

    Constructors

    SearchController(SfDataGrid)

    Initializes a new instance of the SearchController class

    Declaration
    public SearchController(SfDataGrid sfDataGrid)
    Parameters
    Type Name Description
    SfDataGrid sfDataGrid

    The SfDataGrid which needs to perform the search operation.

    Properties

    AllowCaseSensitiveSearch

    Gets or sets a value indicating whether the case sensitive search is enabled or not.

    Declaration
    public bool AllowCaseSensitiveSearch { get; set; }
    Property Value
    Type
    System.Boolean

    AllowFiltering

    Gets or sets a value indicating whether the filtering is enabled or for the search text or not.

    Declaration
    public bool AllowFiltering { get; set; }
    Property Value
    Type
    System.Boolean

    AllowHighlightSearchText

    Gets or sets a value indicating whether to highlight the search text or not.

    Declaration
    public bool AllowHighlightSearchText { get; set; }
    Property Value
    Type
    System.Boolean

    CurrentRowColumnIndex

    Gets the RowColumnIndex of the cell that match with search text when FindNext or FindPrevious methods are called.

    Declaration
    public RowColumnIndex CurrentRowColumnIndex { get; }
    Property Value
    Type
    RowColumnIndex

    DataGrid

    Gets or sets the grid associated with the search helper.

    Declaration
    protected SfDataGrid DataGrid { get; set; }
    Property Value
    Type
    SfDataGrid

    Provider

    Gets or sets the provider to reflect the cell value.

    Declaration
    protected IPropertyAccessProvider Provider { get; set; }
    Property Value
    Type
    IPropertyAccessProvider

    SearchColor

    Gets or sets a color to highlight the search text.

    Declaration
    public Color SearchColor { get; set; }
    Property Value
    Type
    System.Drawing.Color

    SearchColumns

    Gets or sets a list of column names that are used to perform the search operation.

    Declaration
    public List<string> SearchColumns { get; set; }
    Property Value
    Type
    System.Collections.Generic.List<System.String>
    Remarks

    By default the search will be performed all the columns of the Grid.

    SearchHighlightColor

    Gets or sets a color that highlights the search text of a cell during FindNext and FindPrevious method calls.

    Declaration
    public Color SearchHighlightColor { get; set; }
    Property Value
    Type
    System.Drawing.Color

    SearchText

    Gets or sets the text which needs to be searched in the SfDataGrid.

    Declaration
    public string SearchText { get; set; }
    Property Value
    Type
    System.String

    SearchType

    Gets or sets the default search condition for the search operation in SfDataGrid.

    Declaration
    public SearchType SearchType { get; set; }
    Property Value
    Type
    SearchType

    Methods

    ClearSearch()

    Clears the search text for the entire grid.

    Declaration
    public virtual void ClearSearch()

    CompareText(String)

    Compares the given text with the search text.

    Declaration
    protected virtual bool CompareText(string text)
    Parameters
    Type Name Description
    System.String text

    The text which needs to be compared with the search text.

    Returns
    Type Description
    System.Boolean

    Returns true, if the given text satisfies the search text condition; otherwise return false.

    Dispose()

    Releases the allocated resources used by the SearchController class.

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Releases the allocated resources used by the SearchController class.

    Declaration
    protected virtual void Dispose(bool isDisposing)
    Parameters
    Type Name Description
    System.Boolean isDisposing

    Indicates whether the call is from Dispose method or from a finalizer.

    FilterRecords(Object)

    Specifies whether the given row needs to be filtered or not.

    Declaration
    protected virtual bool FilterRecords(object dataRow)
    Parameters
    Type Name Description
    System.Object dataRow

    The row data object.

    Returns
    Type Description
    System.Boolean

    Returns true, if the given row object meets the filter criteria; Otherwise returns false.

    FindNext(String)

    Finds and highlights, the next cell match with search text and updates CurrentRowColumnIndex.

    Declaration
    public virtual bool FindNext(string text)
    Parameters
    Type Name Description
    System.String text

    Specifies the text to be searched.

    Returns
    Type Description
    System.Boolean

    Returns true if the next possible match is found; otherwise returns false.

    FindPrevious(String)

    Searches the previous match with the given search text and updates CurrentRowColumnIndex.

    Declaration
    public virtual bool FindPrevious(string text)
    Parameters
    Type Name Description
    System.String text

    Specifies the text to be searched.

    Returns
    Type Description
    System.Boolean

    Returns true, if any of the previous cell match with search text. Otherwise false.

    GetNextColumn(Int32, Boolean)

    Gets the next focused grid column for the specified column index and direction.

    Declaration
    protected GridColumn GetNextColumn(int columnIndex, bool forward)
    Parameters
    Type Name Description
    System.Int32 columnIndex

    The corresponding column index to get the next focused column.

    System.Boolean forward

    Specifies flow direction to get the next focused column.

    Returns
    Type Description
    GridColumn

    The next focused GridColumn for specified column index and direction. Returns null, if the specified column index is last column.

    HighlightSearchText(Graphics, DataColumnBase, CellStyleInfo, Rectangle, String, RowColumnIndex)

    Highlights the search text with the given fill color.

    Declaration
    protected virtual void HighlightSearchText(Graphics paint, DataColumnBase column, CellStyleInfo style, Rectangle bounds, string cellValue, RowColumnIndex rowColumnIndex)
    Parameters
    Type Name Description
    System.Drawing.Graphics paint

    The System.Drawing.Graphics that needs to draw the cell.

    DataColumnBase column

    The DataColumnBase of the cell.

    CellStyleInfo style

    The style of the cell.

    System.Drawing.Rectangle bounds

    The bounds of the cell.

    System.String cellValue

    The text which needs to be matched with the search text.

    RowColumnIndex rowColumnIndex

    The row column index of the cell.

    HorizontalScrollinView(Int32)

    Scrolls the columns horizontally when the column is clipped.

    Declaration
    protected void HorizontalScrollinView(int columnIndex)
    Parameters
    Type Name Description
    System.Int32 columnIndex

    The column index to scroll the column.

    MatchSearchText(GridColumn, Object)

    Checks whether the cell display text match with the SearchText.

    Declaration
    protected virtual bool MatchSearchText(GridColumn column, object record)
    Parameters
    Type Name Description
    GridColumn column

    The GridColumn being searched.

    System.Object record

    The data object being searched.

    Returns
    Type Description
    System.Boolean

    Returns true, if cell display text match with search text. Otherwise false.

    Search(String)

    Performs the Search operation in SfDataGrid based on given search text.

    Declaration
    public virtual void Search(string searchText)
    Parameters
    Type Name Description
    System.String searchText

    The text which needs to be search.

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved