Back to Devexpress

FilteredItemsSourceProvider.ItemsSource Property

maui-devexpress-dot-maui-dot-editors-dot-filtereditemssourceprovider.md

latest3.0 KB
Original Source

FilteredItemsSourceProvider.ItemsSource Property

Gets or sets the collection of items to be filtered. This is a bindable property.

Namespace : DevExpress.Maui.Editors

Assembly : DevExpress.Maui.Editors.dll

NuGet Package : DevExpress.Maui.Editors

Declaration

csharp
public IEnumerable ItemsSource { get; set; }

Property Value

TypeDescription
IEnumerable

An object that contains data items.

|

Example

The following example populates the AutoCompleteTokenEdit‘s drop-down list with filtered items. This example uses the ItemsEditBase.DisplayMember property to obtain the display text for items:

xaml
<dxe:AutoCompleteTokenEdit x:Name="autoCompleteTokenEdit" DisplayMember="Name">
    <dxe:AutoCompleteTokenEdit.BindingContext>
        <local:AutoCompleteTokenEditViewModel/>
    </dxe:AutoCompleteTokenEdit.BindingContext>
    <dxe:AutoCompleteTokenEdit.ItemsSourceProvider>
        <dxe:FilteredItemsSourceProvider ItemsSource="{Binding ItemsSource}"
                                         FilterCondition="Contains"
                                         FilterComparisonType="CurrentCultureIgnoreCase"
                                         FilterMembers="Name, Capital"/>
    </dxe:AutoCompleteTokenEdit.ItemsSourceProvider>
</dxe:AutoCompleteTokenEdit>
csharp
public class State {
    public string Name { get; set; }
    public string Abbr { get; set; }
    public string Capital { get; set; }
}

public class AutoCompleteTokenEditViewModel : INotifyPropertyChanged {
    ObservableCollection<State> itemsSource = new ObservableCollection<State>();
    public ObservableCollection<State> ItemsSource { get { return itemsSource; } set { itemsSource = value; OnPropertyChanged(nameof(ItemsSource)); } }
    public AutoCompleteTokenEditViewModel() {
        ItemsSource.Add(new State() { Name = "California", Abbr = "CA", Capital = "Sacramento" });
        ItemsSource.Add(new State() { Name = "Colorado", Abbr = "CO", Capital = "Denver" });
        ItemsSource.Add(new State() { Name = "Connecticut", Abbr = "CT", Capital = "Hartford" });
    }
    public event PropertyChangedEventHandler PropertyChanged;
    protected void OnPropertyChanged(string propertyName) {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }
}

See Also

FilteredItemsSourceProvider Class

FilteredItemsSourceProvider Members

DevExpress.Maui.Editors Namespace