InteractiveCell Demo illustrates the usage of different controls as celltypes in grid cells. You will learn how to place linklabels, slider, Button edit control into cells.
Given below is an image of the sample.
CellButtons
In general, a custom cell type requires a Model class and a Renderer class. The Model class handles the serialization requirements for the control and creates the Renderer class. The Renderer class handles the UI requirements of the cell, such as drawing and handling mouse actions. The cell button seen in this grid is a custom-cell type.
Link Label Cells
This custom cell type runs the iexplore.exe file in the overridden OnMouseUp handler. The arguments are set by getting the string that is stored in the GridStyleInfo.Tag property.
By overriding the OnMouseHoverEnter, OnMouseHoverLeave, and the OnDraw events, the link label is highlighted when hovering with the mouse pointer.
Slider Cells
A custom slider cell is used to display a Slider control in the cell.
SliderCellModel, and SliderCellRenderer classes are derived from GridGenericControlCellModel and GridGenericControlCellRenderer classes.
Two Windows Forms track bars are used by the cell renderer class - One for static drawing, and the other as an active current cell control.
You can view either the active control or the control that is used for the static drawing, which is assigned to GridStyleInfo.Control in the SliderCellRenderer.OnDraw overridden method.
In the SliderStyleProperties class, Minimum, Maximum, SmallChange, LargeChange, TickFrequency, TickStyle, and Orientation are the newly added style properties.
Button Edit Cell Demo
ButtonEditCellButton class is derived from the GridCellButton class, which is used to draw buttons in grid cells
ButtonEditStyleProperties class can be accessed to supply necessary style settings for Button controls
ButtonEditCellButton class will let you create different Button controls such as buttons with images, buttons painted with colors, button faces with text, and buttons with borders.
Apart from these classes, this sample also includes a Cell Model and Cell Renderer class, which can be used to create a custom cell type.