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


A Cell collection that is filled based on the standard template matrix.
Creates a standard Template matrix with the specified cells.
Syntax
Public Overloads Shared Function CreateGridTemplate( _
   ByVal cells As IEnumerable(Of Cell) _
) As Template
Dim cells As IEnumerable(Of Cell)
Dim value As Template
 
value = Template.CreateGridTemplate(cells)
public static Template CreateGridTemplate( 
   IEnumerable<Cell> cells
)

Parameters

cells
A Cell collection that is filled based on the standard template matrix.

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.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
Each cell in cells is arranged in the Row one by one. The ColumnHeaderSection and RowHeaderCell are generated. If you want to generate other elements, use CreateGridTemplate(IEnumerable<Cell>,Int32,AutoGenerateGridTemplateStyles).
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>,Int32) Method
CreateGridTemplate(IEnumerable<Cell>,Int32,AutoGenerateGridTemplateStyles) Method
CreateGridTemplate(IEnumerable<Cell>,Int32,AutoGenerateGridTemplateStyles,Int32) Method

 

 


Copyright © GrapeCity, inc. All rights reserved.