menu

WPF

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

    Show / Hide Table of Contents

    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.

    Inheritance
    System.Object
    NonFinalizeDisposable
    GridBaseStyle
    Implements
    System.IDisposable
    System.ICloneable
    System.Runtime.Serialization.ISerializable
    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.Controls.Grid
    Assembly: Syncfusion.Grid.Wpf.dll
    Syntax
    public class GridBaseStyle : NonFinalizeDisposable, IDisposable, ICloneable, ISerializable
    Remarks

    The grid has four system-defined base styles:

    NameDescriptions
    StandardHolds cell information for all cells.
    HeaderHolds cell information for row and column headers.
    Row HeaderHolds cell information specific to row headers.
    Column HeaderHolds cell information specific to column headers.
    You can format each cell in the grid individually, but settings that have not been initialized will be inherited from a base style whereas the standard style is the style that any cell will inherit information from.

    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
    NonFinalizeDisposable.Dispose(Boolean)

    ToString()

    Returns the name of the base style.

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

    Base style name.

    Overrides
    System.Object.ToString()

    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.

    Implements

    System.IDisposable
    System.ICloneable
    System.Runtime.Serialization.ISerializable

    See Also

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