Class GridBaseStyle
Implements the functionalities that represents base styles in the grid. A base style has a name and holds the GridStyleInfo object with style information. Cells in the grid can reference a base style with BaseStyle.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridBaseStyle : NonFinalizeDisposable, IDisposable, ICloneable, ISerializable
Remarks
The grid has four system-defined base styles:
| Name | Descriptions |
|---|---|
| Standard | Holds cell information for all cells. |
| Header | Holds cell information for row and column headers. |
| Row Header | Holds cell information specific to row headers. |
| Column Header | Holds cell information specific to column headers. |
You can register custom base styles with the GridBaseStylesMap map that you can access with BaseStylesMap.
Base styles themselves can be inherited from other base styles. The "Row Header" base style is derived from the "Header" base style for example.
Examples
The following example shows how to modify base styles and how to add a new custom base style:
GridStyleInfo standard = model.BaseStylesMap["Standard"].StyleInfo;
GridStyleInfo header = model.BaseStylesMap["Header"].StyleInfo;
GridStyleInfo rowHeader = model.BaseStylesMap["Row Header"].StyleInfo;
GridStyleInfo colHeader = model.BaseStylesMap["Column Header"].StyleInfo;
standard.TextColor = Color.FromArgb(0, 21, 84);
header.Interior = new BrushInfo(GradientStyle.Vertical, Color.FromArgb(238, 234, 216), Color.FromArgb(203, 199, 184));
rowHeader.Interior = new BrushInfo(GradientStyle.Horizontal, Color.FromArgb(238, 234, 216), Color.FromArgb(203, 199, 184));
standard.Font.Facename = "Helvetica";
standard.Interior = new BrushInfo(Color.FromArgb(237, 240, 247));
GridStyleInfo customStyle = model.BaseStylesMap["Custom Style"].StyleInfo;
standard.Interior = new BrushInfo(Color.Green);
model[1, 1].BaseStyle = "Custom Style";
Constructors
GridBaseStyle()
Initializes a new instance of GridBaseStyle class.
Declaration
public GridBaseStyle()
GridBaseStyle(SerializationInfo, StreamingContext)
Initializes a new GridBaseStyle from a serialization stream.
Declaration
protected GridBaseStyle(SerializationInfo info, StreamingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Runtime.Serialization.SerializationInfo | info | An object that holds all the data needed to serialize or de-serialize this instance. |
| System.Runtime.Serialization.StreamingContext | context | Describes the source and destination of the serialized stream specified by info. |
GridBaseStyle(String, Boolean)
Initializes a new instance ofGridBaseStyle with a name.
Declaration
public GridBaseStyle(string name, bool isSystem)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the base style. |
| System.Boolean | isSystem | True if this is a system base style that cannot be deleted; False otherwise. |
GridBaseStyle(String, Boolean, GridStyleInfo)
Initializes a new instance of GridBaseStyle with name and style information.
Declaration
public GridBaseStyle(string name, bool isSystem, GridStyleInfo styleInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the base style. |
| System.Boolean | isSystem | True if this is a system base style that cannot be deleted; False otherwise. |
| GridStyleInfo | styleInfo | A GridStyleInfo with style settings. |
GridBaseStyle(String, Boolean, GridStyleInfoStore)
Initializes a new instance ofGridBaseStyle with name and style information.
Declaration
public GridBaseStyle(string name, bool isSystem, GridStyleInfoStore styleInfoStore)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the base style. |
| System.Boolean | isSystem | True if this is a system base style that cannot be deleted; False otherwise. |
| GridStyleInfoStore | styleInfoStore | A GridStyleInfoStore with style settings. |
GridBaseStyle(String, Boolean, GridStyleInfoStore, GridBaseStylesMap)
Initializes a new instance of GridBaseStyle with name and style information and associates it with a base styles map.
Declaration
public GridBaseStyle(string name, bool isSystem, GridStyleInfoStore styleInfoStore, GridBaseStylesMap styleInfoMap)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the base style. |
| System.Boolean | isSystem | True if this is a system base style that cannot be deleted; False otherwise. |
| GridStyleInfoStore | styleInfoStore | A GridStyleInfoStore with style settings. |
| GridBaseStylesMap | styleInfoMap | The GridBaseStylesMap for this base style. |
Properties
BaseStylesMap
Gets or sets the GridBaseStylesMap this base style belongs to.
Declaration
public GridBaseStylesMap BaseStylesMap { get; set; }
Property Value
| Type |
|---|
| GridBaseStylesMap |
IsSystem
Gets a value indicating whether this system style can be removed or not.
Declaration
public bool IsSystem { get; }
Property Value
| Type |
|---|
| System.Boolean |
Name
Gets or sets the base style name.
Declaration
public string Name { get; set; }
Property Value
| Type |
|---|
| System.String |
StyleInfo
Gets or sets the GridStyleInfo with style settings for this base style.
Declaration
public GridStyleInfo StyleInfo { get; set; }
Property Value
| Type |
|---|
| GridStyleInfo |
Remarks
The GridStyleInfo returned by this property is simply a wrapper for the settings in StyleInfoStore.
StyleInfoStore
Gets or sets the GridStyleInfoStore with style settings for this base style.
Declaration
public GridStyleInfoStore StyleInfoStore { get; set; }
Property Value
| Type |
|---|
| GridStyleInfoStore |
Methods
Clone()
Creates a new GridBaseStyle object and copies all properties from this object.
Declaration
public object Clone()
Returns
| Type | Description |
|---|---|
| System.Object | The new created GridBaseStyle object. |
Dispose(Boolean)
Disposes the unmanaged resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
Overrides
ToString()
Returns a string holding the current object.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | String representation of the current object. |
Overrides
Explicit Interface Implementations
ISerializable.GetObjectData(SerializationInfo, StreamingContext)
Implements the ISerializable interface and returns the data needed to serialize the GridBaseStyle.
Declaration
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Runtime.Serialization.SerializationInfo | info | A SerializationInfo object containing the information required to serialize the object. |
| System.Runtime.Serialization.StreamingContext | context | A StreamingContext object containing the source and destination of the serialized stream. |