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
public string DisplayMember { get; set; }
Property Value
Type | Description |
---|---|
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.
<dxe:AutoCompleteEdit DisplayMember="Name">
<dxe:AutoCompleteEdit.ItemsSourceProvider>
<dxe:AsyncItemsSourceProvider RequestDelay="500" SuggestionsRequested="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<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