Skip to main content

AsyncItemsSourceProvider Class

A data provider that supplies suggestions for the AutoCompleteEdit and AutoCompleteColumn in async mode.

Namespace: DevExpress.XamarinForms.Editors

Assembly: DevExpress.XamarinForms.Editors.dll

NuGet Package: DevExpress.XamarinForms.Editors

Declaration

public class AsyncItemsSourceProvider :
    ItemsSourceProviderBase

Remarks

Attach the AsyncItemsSourceProvider to the editor and handle its SuggestionsRequested event. Use the Request event argument to specify the method that returns suggestions. The provider assigns the returned collection to the ItemsSource property. To get the text entered in the edit box 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.

Examples

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

<dxe:AutoCompleteEdit
    LabelText="State"
    PlaceholderText="Type here to search..."
    VerticalOptions="Center"
    Margin="16,0">

    <dxe:AutoCompleteEdit.ItemsSourceProvider>
        <dxe:AsyncItemsSourceProvider SuggestionsRequested="OnDelegateRequested" />
    </dxe:AutoCompleteEdit.ItemsSourceProvider>
</dxe:AutoCompleteEdit>

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>

Inheritance

Object
ItemsSourceProviderBase
AsyncItemsSourceProvider
See Also