GrapeCity MultiRow Windows Forms Documentation
Template Property (GcMultiRow)
Example 


Gets or sets a value that indicates the GcMultiRow control template.
Syntax
<SRDescriptionAttribute("Indicates the GcMultiRow Template.")>
<SRCategoryAttribute("Appearance")>
<MergablePropertyAttribute(False)>
<DefaultValueAttribute()>
Public Property Template As Template
Dim instance As GcMultiRow
Dim value As Template
 
instance.Template = value
 
value = instance.Template
[SRDescription("Indicates the GcMultiRow Template.")]
[SRCategory("Appearance")]
[MergableProperty(false)]
[DefaultValue()]
public Template Template {get; set;}

Property Value

A Template that indicates the GcMultiRow control template.
Exceptions
ExceptionDescription
System.ArgumentException

The specified Template cannot be cloned.

-or-

The assigned template has a SummaryCell and the SummaryCell's dependent cell does not exist in the Row section.

Remarks
You can use the Integrated Designer to design a Template and use the Template.Save method to save it to an XML file. Use the Template's Template.Load method to load the XML file. You can also use code to create a Template if you are very familiar with the GcMultiRow control.
Example
The following code example shows how to create a GcMultiRow template. If you want to modify the GcMultiRow.Template, you should retrieve the GcMultiRow.Template, modify it, and then set the template to GcMultiRow again. This example is part of a larger example available for the Office2007Style setting.
void setBlueStyle_Click(object sender, EventArgs e)
       {
           Template template1 = this.gcMultiRow1.Template;
           //Set ScrollBar to Office 2007 style.
           this.gcMultiRow1.ScrollBarOffice2007Style = Office2007Style.Blue;
           //Set Split line to Office 2007 style.
           this.gcMultiRow1.SplitOffice2007Style = Office2007Style.Blue;
           //Set All HeaderCell's border to Office 2007 Style. You can change the border to any style.
           CellStyle borderStyle = new CellStyle();
           borderStyle.Border = new Border(LineStyle.Thin, Color.FromArgb(255, 156, 182, 206));
           this.gcMultiRow1.ColumnHeadersDefaultHeaderCellStyle = borderStyle;
           this.gcMultiRow1.RowsDefaultHeaderCellStyle = borderStyle;

           //Set all HeaderCell to Office2007Style.
           foreach (Cell cell1 in template1.ColumnHeaders[0].Cells)
           {
               HeaderCell headerCell1 = cell1 as HeaderCell;
               if (headerCell1 != null)
               {
                   headerCell1.Office2007Style = Office2007Style.Blue;
               }
           }
           HeaderCell rowHeaderCell1 = template1.Row.Cells[template1.Row.Cells.Count - 1] as HeaderCell;
           if (rowHeaderCell1 != null)
           {
               rowHeaderCell1.Office2007Style = Office2007Style.Blue;
           }

           this.gcMultiRow1.Template = template1;
       }
Private Sub setBlueStyle_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setBlueStyle.Click
        Dim template1 As Template = Me.gcMultiRow1.Template
        'Set ScrollBar to Office 2007 style.
        Me.gcMultiRow1.ScrollBarOffice2007Style = Office2007Style.Blue
        'Set Split line to Office 2007 style.
        Me.gcMultiRow1.SplitOffice2007Style = Office2007Style.Blue
        'Set All HeaderCell's border to Office 2007 Style. You can change the border to any style.
        Dim borderStyle As New CellStyle()
        borderStyle.Border = New Border(LineStyle.Thin, Color.FromArgb(255, 156, 182, 206))
        Me.gcMultiRow1.ColumnHeadersDefaultHeaderCellStyle = borderStyle
        Me.gcMultiRow1.RowsDefaultHeaderCellStyle = borderStyle

        'Set all HeaderCell to Office2007Style.
        For Each cell1 As Cell In template1.ColumnHeaders(0).Cells
            Dim headerCell1 As HeaderCell = TryCast(cell1, HeaderCell)
            If Not headerCell1 Is Nothing Then
                headerCell1.Office2007Style = Office2007Style.Blue
            End If
        Next
        Dim rowHeaderCell1 As HeaderCell = TryCast(template1.Row.Cells(template1.Row.Cells.Count - 1), HeaderCell)
        If Not rowHeaderCell1 Is Nothing Then
            rowHeaderCell1.Office2007Style = Office2007Style.Blue
        End If

        Me.gcMultiRow1.Template = template1
    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
Template Class
Load(String) Method
Save(String) Method

 

 


Copyright © GrapeCity, inc. All rights reserved.