Back to Devexpress

ItemsEditBase.DisplayMember Property

maui-devexpress-dot-maui-dot-editors-dot-itemseditbase-bc0c82b1.md

latest2.4 KB
Original Source

ItemsEditBase.DisplayMember Property

Gets or sets the name of a data source field whose values are displayed as drop-down list items. This is a bindable property.

Namespace : DevExpress.Maui.Editors

Assembly : DevExpress.Maui.Editors.dll

NuGet Package : DevExpress.Maui.Editors

Declaration

csharp
public string DisplayMember { get; set; }

Property Value

TypeDescription
String

The data source field name.

|

Example

The code below uses the DisplayMember property to specify the data source field that contains the data that should be displayed in the drop-down list.

xml
<dxe:AutoCompleteEdit DisplayMember="Name">
    <dxe:AutoCompleteEdit.ItemsSourceProvider>
        <dxe:AsyncItemsSourceProvider RequestDelay="500" SuggestionsRequested="OnDelegateRequested" />
    </dxe:AutoCompleteEdit.ItemsSourceProvider>
</dxe:AutoCompleteEdit>
cs
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.Maui.Controls;

namespace AutoCompleteEditExample {
    public partial class MainPage : ContentPage {
        public MainPage() {
            InitializeComponent();
            States = new List<State>();
            States.Add(new State() { Name = "California", Abbr = "CA", Capital = "Sacramento" });
            States.Add(new State() { Name = "Colorado", Abbr = "CO", Capital = "Denver" });
            States.Add(new State() { Name = "Connecticut", Abbr = "CT", Capital = "Hartford" });
            //...
        }
        public List<State> States { get; }
        void OnDelegateRequested(object sender, SuggestionsRequestEventArgs e) {
            e.Request = () => {
                return States.Where(i => i.Name.StartsWith(e.Text, StringComparison.CurrentCultureIgnoreCase)).ToList();
            };
        }
        public class State {
            public string Name { get; set; }
            public string Abbr { get; set; }
            public string Capital { get; set; }
        }
    }
}

See Also

ItemsEditBase Class

ItemsEditBase Members

DevExpress.Maui.Editors Namespace