Class TreeGridSearchController
Provides the implementation for searching the records in a SfTreeGrid control.
Namespace: Syncfusion.Maui.TreeGrid
Assembly: Syncfusion.Maui.TreeGrid.dll
Syntax
public class TreeGridSearchController : BindableObject
Constructors
TreeGridSearchController(SfTreeGrid)
Initializes a new instance of the TreeGridSearchController class for the given SfTreeGrid.
Declaration
public TreeGridSearchController(SfTreeGrid treeGrid)
Parameters
| Type | Name | Description |
|---|---|---|
| SfTreeGrid | treeGrid | The SfTreeGrid instance on which searching is applied. |
Fields
AllowCaseSensitiveProperty
Bindable property for AllowCaseSensitive
Declaration
public static readonly BindableProperty AllowCaseSensitiveProperty
Field Value
| Type |
|---|
| BindableProperty |
AllowFilteringProperty
Bindable property for AllowFiltering
Declaration
public static readonly BindableProperty AllowFilteringProperty
Field Value
| Type |
|---|
| BindableProperty |
CanHighlightSearchTextProperty
Bindable property for CanHighlightSearchText
Declaration
public static readonly BindableProperty CanHighlightSearchTextProperty
Field Value
| Type |
|---|
| BindableProperty |
SearchScopeProperty
Bindable property for SearchScope
Declaration
public static readonly BindableProperty SearchScopeProperty
Field Value
| Type |
|---|
| BindableProperty |
SearchTextProperty
Bindable property for SearchText
Declaration
public static readonly BindableProperty SearchTextProperty
Field Value
| Type |
|---|
| BindableProperty |
SearchTypeProperty
Bindable property for SearchType
Declaration
public static readonly BindableProperty SearchTypeProperty
Field Value
| Type |
|---|
| BindableProperty |
treeGrid
The SfTreeGrid instance to which the searching is applied.
Declaration
protected readonly SfTreeGrid? treeGrid
Field Value
| Type |
|---|
| SfTreeGrid |
Properties
AllowCaseSensitive
Gets or sets a value that enables case-sensitive string comparison during search in SfTreeGrid.
Declaration
public bool AllowCaseSensitive { get; set; }
Property Value
| Type |
|---|
| bool |
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 |
|---|
| bool |
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 |
|---|
| bool |
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 |
SearchScope
Gets or sets the value that specifies the scope in which the search is applied in SfTreeGrid.
Declaration
public TreeGridSearchScope SearchScope { get; set; }
Property Value
| Type |
|---|
| TreeGridSearchScope |
Remarks
Both applies the search to both the root nodes and the child nodes, RootNodes applies the search only to the root nodes, and ChildNodes applies the search only to the child nodes.
SearchText
Get or set the text used to search the TreeGrid.
Declaration
public string SearchText { get; set; }
Property Value
| Type |
|---|
| string |
SearchType
Gets or sets the that specifies how to compare cell values with the search text.
Declaration
public TreeGridSearchType SearchType { get; set; }
Property Value
| Type |
|---|
| TreeGridSearchType |
Methods
ApplySpan(TreeGridDataColumnBase, object?, bool, SfTreeGridLabel)
Applies the formatted string with highlighted spans on the cell label.
Declaration
protected virtual bool ApplySpan(TreeGridDataColumnBase column, object? data, bool applySearchHighlightBrush, SfTreeGridLabel label)
Parameters
| Type | Name | Description |
|---|---|---|
| TreeGridDataColumnBase | column | The column containing the cell. |
| object | data | The formatted cell value. |
| bool | applySearchHighlightBrush | Indicates whether the current-result highlight brush must be applied. |
| SfTreeGridLabel | label | The cell label on which the highlight is applied. |
Returns
| Type | Description |
|---|---|
| bool |
|
ClearSearch()
Clears the text highlighting in the searched cells of SfTreeGrid.
Declaration
public virtual void ClearSearch()
ClearSearchCell(TreeGridDataColumnBase, object?)
Clears the highlighting in the specified cell.
Declaration
protected virtual void ClearSearchCell(TreeGridDataColumnBase column, object? record)
Parameters
| Type | Name | Description |
|---|---|---|
| TreeGridDataColumnBase | column | Denotes the column associated with the cell. |
| object | record | Denotes the data object associated with the cell. |
ClearSearchRow(TreeGridDataRowBase)
Clears the highlighting in the searched cells of the given row.
Declaration
protected virtual void ClearSearchRow(TreeGridDataRowBase row)
Parameters
| Type | Name | Description |
|---|---|---|
| TreeGridDataRowBase | row | Specifies the corresponding row. |
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 |
|---|---|---|
| string | text | The text to search for. |
Returns
| Type | Description |
|---|---|
| bool |
|
FindPrevious(string)
Finds and highlights, the previous cell match with search text and updates CurrentRowColumnIndex.
Declaration
public virtual bool FindPrevious(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text to search for. |
Returns
| Type | Description |
|---|---|
| bool |
|
GetSearchRecords()
Search and returns the collection of TreeGridSearchCellInfo.
Declaration
public List<TreeGridSearchCellInfo> GetSearchRecords()
Returns
| Type | Description |
|---|---|
| List<TreeGridSearchCellInfo> | The list of TreeGridSearchCellInfo instances holding the matching records and their columns. |
OnPropertyChanged(string)
Called when a property on the bindable object changes.
Declaration
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "The NotifyPropertyChanged method is not trim compatible")]
protected override void OnPropertyChanged(string propertyName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | propertyName | The name of the changed property. |
Search(string)
Initiates the Search operation in SfTreeGrid based on passed text.
Declaration
public virtual void Search(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Specifies the text to be searched. |
SearchCell(TreeGridDataColumnBase, object?, bool)
Searches the cell to match with the SearchText and applies the highlight when it matches.
Declaration
protected virtual bool SearchCell(TreeGridDataColumnBase column, object? record, bool applySearchHighlightBrush)
Parameters
| Type | Name | Description |
|---|---|---|
| TreeGridDataColumnBase | column | The column that is searched. |
| object | record | The record of the cell. |
| bool | applySearchHighlightBrush | Indicates whether the current-result highlight brush must be applied. |
Returns
| Type | Description |
|---|---|
| bool |
|
SearchRow(TreeGridDataRowBase)
Searches the cells in the row to match with the SearchText.
Declaration
protected virtual void SearchRow(TreeGridDataRowBase row)
Parameters
| Type | Name | Description |
|---|---|---|
| TreeGridDataRowBase | row | Specifies the TreeGridDataRowBase to search. |