GrapeCity MultiRow Windows Forms Documentation
CreateGridTemplate(IEnumerable<Cell>,Int32,AutoGenerateGridTemplateStyles) Method
Example 


A Cell collection that is filled based on the standard template matrix.
A System.Int32 that indicates the maximum column width.
One of the AutoGenerateGridTemplateStyles values that indicate which elements are generated in the template.
Creates a standard Template matrix with the specified cells.
Syntax
Public Overloads Shared Function CreateGridTemplate( _
   ByVal cells As IEnumerable(Of Cell), _
   ByVal columnsMaxWidth As Integer, _
   ByVal autoGenerateGridTemplateStyles As AutoGenerateGridTemplateStyles _
) As Template
Dim cells As IEnumerable(Of Cell)
Dim columnsMaxWidth As Integer
Dim autoGenerateGridTemplateStyles As AutoGenerateGridTemplateStyles
Dim value As Template
 
value = Template.CreateGridTemplate(cells, columnsMaxWidth, autoGenerateGridTemplateStyles)

Parameters

cells
A Cell collection that is filled based on the standard template matrix.
columnsMaxWidth
A System.Int32 that indicates the maximum column width.
autoGenerateGridTemplateStyles
One of the AutoGenerateGridTemplateStyles values that indicate which elements are generated in the template.

Return Value

A Template that represents a standard Template matrix.
Exceptions
ExceptionDescription
System.ArgumentNullExceptionThe cells parameter is a null reference (Nothing in Visual Basic).
System.ArgumentOutOfRangeExceptionThe columnsMaxWidth is less than or equal to 0.
System.ComponentModel.InvalidEnumArgumentExceptionThe autoGenerateGridTemplateStyles value is not a valid AutoGenerateGridTemplateStyles value.
System.ArgumentException

There exists one cell in cells that is a null reference (Nothing in Visual Basic).

-or-

There exists one cell in cells that has been added to another Section or Template.

-or-

There are no cells in cells.

System.InvalidOperationExceptionThere exists one cell in cells that cannot be added to the Row section.
Remarks
This method is based on CreateGridTemplate(IEnumerable<Cell>,Int32). You can set autoGenerateGridTemplateStyles to specify which elements should be generated.
Example
The following code example shows how to use this method to create a grid template. This code example is part of a larger example provided for the CreateGridTemplate(int) class.
void SetFourth_Click(object sender, EventArgs e)
        {
            NumericUpDownCell numericUpDownCell1 = new NumericUpDownCell();
            numericUpDownCell1.Value = 0;

            NumericUpDownCell numericUpDownCell2 = new NumericUpDownCell();
            numericUpDownCell2.Value = 16m;

            Template template1 = Template.CreateGridTemplate(new Cell[] { numericUpDownCell1, numericUpDownCell2 }, Int32.MaxValue,
                AutoGenerateGridTemplateStyles.ColumnHeader | AutoGenerateGridTemplateStyles.RowHeaderAutoNumber, 50);
            template1.ColumnHeaders[0].Cells[0].Value = "Column1";
            template1.ColumnHeaders[0].Cells[1].Value = "Column2";

            gcMultiRow1.Template = template1;
            gcMultiRow1.RowCount = 10;
        }
Private Sub SetFourth_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setFourth.Click
        Dim numericUpDownCell1 As New NumericUpDownCell()
        numericUpDownCell1.Value = 0

        Dim numericUpDownCell2 As New NumericUpDownCell()
        numericUpDownCell2.Value = 16D

        Dim template1 As Template = Template.CreateGridTemplate(New Cell() {numericUpDownCell1, numericUpDownCell2}, Int32.MaxValue, AutoGenerateGridTemplateStyles.ColumnHeader Or AutoGenerateGridTemplateStyles.RowHeaderAutoNumber, 50)
        template1.ColumnHeaders(0).Cells(0).Value = "Column1"
        template1.ColumnHeaders(0).Cells(1).Value = "Column2"

        gcMultiRow1.Template = template1
        gcMultiRow1.RowCount = 10
    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

Template Class
Template Members
Overload List
CreateGridTemplate(Int32) Method
CreateGridTemplate(Int32,Int32,Int32) Method
CreateGridTemplate(Int32,Int32,Int32,Int32) Method
CreateGridTemplate(Int32,Int32,Int32,Int32,AutoGenerateGridTemplateStyles) Method
CreateGridTemplate(Int32,Int32,Int32,Int32,AutoGenerateGridTemplateStyles,Int32) Method
CreateGridTemplate(IEnumerable<Cell>) Method
CreateGridTemplate(IEnumerable<Cell>,Int32) Method
CreateGridTemplate(IEnumerable<Cell>,Int32,AutoGenerateGridTemplateStyles,Int32) Method

 

 


Copyright © GrapeCity, inc. All rights reserved.