Class DataGridSearchController
Represents the Search operation which is performed in the DataGrid.
Inheritance
Namespace: Syncfusion.Maui.DataGrid
Assembly: Syncfusion.Maui.DataGrid.dll
Syntax
public class DataGridSearchController : BindableObject
Constructors
DataGridSearchController(SfDataGrid)
Invokes when new instances has been created.
Declaration
public DataGridSearchController(SfDataGrid sfDataGrid)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | sfDataGrid |
Fields
AllowCaseSensitiveProperty
Bindable property for AllowCaseSensitive
Declaration
public static readonly BindableProperty AllowCaseSensitiveProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
AllowFilteringProperty
Bindable property for AllowFiltering
Declaration
public static readonly BindableProperty AllowFilteringProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
CanHighlightSearchTextProperty
Bindable property for CanHighlightSearchText
Declaration
public static readonly BindableProperty CanHighlightSearchTextProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
SearchTextProperty
Bindable property for SearchText
Declaration
public static readonly BindableProperty SearchTextProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
SearchTypeProperty
Bindable property for SearchType
Declaration
public static readonly BindableProperty SearchTypeProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
Properties
AllowCaseSensitive
Gets or sets a value that enables case-sensitive string comparison during search in SfDataGrid.
Declaration
public bool AllowCaseSensitive { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
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 |
|---|
| System.Boolean |
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 |
|---|
| System.Boolean |
CurrentRowColumnIndex
Gets the RowColumnIndex of the cell that match with search text FindNext or FindPrevious methods are called.
Declaration
public RowColumnIndex CurrentRowColumnIndex { get; set; }
Property Value
| Type |
|---|
| RowColumnIndex |
SearchText
Get or set the text used to search the DataGrid.
Declaration
public string SearchText { get; set; }
Property Value
| Type |
|---|
| System.String |
SearchType
Gets or sets the that specifies how to compare cell values with the search text.
Declaration
public DataGridSearchType SearchType { get; set; }
Property Value
| Type |
|---|
| DataGridSearchType |
Methods
ApplySpan(DataColumnBase, Object, Boolean)
Declaration
protected virtual bool ApplySpan(DataColumnBase column, object data, bool ApplySearchHighlightBrush)
Parameters
| Type | Name | Description |
|---|---|---|
| Syncfusion.Maui.DataGrid.DataColumnBase | column | |
| System.Object | data | |
| System.Boolean | ApplySearchHighlightBrush |
Returns
| Type |
|---|
| System.Boolean |
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 |
|---|---|---|
| Syncfusion.Maui.DataGrid.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 |
|---|---|---|
| Syncfusion.Maui.DataGrid.DataRowBase | row | Specifies the corresponding DataRow. |
FilterRecords(Object)
Returns whether row match with search text to filter SfDataGrid based on search text.
Declaration
protected virtual bool FilterRecords(object dataRow)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | dataRow |
Returns
| Type |
|---|
| System.Boolean |
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 |
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 |
Returns
| Type |
|---|
| System.Boolean |
GetSearchRecords()
Search and returns the collection of GridSearchInfo.
Declaration
public List<DataGridSearchCellInfo> GetSearchRecords()
Returns
| Type |
|---|
| System.Collections.Generic.List<DataGridSearchCellInfo> |
MatchSearchText(DataGridColumn, Object)
Checks whether the cell display text with the SearchText.
Declaration
protected virtual bool MatchSearchText(DataGridColumn column, object record)
Parameters
| Type | Name | Description |
|---|---|---|
| DataGridColumn | column | Denotes the column being searched. |
| System.Object | record | Denotes the data object being searched |
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns true, if cell display text match with search text. Otherwise false. |
OnPropertyChanged(String)
Declaration
protected override void OnPropertyChanged(string propertyName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | propertyName |
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. |
SearchCell(DataColumnBase, Object, Boolean)
Declaration
protected virtual bool SearchCell(DataColumnBase column, object record, bool ApplySearchHighlightBrush)
Parameters
| Type | Name | Description |
|---|---|---|
| Syncfusion.Maui.DataGrid.DataColumnBase | column | |
| System.Object | record | |
| System.Boolean | ApplySearchHighlightBrush |
Returns
| Type |
|---|
| System.Boolean |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException |
SearchRow(DataRowBase)
Searches the cells in the row to match with the SearchText.
Declaration
protected virtual void SearchRow(DataRowBase row)
Parameters
| Type | Name | Description |
|---|---|---|
| Syncfusion.Maui.DataGrid.DataRowBase | row | Specifies the DataRow to search. |