alexa
Syncfusion
menu Syncfusion

WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download

    Show / Hide Table of Contents

    Class SearchHelper

    Represents the Search operation which is performed in the DataGrid.

    Inheritance
    System.Object
    SearchHelper
    Implements
    INotifyDependencyPropertyChanged
    System.IDisposable
    Namespace: Syncfusion.UI.Xaml.DataGrid
    Assembly: Syncfusion.Grid.WinUI.dll
    Syntax
    public class SearchHelper : DependencyObject, INotifyDependencyPropertyChanged, IDisposable
    Remarks

    The SearchHelper provides a flexible way to search the text in the DataGrid.

    Constructors

    SearchHelper(SfDataGrid)

    Invokes when new instances has been created.

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

    Fields

    AllowCaseSensitiveSearchProperty

    Identifies the Syncfusion.UI.Xaml.DataGrid.SfDataGrid.SearchHelper.AllowCaseSensitiveSearch dependency property.

    Declaration
    public static readonly DependencyProperty AllowCaseSensitiveSearchProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the Syncfusion.UI.Xaml.DataGrid.SfDataGrid.SearchHelper.AllowCaseSensitiveSearch dependency property.

    AllowFilteringProperty

    Identifies the Syncfusion.UI.Xaml.DataGrid.SfDataGrid.SearchHelper.AllowFiltering dependency property.

    Declaration
    public static readonly DependencyProperty AllowFilteringProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the Syncfusion.UI.Xaml.DataGrid.SfDataGrid.SearchHelper.AllowFiltering dependency property.

    AllowSearchingProperty

    Identifies the AllowSearching dependency property.

    Declaration
    public static readonly DependencyProperty AllowSearchingProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    CanHighlightSearchTextProperty

    Declaration
    public static readonly DependencyProperty CanHighlightSearchTextProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    DataGrid

    Gets the Datagrid

    Declaration
    protected SfDataGrid DataGrid
    Field Value
    Type
    SfDataGrid

    Provider

    Gets the provider to reflect the cell value.

    Declaration
    protected IPropertyAccessProvider Provider
    Field Value
    Type
    IPropertyAccessProvider

    SearchBrushProperty

    Identifies the Syncfusion.UI.Xaml.DataGrid.SfDataGrid.SearchHelper.SearchBrush dependency property.

    Declaration
    public static readonly DependencyProperty SearchBrushProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the Syncfusion.UI.Xaml.DataGrid.SfDataGrid.SearchHelper.SearchBrush dependency property.

    SearchForegroundBrushProperty

    Identifies the SearchForegroundBrush dependency property.

    Declaration
    public static readonly DependencyProperty SearchForegroundBrushProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the SearchForegroundBrush dependency property.

    SearchForegroundHighlightBrushProperty

    Identifies the SearchForegroundHighlightBrush dependency property.

    Declaration
    public static readonly DependencyProperty SearchForegroundHighlightBrushProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the SearchForegroundHighlightBrush dependency property.

    SearchHighlightBrushProperty

    Identifies the Syncfusion.UI.Xaml.DataGrid.SfDataGrid.SearchHelper.SearchHighlightBrush dependency property.

    Declaration
    public static readonly DependencyProperty SearchHighlightBrushProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the Syncfusion.UI.Xaml.DataGrid.SfDataGrid.SearchHelper.SearchHighlightBrush dependency property.

    SearchTextProperty

    Declaration
    public static readonly DependencyProperty SearchTextProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    SearchTypeProperty

    Identifies the Syncfusion.UI.Xaml.DataGrid.SfDataGrid.SearchHelper.SearchType dependency property.

    Declaration
    public static readonly DependencyProperty SearchTypeProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the Syncfusion.UI.Xaml.DataGrid.SfDataGrid.SearchHelper.SearchType dependency property.

    Properties

    AllowCaseSensitiveSearch

    Gets or sets a value that enables case-sensitive string comparison during search in SfDataGrid. ///

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

    true if the case sensitive search enabled; otherwise, false. The default value is false.

    AllowFiltering

    Gets or sets a value that indicates whether to enable filter based on search text.

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

    true if the DataGrid is filtered when Search is called. Otherwise, false. The default value is false.

    AllowSearching

    Gets or sets a value that indicates whether the search operation is enabled in SfDataGrid.

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

    true if search is enabled; otherwise, false. The default value is true.

    Remarks

    AllowSearching takes higher priority: a column whose value is true is still searched when this property is false, and a column whose value is false is never searched. Columns that do not set AllowSearching use this property. When this property is false and no column sets AllowSearching to true, Search(String), ClearSearch(), FindNext(String) and FindPrevious(String) do nothing.

    CanHighlightSearchText

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

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

    true, if the search text is highlighted; otherwise,false. The default value is true.

    CurrentRowColumnIndex

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

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

    SearchBrush

    Gets or sets a brush to highlight search text in SfDataGrid.

    Declaration
    public Brush SearchBrush { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Media.Brush

    The background color of the SearchText in the GridCell. The default value is Yellow.

    SearchForegroundBrush

    Gets or sets a brush to highlight search text foreground.

    Declaration
    public Brush SearchForegroundBrush { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Media.Brush

    The foreground color of the SearchText in the GridCell. The default value is Black.

    SearchForegroundHighlightBrush

    Gets or sets a brush that highlights the search text foreground of a cell during FindNext(String) and FindPrevious(String) method calls.

    Declaration
    public Brush SearchForegroundHighlightBrush { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Media.Brush

    The foreground color of the SearchText in the GridCell when FindNext(String) or FindPrevious(String) is called.The default value is Black

    SearchHighlightBrush

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

    Declaration
    public Brush SearchHighlightBrush { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Media.Brush

    The background color of the SearchText in the GridCell when FindNext or FindPrevious is called.

    SearchText

    Gets the text which is used to search the DataGrid.

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

    SearchType

    Gets or sets the SearchType that denotes how to compare cell values with search text.

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

    One of the enumeration specifying the SearchType. The default value is SearchType.Contains

    Methods

    ClearSearch()

    Clears the text highlighting in the searched TextBlock’s of SfDataGrid.

    Declaration
    public virtual void ClearSearch()

    ClearSearchCell(DataColumnBase, Object)

    Clears highlighting in the specified GridCell.

    Declaration
    protected virtual void ClearSearchCell(DataColumnBase column, object record)
    Parameters
    Type Name Description
    DataColumnBase column

    Denotes the column associated with cell.

    System.Object record

    Denotes the data object associated with cell.

    ClearSearchRow(DataRowBase)

    Clears the highlighting in the searched TextBlock’s of DataRow.

    Declaration
    protected virtual void ClearSearchRow(DataRowBase row)
    Parameters
    Type Name Description
    DataRowBase row

    Specifies the corresponding DataRow.

    Dispose()

    Releases the allocated resources used by the SearchHelper class.

    Declaration
    public void Dispose()

    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
    System.Boolean

    FindPrevious(String)

    Find and highlights, the previous cell match with 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.

    GetSearchRecords()

    Search and returns the collection of GridSearchInfo.

    Declaration
    public List<GridSearchCellInfo> GetSearchRecords()
    Returns
    Type Description
    System.Collections.Generic.List<GridSearchCellInfo>

    Returns list of GridSearchCellInfo.

    OnDependencyPropertyChanged(String, DependencyPropertyChangedEventArgs)

    Notifies the associated DataGrid notification infrastructure when a SearchHelper dependency property changes.

    Declaration
    public void OnDependencyPropertyChanged(string propertyName, DependencyPropertyChangedEventArgs e)
    Parameters
    Type Name Description
    System.String propertyName

    The name of the dependency property that changed.

    Microsoft.UI.Xaml.DependencyPropertyChangedEventArgs e

    Provides data associated with the dependency property change.

    Search(String)

    Initiates the Search operation in SfDataGrid based on passed text.

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

    Specifies the text to be Search.

    Implements

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