Built-in Cell Types

Cells in ReoGrid can keep a cell body, a cell body is must inherited from CellBody or is implemented from ICellBody interface. More about cell body, see Custom Cell.

ReoGrid provides the these built-in cell body types:
  • Button
  • Hyperlink
  • Check Box
  • Radio Button
  • Drop-down list
  • Image
  • Numeric Progress
To use built-in cell types, the below namespace is necessary.
using unvell.ReoGrid.CellTypes;


Button has an event called 'Click', it fired when user clicked inside button cell.
grid[1,2] = new ButtonCell("Hello");

Cell body always uses cell's data as its label, so the following is also available:
grid[1,2] = new ButtonCell();
grid[1,2] = "Hello";


Hyperlink uses cell's data as its navigate URL.
grid[1,2] = new HyperlinkCell("http://www.google.com");
grid[1,2] = new HyperlinkCell();
grid[1,2] = "http://www.google.com";

Check Box

A check box of cell body uses only one cell, to put a label around the check box, it is needed to use another cell like this :
// add check box with a label
grid[1,2] = new object[] { new CheckBoxCell(), "Auto destroy after 5 minutes." };


Same as check box, radio also uses one cell.
RadioCell added into RadioGroup or specify its RadioGroup property will make them toggle each other automatically.
var radioGroup = new RadioButtonGroup();
grid[10, 2] = new object[,] {
  {new RadioButtonCell() { RadioGroup = radioGroup }, "Apple"},
  {new RadioButtonCell() { RadioGroup = radioGroup }, "Orange"},
  {new RadioButtonCell() { RadioGroup = radioGroup }, "Banana"}

Drop-down List

Drop-down list will update the cell's data, when list item has been selected.
var dropdown = new DropdownCell(new object[] { "Apple", "Orange", "Banana", "Pear", 
  "Pumpkin", "Cherry", "Coconut" });
grid[15, 2] = dropdown;
Since dropdown will update data of cell, to get selected item by CellDataChanged event:
grid.CellDataChanged += (s, e) => { ... };


var image = Image.FromFile("...");
grid[2, 6] = new ImageCell(image);

ImageCell has a property named ViewMode which is used to decided how to show the image inside a cell:
// create ImageCell by specifying the view-mode
var imgCell = new ImageCell(img, ImageCellViewMode.Zoom);
grid["F6"] = imgCell;

// or change the property directly
imgCell.ViewMode = ImageCellViewMode.Clip;

And it is possible to change the image position by setting horizontal/vertical alignment for cell:
var cell = grid.Cells["F6"];
cell.Style.HAlign = ReoGridHorAlign.Center;
cell.Style.VAlign = ReoGridVerAlign.Middle;

Adjusting size for cell body

Size of cell-body is decided by its cell and a padding style, it is possible to make a body more larger by merging several cells.

Next: Pick range

Last edited May 26, 2014 at 8:30 AM by unvell, version 16