GrapeCity MultiRow Windows Forms Documentation
NamedCellStyles Property (GcMultiRow)
Example 


Gets the predefined NamedCellStyles object.
Syntax
<BrowsableAttribute(False)>
<DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)>
Public ReadOnly Property NamedCellStyles As NamedCellStyleDictionary
Dim instance As GcMultiRow
Dim value As NamedCellStyleDictionary
 
value = instance.NamedCellStyles
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public NamedCellStyleDictionary NamedCellStyles {get;}

Property Value

A NamedCellStyleDictionary that represents the predefined NamedCellStyles object.
Remarks
You can define CellStyles which are used frequently after the GcMultiRow control is created. Once you want to use a style, you can get it by its name. Each NamedCellStyle can be used as a GcMultiRow skin and you can define many skins and store them.
Example
The following code example shows how to implement the "AlternatingColumnsDefaultCellStyle" and "ColumnsDefaultCellStyle". When the form is loaded, add a Template to the GcMultiRow control. This Template sets the odd columns with "ColumnsDefaultCellStyle" and sets the even columns with "AlternatingColumnsDefaultCellStyle". After the application is running, if you want to change the "AlternatingColumnsDefaultCellStyle" or "ColumnsDefaultCellStyle", you only need to change the GcMultiRow.NamedCellStyles's corresponding item and the new CellStyle is applied. This code example is part of a larger example provided for the NamedCellStyle class.
void setThirdNamedCellStyle_Click(object sender, EventArgs e)
        {
            CellStyle alternatingColumnsDefaultCellStyle = new CellStyle();
            alternatingColumnsDefaultCellStyle.BackColor = Color.White;
            alternatingColumnsDefaultCellStyle.NullValue = "Text";
            //Change the "AlternatingColumnsDefaultCellStyle"
            this.gcMultiRow1.NamedCellStyles["AlternatingColumnsDefaultCellStyle"] = alternatingColumnsDefaultCellStyle;

            CellStyle columnsDefaultCellStyle = new CellStyle();
            columnsDefaultCellStyle.PatternColor = Color.DarkSlateGray;
            columnsDefaultCellStyle.PatternStyle = MultiRowHatchStyle.HorizontalBrick;
            //Change the "ColumnsDefaultCellStyle"
            this.gcMultiRow1.NamedCellStyles["ColumnsDefaultCellStyle"] = columnsDefaultCellStyle;

            //You can load one predefined NamedCellStyleDictionary from one file.
            //this.gcMultiRow1.NamedCellStyles.Load(@"C:\temp\NamedCellStyles.xml");
            //You can save the NamedCellStyleDictionary to one file.
            //this.gcMultiRow1.NamedCellStyles.Save(@"C:\temp\NamedCellStyles.xml");
        }
Private Sub setThirdNamedCellStyle_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setThirdStyle.Click
        Dim alternatingColumnsDefaultCellStyle As New CellStyle()
        alternatingColumnsDefaultCellStyle.BackColor = Color.White
        alternatingColumnsDefaultCellStyle.NullValue = "Text"
        'Change the "AlternatingColumnsDefaultCellStyle"
        Me.gcMultiRow1.NamedCellStyles("AlternatingColumnsDefaultCellStyle") = alternatingColumnsDefaultCellStyle

        Dim columnsDefaultCellStyle As New CellStyle()
        columnsDefaultCellStyle.PatternColor = Color.DarkSlateGray
        columnsDefaultCellStyle.PatternStyle = MultiRowHatchStyle.HorizontalBrick
        'Change the "ColumnsDefaultCellStyle"
        Me.gcMultiRow1.NamedCellStyles("ColumnsDefaultCellStyle") = columnsDefaultCellStyle

        'You can load one predefined NamedCellStyleDictionary from one file.
        'this.gcMultiRow1.NamedCellStyles.Load(@"C:\temp\NamedCellStyles.xml");
        'You can save the NamedCellStyleDictionary to one file.
        'this.gcMultiRow1.NamedCellStyles.Save(@"C:\temp\NamedCellStyles.xml");
    End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

GcMultiRow Class
GcMultiRow Members
NamedCellStyle Class
CellStyle Class
Template.NamedCellStyles

 

 


Copyright © GrapeCity, inc. All rights reserved.