Back to Devexpress

GridView.CustomizationFormSearch Event

windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-gridview-8400127e.md

latest4.7 KB
Original Source

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.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Action")]
public event CustomizationFormSearchEventHandler CustomizationFormSearch
vb
<DXCategory("Action")>
Public Event CustomizationFormSearch As CustomizationFormSearchEventHandler

Event Data

The CustomizationFormSearch event's data class is CustomizationFormSearchEventArgs. The following properties provide information specific to this event:

PropertyDescription
BandGets the currently processed band. Returns null if the CustomizationFormSearch event is fired for a column.
CaptionGets the caption of the currently processed column or band.
ColumnGets the currently processed column. Returns null if the CustomizationFormSearch event is fired for a band.
OwnerBandGets the band that owns the current column or band. Returns null if there is no band for the current column/band.
OwnerBandCaptionGets the caption of the OwnerBand object. Returns an empty string if the OwnerBand object is null.
SearchTextGets the search string.
VisibleGets 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.

csharp
void CustomizationFormSearch(object sender, CustomizationFormSearchEventArgs e) {
    if(e.OwnerBandCaption.Contains(e.SearchText))
        e.Visible = true;
}
vb
Private Sub GridView1_CustomizationFormSearch(sender As Object, e As DevExpress.XtraGrid.Views.Grid.CustomizationFormSearchEventArgs) Handles GridView1.CustomizationFormSearch
    If e.OwnerBandCaption.Contains(e.SearchText) Then
        e.Visible = True
    End If
End Sub

Note

The Data Grid silently suppresses any exception raised in your CustomizationFormSearch event handler.

See Also

UseAdvancedCustomizationForm

CustomizationFormSearchBoxVisible

GridView Class

GridView Members

DevExpress.XtraGrid.Views.Grid Namespace