The Cell class as well as all the classes that derive from the Cell class can be derived from to create custom cell classes. Theses classes can then be used as normal to populate custom row classes. For example, the DataCell class derives from the Cell class and is used to populate DataRows which derive from the CellRow class.
When creating a class that derives from the Cell class or one of its derived classes, the following minimum functions must be implemented:
A protected constructor that receives an instance of the derived class as a parameter.
A public constructor that receives an instance of a Column object as a parameter.
An override of the CreateInstance method.
When deriving directly from the Cell class, an override for the SetValue and GetValue methods must also be added.
The GridElement class implements the IComponent interface which derives from the IDisposable interface. This allows each grid element to be a component in the Grid Designer and thus individually selectable. It is not necessary however to call the Dispose method on the GridElement class nor on any class that derives from the GridElement class.
When creating a class that derives from GridElement (or any of its derived classes), code should not be placed within the IDisposable.Dispose method since Dispose will not be called.
The following example demonstrates the minimum implementation required for a class that derives from the DataCell class. A working version of this class can be found in the in the Puzzle sample.
VB.NET | Copy Code |
---|---|
|
C# | Copy Code |
---|---|
|