Hi David,
Please find next an example for your scenario:
GridControl gridControl = new GridControl();
gridControl.FixedHeaderRows.Add( new ColumnManagerRow() );
gridControl.Dock = DockStyle.Fill;
Column column1 = new Column( “Column1”, typeof( string ) );
gridControl.Columns.Add( column1 );
gridControl.DataRowTemplate.FitHeightToEditors = true;
this.Controls.Add( gridControl );
for( int i = 0; i < 10; i++ )
{
Xceed.Grid.DataRow dataRow = gridControl.DataRows.AddNew();
dataRow.Cells[ 0 ].Value = “Test #1”;
dataRow.EndEdit();
}
WinComboBox templateComboBox = new WinComboBox();
templateComboBox.Items.Add( “Test #1” );
templateComboBox.Items.Add( “Test #2” );
templateComboBox.Items.Add( “Test #3” );
templateComboBox.Items.Add( “Test #4” );
templateComboBox.Items.Add( “Test #5” );
ComboBoxEditor comboEditor = new ComboBoxEditor( templateComboBox );
column1.CellEditorManager = comboEditor;
You should also handle the SettingControlValueCore event and chose the default value on your comboBox if the cell’s value does not match any of its items.
Imported from legacy forums. Posted by Mohamed [Xceed] (had 357 views)