Class GridFindReplaceDialog
A find and replace dialog that can be used to search cells within a grid. The dialog communicates with the grid through the IGridFindReplaceDialogSink interface.
Inheritance
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridFindReplaceDialog : Form
Remarks
See the GridFindReplaceDialogSink for an example of how to enable find and replace support for a grid.
If you want to find and replace in the grid without displaying this dialog, you should instantiate a GridFindReplaceDialogSink object and call its Find(GridFindReplaceEventArgs) or Replace(GridFindReplaceEventArgs) \ method.
Properties
ActiveSink
Gets or sets the current target of find and replace operations.
Declaration
public IGridFindReplaceDialogSink ActiveSink { get; set; }
Property Value
Type |
---|
IGridFindReplaceDialogSink |
Instance
Gets an instance of the find replace dialog. Creates a single shared instance if necessary.
Declaration
public static GridFindReplaceDialog Instance { get; }
Property Value
Type |
---|
GridFindReplaceDialog |
Options
Gets or sets show or hide various dialog elements.
Declaration
public GridFindReplaceDialogOptions Options { get; set; }
Property Value
Type |
---|
GridFindReplaceDialogOptions |
ShowReplaceButton
Gets or sets a value indicating whether the "Replace" button should be visible. Set this false if you called SetState(IGridFindReplaceDialogSink, String, Boolean) to show dialog in find-only mode and do not want users to give a choice to switch to replace mode.
Declaration
public bool ShowReplaceButton { get; set; }
Property Value
Type |
---|
System.Boolean |
TextSearched
Gets or sets the text to be searched.
Declaration
public string TextSearched { get; set; }
Property Value
Type |
---|
System.String |
Methods
AddToSearchedList(String)
Adds the string to the search list of the find what combo box.
Declaration
public void AddToSearchedList(string str)
Parameters
Type | Name | Description |
---|---|---|
System.String | str | The search string to be added. |
Dispose(Boolean)
Releases all resources used by the System.ComponentModel.Component.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Remarks
See the documentation for the System.ComponentModel.Component class and its Dispose member.
FindNext()
Find Next occurrence of string.
Declaration
public void FindNext()
OnHandleDestroyed(EventArgs)
Used to handle the destroy functionality.
Declaration
protected override void OnHandleDestroyed(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The System.EventArgsthat contains event data. |
OnOptionsChanged(EventArgs)
Raises the OptionsChanged event.
Declaration
protected virtual void OnOptionsChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | The System.EventArgsthat contains event data. |
OnReachedStartingPoint(CancelEventArgs)
Raises the ReachedStartingPoint event.
Declaration
protected virtual void OnReachedStartingPoint(CancelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.CancelEventArgs | e | A System.ComponentModel.CancelEventArgs that contains the event data. |
OnTextNotFound(CancelEventArgs)
Raises the TextNotFound event.
Declaration
protected virtual void OnTextNotFound(CancelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.CancelEventArgs | e | A System.ComponentModel.CancelEventArgs that contains the event data. |
ResetFindLocation()
Gets or sets current selection in your current find and replace target control. For a grid, this should be a GridRangeInfo.
Declaration
public static void ResetFindLocation()
SetActiveSinkIfVisible(IGridFindReplaceDialogSink)
Register the current target of find and replace operations. Call this from your controls System.Windows.Forms.Control.Enter event handler.
Declaration
public static void SetActiveSinkIfVisible(IGridFindReplaceDialogSink sink)
Parameters
Type | Name | Description |
---|---|---|
IGridFindReplaceDialogSink | sink | The new target for find and replace operations. |
Remarks
The method checks if there is an active dialog displayed. Otherwise, the method will have no effect.
SetState(IGridFindReplaceDialogSink, String, Boolean)
Initializes the dialog.
Declaration
public void SetState(IGridFindReplaceDialogSink view, string str, bool bReplace)
Parameters
Type | Name | Description |
---|---|---|
IGridFindReplaceDialogSink | view | The target for find / replace operations. |
System.String | str | The text to be shown in find text box. |
System.Boolean | bReplace | Specifies if dialog should be shown in find-only or replace mode. |
Events
OptionsChanged
Occurs when the Options property has changed.
Declaration
public event EventHandler OptionsChanged
Event Type
Type |
---|
System.EventHandler |
ReachedStartingPoint
Occurs when the find operation reaches the starting point again.
Declaration
public event CancelEventHandler ReachedStartingPoint
Event Type
Type |
---|
System.ComponentModel.CancelEventHandler |
Remarks
Set e.Cancel = True if you do not want to display the default "reached starting point" message box or if you want to display a customized dialog.
TextNotFound
Occurs when the find text was not found.
Declaration
public event CancelEventHandler TextNotFound
Event Type
Type |
---|
System.ComponentModel.CancelEventHandler |
Remarks
Set e.Cancel = True if you do not want to display the default "not found" message box or if you want to display a customized dialog.