Home Forums WinForms controls Xceed Grid for WinForms displaying enum in grid Reply To: displaying enum in grid

User (Old forums)
Member
Post count: 23064

This will work:

public enum Example : int
{
A = 1,
B = 2
}

Xceed.Grid.Editors.GridComboBox status_comboEditor =
new Xceed.Grid.Editors.GridComboBox();

Xceed.Grid.Editors.GridComboBox status_comboViewer = new Xceed.Grid.Editors.GridComboBox();

ArrayList refTypeAL = new ArrayList();
refTypeAL.Add(new DictionaryEntry(Example.A, “A”));
refTypeAL.Add(new DictionaryEntry(Example.B, “B”));

status_comboEditor.DataSource = refTypeAL;
status_comboEditor.ValueMember = “Key”;
status_comboEditor.DisplayMember = “Value”;
status_comboEditor.DropDownWidth = 400;
status_comboEditor.TabStop = false;

status_comboViewer.DataSource = refTypeAL;
status_comboViewer.ValueMember = “Key”;
status_comboViewer.DisplayMember = “Value”;
status_comboViewer.DropDownWidth = 400;
status_comboViewer.TabStop = false;

this.grid1.gridControl1.Controls.Add(status_comboViewer);
status_comboViewer.Location = new System.Drawing.Point(-1000,-1000);

this.grid1.gridControl1.Columns[ “Status” ].CellEditor = status_comboEditor;
this.grid1.gridControl1.Columns[ “Status” ].CellViewer = new ControlViewer( status_comboViewer, “SelectedValue” );

Imported from legacy forums. Posted by C# (had 400 views)