Skip to main content

AutoCompleteColumn.ItemsSourceProvider Property

Gets or sets the data provider that supplies suggestions.

Namespace: DevExpress.XamarinForms.DataGrid

Assembly: DevExpress.XamarinForms.Grid.dll

NuGet Package: DevExpress.XamarinForms.Grid

Declaration

public ItemsSourceProviderBase ItemsSourceProvider { get; set; }

Property Value

Type Description
ItemsSourceProviderBase

A data provider that supplies suggestions.

Remarks

Asynchronous Data Provider

Attach the AsyncItemsSourceProvider to the column and handle its SuggestionsRequested event. Use the Request event argument to specify the method that returns suggestions. To get the text entered in the cell and pass it to the specified method, use the Text event argument.

You can also specify the following options:

  • RequestDelay — the time that should elapse after the text is changed and the request is called. Use this parameter to reduce the number of requests as a user types.
  • CharacterCountThreshold — the number of entered characters after which the provider starts to make requests. For example, the provider can make requests only if a user enters at least three characters.

The provider cancels the previous request if a new request is submitted. You can use the CancellationToken event argument to cancel the previous request.

Synchronous Data Provider

The FilteredItemsSourceProvider filters an existing collection based on filter settings. Use the SuggestionsSource property to specify the collection of suggestions. The following properties specify how the provider searches for suggestions in the collection:

  • FilterMode — whether suggestions should start with or contain the entered text.
  • FilterComparisonType — culture and case rules used to compare the entered text with suggestions.
  • FilterMembers — data fields in which to search.

Examples

The example below uses the AsyncItemsSourceProvider to supply suggestions for the AutoCompleteColumn.

<dxg:DataGridView ItemsSource="{Binding Path=Employees}">
    <dxg:DataGridView.Columns>
        <dxg:AutoCompleteColumn FieldName="JobTitle">
            <dxg:AutoCompleteColumn.ItemsSourceProvider>
                <dxe:AsyncItemsSourceProvider SuggestionsRequested="SuggestionsRequested"
                                              RequestDelay="500"
                                              CharacterCountThreshold="2"/>
            </dxg:AutoCompleteColumn.ItemsSourceProvider>                
        </dxg:AutoCompleteColumn>
    </dxg:DataGridView.Columns>
</dxg:DataGridView>

The example below uses the FilteredItemsSourceProvider to supply suggestions for the AutoCompleteColumn.

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:dxe="http://schemas.devexpress.com/xamarin/2014/forms/editors"
             xmlns:dxg="http://schemas.devexpress.com/xamarin/2014/forms/datagrid"
             xmlns:scg="clr-namespace:System.Collections.Generic;assembly=netstandard">
    <ContentPage.Content>
        <dxg:DataGridView ItemsSource="{Binding Path=Employees}">
            <dxg:DataGridView.Columns>
                <dxg:AutoCompleteColumn FieldName="JobTitle">
                    <dxg:AutoCompleteColumn.ItemsSourceProvider>
                        <dxe:FilteredItemsSourceProvider FilterMode="Contains"
                                                         FilterComparisonType="CurrentCultureIgnoreCase">
                            <dxe:FilteredItemsSourceProvider.SuggestionsSource>
                                <scg:List x:TypeArguments="x:String">
                                    <x:String>Chief Executive Officer</x:String>
                                    <x:String>Network Administrator</x:String>
                                </scg:List>
                            </dxe:FilteredItemsSourceProvider.SuggestionsSource>
                        </dxe:FilteredItemsSourceProvider>
                    </dxg:AutoCompleteColumn.ItemsSourceProvider>                
                </dxg:AutoCompleteColumn>
            </dxg:DataGridView.Columns>
        </dxg:DataGridView>
    </ContentPage.Content>
</ContentPage>
See Also