Skip to main content
A newer version of this page is available. .

SearchControl Class

A search control.

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v18.2.dll

Declaration

public class SearchControl :
    Control

The following members return SearchControl objects:

Remarks

A Search Control delivers an easy and straightforward way for end-users to locate information within data editors (list boxes, combo boxes, etc). To execute a search, enter the text in the Find box and data editors linked to the Search Control will display those records that have matching values.

Various options are available to control the display and behavior of the Search Control. You can specify search columns, choose between automatic and manual search modes, optionally display control buttons, etc.

Example

This example shows how to use the SearchControl to locate required items displayed within a list box. To execute a search, enter a text within the Find box, and the list box linked to the Search Control will display those records that have matching values.

<Window x:Class="ListBoxFilteringUsingSearchPanel.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <dxe:SearchControl x:Name="searchControl" Grid.Row="0" Margin="10"
                           HorizontalAlignment="Stretch" VerticalAlignment="Center"
                           FilterCondition="Contains"
                           FilterByColumnsMode="Custom"
                           >
            <dxe:SearchControl.ColumnProvider>
                <dxe:SelectorEditColumnProvider>
                    <dxe:SelectorEditColumnProvider.CustomColumns>
                        <sys:String>Name</sys:String>
                    </dxe:SelectorEditColumnProvider.CustomColumns>
                </dxe:SelectorEditColumnProvider>
            </dxe:SearchControl.ColumnProvider>
        </dxe:SearchControl>

        <dxe:ListBoxEdit Name="listBox" Grid.Row="1"  Margin="10"
                         HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                         DisplayMember="Name" ValueMember="ID"
                         FilterCriteria="{Binding FilterCriteria, ElementName=searchControl}">

        </dxe:ListBoxEdit>
    </Grid>
</Window>

The following code snippets (auto-collected from DevExpress Examples) contain references to the SearchControl class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also