Back to Devexpress

AutoCompleteColumn.DisplayMember Property

maui-devexpress-dot-maui-dot-datagrid-dot-autocompletecolumn-a39b64b4.md

latest3.0 KB
Original Source

AutoCompleteColumn.DisplayMember Property

Gets or sets the name of a data source field that contains values for the drop-down list. This is a bindable property.

Namespace : DevExpress.Maui.DataGrid

Assembly : DevExpress.Maui.DataGrid.dll

NuGet Package : DevExpress.Maui.DataGrid

Declaration

csharp
public string DisplayMember { get; set; }

Property Value

TypeDescription
String

The data source field name.

|

Example

The example below uses the AsyncItemsSourceProvider to supply suggestions for the AutoCompleteColumn. Use the DisplayMember property to specify the data field that contains values that should be displayed in the drop-down list.

xml
<dxg:DataGridView ItemsSource="{Binding Path=Employees}">
    <dxg:DataGridView.Columns>
        <dxg:AutoCompleteColumn FieldName="JobTitle"
                                DisplayName="Title">
            <dxg:AutoCompleteColumn.ItemsSourceProvider>    
                <dxe:AsyncItemsSourceProvider SuggestionsRequested="SuggestionsRequested"
                                              RequestDelay="500"
                                              CharacterCountThreshold="2"/>
            </dxg:AutoCompleteColumn.ItemsSourceProvider>                
        </dxg:AutoCompleteColumn>
    </dxg:DataGridView.Columns>
</dxg:DataGridView>
cs
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 SuggestionsRequested(object sender, SuggestionsRequestEventArgs e) {
            EmployeesRepository employeesRepository = BindingContext as EmployeesRepository;
            e.Request = () => {
                return employeesRepository.Jobs.Where(i => i.Title.StartsWith(e.Text, StringComparison.CurrentCultureIgnoreCase)).ToList();
            };
        }
    }
    public class EmployeesRepository {
        public IList<Employee> Employees { get; set; }
        public IList<Job> Jobs { get; set; }
    }
    public class Employee {
        public string JobTitle { get; set; }
    }
    public class Job {
        public int Id { get; set; }
        public string Title { get; set; }
    }
}

See Also

AutoCompleteColumn Class

AutoCompleteColumn Members

DevExpress.Maui.DataGrid Namespace