menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GridBaseStylesMap - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class GridBaseStylesMap

    Implements the functionalities that holds a collection of base styles for a grid and lets you add, remove, and change base styles.

    Inheritance
    System.Object
    NonFinalizeDisposable
    GridBaseStylesMap
    Implements
    System.IDisposable
    System.ICloneable
    System.Runtime.Serialization.ISerializable
    System.Collections.ICollection
    System.Collections.IEnumerable
    Inherited Members
    NonFinalizeDisposable.Dispose()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Syncfusion.Windows.Forms.Grid
    Assembly: Syncfusion.Grid.Windows.dll
    Syntax
    public class GridBaseStylesMap : NonFinalizeDisposable, IDisposable, ICloneable, ISerializable, 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 ShowGridBaseStylesMapDialog(Object, String) to let users customize base styles at run-time.

    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

    GridBaseStylesMap()

    Initializes a new instance ofGridBaseStylesMap.

    Declaration
    public GridBaseStylesMap()

    GridBaseStylesMap(GridBaseStyle[])

    Initializes a new instance ofGridBaseStylesMap 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 instance ofGridBaseStylesMap 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 de-serialize this instance.

    System.Runtime.Serialization.StreamingContext context

    Describes the source and destination of the serialized stream specified by info.

    Properties

    CellTypes

    Gets an System.Collections.ArrayList will cell type names as strings.

    Declaration
    public ArrayList CellTypes { get; }
    Property Value
    Type
    System.Collections.ArrayList

    ColumnHeader

    Gets or sets the GridBaseStyle for column header style.

    Declaration
    public GridBaseStyle ColumnHeader { get; set; }
    Property Value
    Type
    GridBaseStyle

    Count

    Gets the number of base styles in the GridBaseStylesMap.

    Declaration
    public int Count { get; }
    Property Value
    Type
    System.Int32

    Header

    Gets or sets the GridBaseStyle for Header style.

    Declaration
    public GridBaseStyle Header { get; set; }
    Property Value
    Type
    GridBaseStyle

    InCollectionEditor

    Gets a value indicating whether in CollectionEditor. 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 or sets a GridBaseStyle at the specified index.

    Declaration
    public GridBaseStyle this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index

    The index of the base style.

    Property Value
    Type
    GridBaseStyle

    Item[String]

    Gets or sets the GridBaseStyle for the specified name.

    Declaration
    public GridBaseStyle this[string name] { get; set; }
    Parameters
    Type Name Description
    System.String name

    The name of the base style.

    Property Value
    Type
    GridBaseStyle

    Modified

    Gets or sets a value indicating whether to modify property(bool)

    Declaration
    public bool Modified { get; set; }
    Property Value
    Type
    System.Boolean

    RowHeader

    Gets or sets the GridBaseStyle for row header style.

    Declaration
    public GridBaseStyle RowHeader { get; set; }
    Property Value
    Type
    GridBaseStyle

    Standard

    Gets or sets the GridBaseStyle for Standard style.

    Declaration
    public GridBaseStyle Standard { get; set; }
    Property Value
    Type
    GridBaseStyle

    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

    Array of base styles.

    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

    The new GridBaseStylesMap 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

    The Array.

    System.Int32 index

    Index to copy.

    Dispose(Boolean)

    Disposes the unmanaged resources.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing
    Overrides
    NonFinalizeDisposable.Dispose(Boolean)

    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 GridBaseStyleCollectionEditor.

    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()

    ShowGridBaseStylesMapDialog(Object, String)

    Shows a dialog with a collection editor that allows the end-user to add and remove base styles.

    Declaration
    public static DialogResult ShowGridBaseStylesMapDialog(object instance, string propertyName)
    Parameters
    Type Name Description
    System.Object instance

    The instance with a property that references a GridBaseStylesMap.

    System.String propertyName

    The name of the property, e.g. "BaseStylesMap".

    Returns
    Type Description
    System.Windows.Forms.DialogResult

    The System.Windows.Forms.DialogResult.

    ShowGridBaseStylesMapDialog(Object, String, IServiceProvider)

    Shows a dialog with a collection editor that allows the end-user to add and remove base styles.

    Declaration
    public static DialogResult ShowGridBaseStylesMapDialog(object instance, string propertyName, IServiceProvider provider)
    Parameters
    Type Name Description
    System.Object instance

    The instance with a property that references a GridBaseStylesMap.

    System.String propertyName

    The name of the property, e.g. "BaseStylesMap".

    System.IServiceProvider provider

    A IServiceProvider. Can be NULL.

    Returns
    Type Description
    System.Windows.Forms.DialogResult

    The System.Windows.Forms.DialogResult.

    ToString()

    Returns a System.String that represents the current System.Object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    A System.String that represents the current System.Object.

    Overrides
    System.Object.ToString()

    Explicit Interface Implementations

    ISerializable.GetObjectData(SerializationInfo, StreamingContext)

    Implements the ISerializable interface and returns the data needed to serialize the GridBaseStylesMap.

    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.

    Implements

    System.IDisposable
    System.ICloneable
    System.Runtime.Serialization.ISerializable
    System.Collections.ICollection
    System.Collections.IEnumerable

    Extension Methods

    EnumerableExtensions.GetElementType(IEnumerable)
    EnumerableExtensions.GetItemPropertyInfo(IEnumerable)
    FunctionalExtensions.ForEach<T>(IEnumerable, Action<T>)
    FunctionalExtensions.ToList<T>(IEnumerable)
    QueryableExtensions.OfQueryable(IEnumerable)
    QueryableExtensions.OfQueryable(IEnumerable, Type)
    QueryableExtensions.GroupByMany<TElement>(IEnumerable, Type, List<Func<TElement, Object>>)
    QueryableExtensions.GroupByMany(IEnumerable, Type, Func<String, Expression>, String[])
    QueryableExtensions.GroupByMany(IEnumerable, Type, List<SortDescriptor>, Dictionary<String, IComparer<Object>>, Func<String, Expression>, String[])
    QueryableExtensions.GroupByMany(IEnumerable, Type, List<SortDescriptor>, Func<String, Expression>, String[])

    See Also

    GridBaseStyle
    GridStyleInfo
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved