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

Button has an event called 'Click', it fired when user clicked inside button cell.
p01.png
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

Hyperlink uses cell's data as its navigate URL.
p02.png
grid[1,2] = new HyperlinkCell("http://www.google.com");
or
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 :
p03.png
// add check box with a label
grid[1,2] = new object[] { new CheckBoxCell(), "Auto destroy after 5 minutes." };

Radio

Same as check box, radio also uses one cell.
p04.png
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

p05.png
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) => { ... };

Image

p07.png
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 9:30 AM by unvell, version 16