Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

AutoCompleteEditBase.ItemsSourceProvider Property

Gets or sets the data provider that supplies items. This is a bindable property.

Namespace: DevExpress.Maui.Editors

Assembly: DevExpress.Maui.Editors.dll

NuGet Package: DevExpress.Maui.Editors

#Declaration

C#
public ItemsSourceProviderBase ItemsSourceProvider { get; set; }

#Property Value

Type Description
ItemsSourceProviderBase

A data provider that populates the editor drop-down list of items.

#Examples

#Populate an AutoCompleteEdit with Items Asynchronously

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 ItemsRequested="OnDelegateRequested" />
    </dxe:AutoCompleteEdit.ItemsSourceProvider>
</dxe:AutoCompleteEdit>
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.Maui.Controls;

namespace AutoCompleteEditExample {
    public partial class MainPage : ContentPage {
        public MainPage() {
            InitializeComponent();
            States = new List<string>();
            States.AddRange(new string[] { "California", "Colorado", "Connecticut" /*...*/ });
        }
        public List<string> States { get; }
        void OnDelegateRequested(object sender, ItemsRequestEventArgs e) {
            e.Request = () => {
                return States.Where(i => i.StartsWith(e.Text, StringComparison.CurrentCultureIgnoreCase)).ToList();
            };
        }
    }
}

#Populate an AutoCompleteColumn with Items Asynchronously

The example below uses the AsyncItemsSourceProvider to supply items for the AutoCompleteColumn:

<dxg:DataGridView ItemsSource="{Binding Path=Employees}">
    <dxg:DataGridView.Columns>
        <dxg:AutoCompleteColumn FieldName="JobTitle">
            <dxg:AutoCompleteColumn.ItemsSourceProvider>
                <dxe:AsyncItemsSourceProvider ItemsRequested="ItemsRequested"
                                              RequestDelay="500"
                                              CharacterCountThreshold="2"/>
            </dxg:AutoCompleteColumn.ItemsSourceProvider>                
        </dxg:AutoCompleteColumn>
    </dxg:DataGridView.Columns>
</dxg:DataGridView>
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.Maui.Controls;

namespace DemoCenter.Forms.Views {
    public partial class FirstLookView : ContentPage {
        public FirstLookView() {
            InitializeComponent();
            BindingContext = new EmployeesRepository();
        }

        private void ItemsRequested(object sender, ItemsRequestEventArgs e) {
            EmployeesRepository employeesRepository = BindingContext as EmployeesRepository;
            e.Request = () => {
                return employeesRepository.JobTitles.Where(i => i.StartsWith(e.Text, StringComparison.CurrentCultureIgnoreCase)).ToList();
            };
        }
    }
    public class EmployeesRepository {
        public IList<Employee> Employees { get; set; }
        public IList<string> JobTitles { get; set; }
    }
    public class Employee {
        public string JobTitle { get; set; }
    }
}
See Also