BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
class ComboCellModel : GridComboBoxCellModel
{
public ComboCellModel(GridModel grid)
: base(grid)
{
//Set the size of the button bar.
ButtonBarSize = new System.Drawing.Size(30, 15);
}
public override GridCellRendererBase CreateRenderer(GridControlBase control)
{
return new ComboCellRenderer(control, this);
}
}
class ComboCellRenderer : GridComboBoxCellRenderer
{
GridCellButton button;
public ComboCellRenderer(GridControlBase control, GridCellModelBase model)
: base(control, model)
{
button = new GridCellButton(this);
//Add the button to the comboBox cell
this.AddButton(button);
}
}
//In FormLoad
//Register the custom CellModel
this.gridControl1.Model.CellModels.Add("ComboBoxButtonEditCell", new ComboCellModel(this.gridControl1.Model));
//Setting the CellType
this.gridControl1[2, 3].CellType = "ComboBoxButtonEditCell";
Sample: http://www.syncfusion.com/downloads/support/forum/120486/ze/CS1040098417
Also, refer to the following dashboard sample, which shows how to have the custom cell types in the GridControl.
Dashboard Sample Location:
<InstalledLocation>\Syncfusion\EssentialStudio\<VersionNo>\Windows\Grid.Windows\Samples\Custom Cell Types\Interactive Cell Demo\CS
Regards,
Adhi
//Get the ComboCellRenderer
ComboCellRenderer renderer = gridControl1.GetCellRenderer(2, 3) as ComboCellRenderer;
//Invoke the button clicked event
renderer.button.Clicked += button_Clicked;
void button_Clicked(object sender, GridCellEventArgs e)
{
MessageBox.Show(String.Format("Pressed Button at ({0},{1})", e.RowIndex, e.ColIndex));
}
Sample: http://www.syncfusion.com/downloads/support/forum/120486/ze/ButtonClicked409237133
Regards,
Adhi