Skip to main content

SearchControl.ColumnProvider Property

Gets or sets the column provider for the search control. This is a dependency property.

Namespace: DevExpress.Xpf.Editors

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

NuGet Package: DevExpress.Wpf.Core

Declaration

public ISearchPanelColumnProviderBase ColumnProvider { get; set; }

Property Value

Type Description
DevExpress.Xpf.Editors.ISearchPanelColumnProviderBase

An object implementing the DevExpress.Xpf.Editors.ISearchPanelColumnProviderBase interface.

Remarks

If the ColumnProvider property is not defined, the filter criteria has the following format: “StartsWith([], ‘<text>’)”.

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:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        Title="MainWindow" Height="350" Width="525">
    <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>
using System.Windows;

namespace ListBoxFilteringUsingSearchPanel {
    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
            listBox.ItemsSource = Staff.GetStaff();
        }
    }
}
See Also