Class GridBaseStylesMap
GridBaseStylesMap holds a collection of base styles for a grid and lets you add, remove, and change base styles.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Controls.Grid
Assembly: Syncfusion.Grid.Wpf.dll
Syntax
public class GridBaseStylesMap : NonFinalizeDisposable, ICloneable, ISerializable, ICollection, IEnumerable, IDisposable
Remarks
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.
The grid has four system-defined base styles as discussed in GridBaseStyle overview. The RegisterStandardStyles() method adds these system styles to the collection.
You can register custom base styles with the GridBaseStylesMap map that you can access with BaseStylesMap.
Use
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
GridBaseStylesMap()
Initializes a new GridBaseStylesMap.
Declaration
public GridBaseStylesMap()
GridBaseStylesMap(GridBaseStyle[])
Initializes a new GridBaseStylesMap and copies an array of base styles.
Declaration
public GridBaseStylesMap(GridBaseStyle[] baseStyles)
Parameters
Type | Name | Description |
---|---|---|
GridBaseStyle[] | baseStyles | An array with GridBaseStyle styles. |
GridBaseStylesMap(SerializationInfo, StreamingContext)
Initializes a new GridBaseStylesMap from a serialization stream.
Declaration
protected GridBaseStylesMap(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. |
Properties
CellTypes
Returns an System.Collections.ArrayList will cell type names as strings.
Declaration
public ArrayList CellTypes { get; }
Property Value
Type |
---|
System.Collections.ArrayList |
Count
The number of base styles in the GridBaseStylesMap.
Declaration
public int Count { get; }
Property Value
Type |
---|
System.Int32 |
InCollectionEditor
For internal use.
Declaration
public bool InCollectionEditor { get; }
Property Value
Type |
---|
System.Boolean |
IsReadOnly
Gets a value indicating whether the base styles collection is Read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type |
---|
System.Boolean |
IsSynchronized
Gets a value indicating whether the base styles collection is synchronized.
Declaration
public bool IsSynchronized { get; }
Property Value
Type |
---|
System.Boolean |
Item[Int32]
Gets / sets a GridBaseStyle at the specified index.
Declaration
public GridBaseStyle this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type |
---|
GridBaseStyle |
Item[String]
The GridBaseStyle for the specified name.
Declaration
public GridBaseStyle this[string name] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Property Value
Type |
---|
GridBaseStyle |
Modified
Property Modified (bool)
Declaration
public bool Modified { get; set; }
Property Value
Type |
---|
System.Boolean |
SyncRoot
Gets an object that can be used to synchronize access to base styles table.
Declaration
public object SyncRoot { get; }
Property Value
Type |
---|
System.Object |
Methods
Add(GridBaseStyle)
Adds a base style to the GridBaseStylesMap.
Declaration
public void Add(GridBaseStyle baseStyle)
Parameters
Type | Name | Description |
---|---|---|
GridBaseStyle | baseStyle | The base style to be added. |
AddRange(GridBaseStyle[])
Adds a range of base styles to the GridBaseStylesMap.
Declaration
public void AddRange(GridBaseStyle[] value)
Parameters
Type | Name | Description |
---|---|---|
GridBaseStyle[] | value |
Clone()
Creates a new instance GridBaseStylesMap and initializes it with all base styles from this collection.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | A duplicate of the current object. |
CopyTo(GridBaseStyle[], Int32)
Copies all base styles into an array of GridBaseStyle starting at specified index.
Declaration
public void CopyTo(GridBaseStyle[] values, int index)
Parameters
Type | Name | Description |
---|---|---|
GridBaseStyle[] | values | The array of GridBaseStyle where the values should be copied to. |
System.Int32 | index | The starting index in the destination array. |
CopyTo(Array, Int32)
Copies the base style collection elements to a one-dimensional Array instance at the specified index.
Declaration
public void CopyTo(Array array, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Array | array | An array to which the base style collection has to be copied to. |
System.Int32 | index | The index at which copying begins. |
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
GetBaseStylesMapStyles(String, out Int32)
Copies a base style and all base styles it depends on into an array.
Declaration
public GridStyleInfo[] GetBaseStylesMapStyles(string name, out int level)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the base style. |
System.Int32 | level | The maximum number of levels to look at when walking referenced base styles. |
Returns
Type | Description |
---|---|
GridStyleInfo[] | An array of GridBaseStyle objects with the first base style and all base styles it depends on. |
GetEnumerator()
Returns an enumerator that can enumerate through the base styles object in this collection.
Declaration
public IEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An enumerator. |
GetNewBaseStyleName()
Gets a suggestion for a new base style name, e.g. when the user adds a new
base style in the
Declaration
public string GetNewBaseStyleName()
Returns
Type | Description |
---|---|
System.String | A string for a new base style name. |
RegisterStandardStyles()
Adds "Standard", "Header", "Row Header", and "Column Header" base styles.
Declaration
public void RegisterStandardStyles()
ToString()
Gets the string equivalent of the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | String representation of the current object. |