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.UI.Xaml.CellGrid.Styles
Assembly: Syncfusion.SfCellGrid.UWP.dll
Syntax
public class GridBaseStylesMap : NonFinalizeDisposable, IDisposable, ICloneable, ICollection, IEnumerable
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. |
Properties
Count
The number of base styles in the GridBaseStylesMap.
Declaration
public int Count { get; }
Property Value
Type |
---|
System.Int32 |
InCollectionEditor
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 |
---|
System.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)
Declaration
public void CopyTo(Array array, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Array | array | |
System.Int32 | index |
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()
Declaration
public override string ToString()
Returns
Type |
---|
System.String |