Back to Devexpress

How to: Assign an editor to a column

windowsforms-5635-controls-and-libraries-tree-list-examples-data-editing-how-to-assign-an-editor-to-a-column.md

latest1.6 KB
Original Source

How to: Assign an editor to a column

  • Nov 13, 2018

The following example demonstrates how to create and adjust a new in-place editor (ComboBoxEdit). The editor is bound to the “Location” column using the TreeListColumn.ColumnEdit property.

The screenshot below demonstrates the result of the code’s execution

csharp
using DevExpress.XtraEditors.Repository;

//Create a repository item corresponding to a combo box editor.
RepositoryItemComboBox riCombo = new RepositoryItemComboBox();
riCombo.Items.AddRange(new string[] {"San Francisco", "Monterey", "Toronto", "Boston", "Kuaui", "Singapore", "Tokyo"});
//Add the item to the internal repository
treeList1.RepositoryItems.Add(riCombo);
//Now you can define the repository item as an in-place column editor
columnLocation.ColumnEdit = riCombo;
vb
Imports DevExpress.XtraEditors.Repository
' ...
'Create a repository item corresponding to a combo box editor.
Dim riCombo As RepositoryItemComboBox = New RepositoryItemComboBox
riCombo.Items.AddRange(New String() {"San Francisco", "Monterey", "Toronto", "Boston", "Kuaui", "Singapore", "Tokyo"})
'Add the item to the internal repository
TreeList1.RepositoryItems.Add(riCombo)
'Now you can define the repository item as an in-place column editor
columnLocation.ColumnEdit = riCombo