GridView.CustomizationFormSearch Event
Allows you to filter search results when a user searches in the Customization Form.
Namespace: DevExpress.XtraGrid.Views.Grid
Assembly: DevExpress.XtraGrid.v24.1.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
Declaration
[DXCategory("Action")]
public event CustomizationFormSearchEventHandler CustomizationFormSearch
Event Data
The CustomizationFormSearch event's data class is CustomizationFormSearchEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Band | Gets the currently processed band. Returns null if the CustomizationFormSearch event is fired for a column. |
Caption | Gets the caption of the currently processed column or band. |
Column | Gets the currently processed column. Returns null if the CustomizationFormSearch event is fired for a band. |
OwnerBand | Gets the band that owns the current column or band. Returns null if there is no band for the current column/band. |
OwnerBandCaption | Gets the caption of the OwnerBand object. Returns an empty string if the OwnerBand object is null. |
SearchText | Gets the search string. |
Visible | Gets or sets the visibility of the currently processed column or band. |
Remarks
The Customization Form‘s search box allows users to locate columns and bands by their captions.
The default search algorithm locates columns/bands that contain the search string in their display captions. If a banded grid column matches the search string, it is displayed along with its owner band.
Handle the CustomizationFormSearch event to change the search logic. This event fires for each item (column or band) displayed in the Customization Form on each change to the search text.
Example
The following example handles the CustomizationFormSearch event to show a band’s children in the Customization Form when this band matches the search string.
void CustomizationFormSearch(object sender, CustomizationFormSearchEventArgs e) {
if(e.OwnerBandCaption.Contains(e.SearchText))
e.Visible = true;
}
Note
The Data Grid silently suppresses any exception raised in your CustomizationFormSearch event handler.