maui-devexpress-dot-maui-dot-datagrid-dot-pickercolumn-8fcc238c.md
Gets or sets the name of a data field that contains values actually assigned to cells. This is a bindable property.
Namespace : DevExpress.Maui.DataGrid
Assembly : DevExpress.Maui.DataGrid.dll
NuGet Package : DevExpress.Maui.DataGrid
public string ValueMember { get; set; }
| Type | Description |
|---|---|
| String |
The data source field name.
|
The ItemsSource collection contains values that users can select in the drop-down list. If this collection contains business objects, use the following properties to describe the business object’s data fields:
ValueMember — specifies the data field that contains values that are actually assigned to cells.In the example below, the ComboBoxColumn is bound to a data field that contains integer values. To display strings instead of integers in the drop-down list, the example uses a business object that combines strings with integers. The DisplayMember and ValueMember properties specify data fields that contain displayed strings and actual integer values.
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:dxg="clr-namespace:DevExpress.Maui.DataGrid;assembly=DevExpress.Maui.DataGrid">
<dxg:DataGridView x:Name="dataGridView"
ItemsSource="{Binding Path=Employees}"
EditorShowMode="Tap">
<dxg:DataGridView.Columns>
<!-- Other columns here. -->
<dxg:ComboBoxColumn FieldName="Job"
ItemsSource="{Binding Jobs}"
DisplayMember="Title"
ValueMember="Id"
IsEditorFilterEnabled="True">
</dxg:ComboBoxColumn>
<!-- Other columns here. -->
</dxg:DataGridView.Columns>
</dxg:DataGridView>
</ContentPage>
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.Maui.Controls;
public partial class EditingView : ContentPage {
public EditingView() {
InitializeComponent();
BindingContext = new Repository(300);
}
}
public class Repository {
public ObservableCollection<Employee> Employees { get; private set; }
public ObservableCollection<Job> Jobs { get; private set; }
public Repository(int rowsCount) {
Employees = new ObservableCollection<Employees>();
Jobs = new ObservableCollection<Job>();
for (int i = 0; i < rowsCount; i++) {
Employees.Add(new Employee());
Jobs.Add(new Job());
}
}
}
public class Employee {
public string FullName { get; set; }
public int Job { get; set; }
}
public class Job {
public int Id { get; set; }
public string Title { get; set; }
}
See Also