Class GridBaseStyle
GridBaseStyle 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.Controls.Grid
Assembly: Syncfusion.Grid.Wpf.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.Foreground = new SolidColorBrush(Colors.Red);
header.Background = new SolidColorBrush(Colors.Red);
rowHeader.Background = new SolidColorBrush(Colors.Red);
standard.Background = new SolidColorBrush(Colors.Red);
GridStyleInfo customStyle = model.BaseStylesMap["Custom Style"].StyleInfo;
standard.Background = new SolidColorBrush(Colors.Red);
model[1, 1].BaseStyle = "Custom Style";
Constructors
GridBaseStyle()
Initializes a new GridBaseStyle object.
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 deserialize 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 GridBaseStyle 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 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 GridBaseStyle 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 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
The GridBaseStylesMap this base style belongs to.
Declaration
public GridBaseStylesMap BaseStylesMap { get; set; }
Property Value
Type |
---|
GridBaseStylesMap |
IsSystem
Indicates if this a system style that cannot be removed.
Declaration
public bool IsSystem { get; }
Property Value
Type |
---|
System.Boolean |
Name
The base style name.
Declaration
public string Name { get; set; }
Property Value
Type |
---|
System.String |
StyleInfo
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
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)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
ToString()
Returns the name of the base style.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | Base style name. |