Xceed Grid for WinForms v4.3 Documentation
Xceed.Grid.v4.3 Assembly / Xceed.Grid Namespace / GridControl Class / GroupTemplates Property
Example


In This Topic
    GroupTemplates Property (GridControl)
    In This Topic
    Gets a list of the Group objects used as templates to create the groups that will be contained within the grid.
    Syntax
    'Declaration
     
    <BrowsableAttribute(False)>
    <DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)>
    Public ReadOnly Property GroupTemplates As GroupList
    'Usage
     
    Dim instance As GridControl
    Dim value As GroupList
     
    value = instance.GroupTemplates
    [Browsable(false)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    public GroupList GroupTemplates {get;}

    Property Value

    A reference to a Xceed.Grid.Collections.GroupList object containing a list of the groups used as templates to create the groups that will be contained within the grid.
    Remarks

    The number of groups added to the grid's collection of GroupTemplates will determine the number of group levels.

    In order for the modifications made to the group templates to be applied to the grid (after the grid has been populated) the UpdateGrouping method must be called.

    Example
    The following example demonstrates how to add 2 groups to the grid's GroupTemplates.
    Dim group As New Group()
    group.GroupBy = "ShipCountry"
    group.HeaderRows.Add( New GroupManagerRow() )
    
    gridControl1.GroupTemplates.Add( group )
    
    ' If a group is created using the constructor that accepts a string as its GroupBy, it
    ' will automatically contain a GroupManagerRow in its HeaderRows collection.
    gridControl1.GroupTemplates.Add( New Group( "ShipCity" ) )
    
    ' If the groups were created and added to the grid outside of calls to the BeginInit and EndInit methods,
    ' the <see cref="M:Xceed.Grid.GridControl.UpdateGrouping"/> method must be called in order for the modifications to be reflected
    ' in the grid
    gridControl1.UpdateGrouping()
    Group group = new Group();
    group.GroupBy = "ShipCountry";
    group.HeaderRows.Add( group );
    
    gridControl1.GroupTemplates.Add( group );
    
    // If a group is created using the constructor that accepts a string as its GroupBy, it
    // will automatically contain a GroupManagerRow in its HeaderRows collection.
    gridControl1.GroupTemplates.Add( new Group( "ShipCity" ) );
    
    // If the groups were created and added to the grid outside of calls to the BeginInit and EndInit methods,
    // the <see cref="M:Xceed.Grid.GridControl.UpdateGrouping"/> method must be called in order for the modifications to be reflected
    // in the grid.
    gridControl1.UpdateGrouping();
    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