Home Forums WinForms controls Xceed Grid for WinForms updating Grouptemplates

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15290 |

    I’m new to the grid control and i’m using v3.2 (for .net 1.1)

    When a user drags a column header to the groupbyrow the grid creates groupings based on the groupbyrow.grouptemplate (including footerRows etc). How do I do this programmatically? I can only seem to create a group from scratch and then add it to the grid (grid.grouptemplates.Add(group) ) What I would like to do is create a group based on the GroupByRow.GroupTemplate (some sort of clone method?) then add this to the grid (so it picks up on all the footerRows etc) or am I going about this the wrong way?

    Alternatively is it possible to update the groupings on the grid to reflect changes in the groupByRow.GroupTemplate

    Imported from legacy forums. Posted by Mike (had 1968 views)

    User (Old forums)
    Member
    Post count: 23064

    You need to create a group, specify on which column it will group, and add it to the GroupTemplate.

    e.g.:

    Group group1 = new Group();
    group1.GroupBy = “Discontinued”;
    GroupManagerRow groupManagerRow1 = new GroupManagerRow();
    group1.HeaderRows.Add( groupManagerRow1 );
    gridControl1.GroupTemplates.Add( group1 );

    To update groups once you have changed the template, use the UpdateGrouping method on the GridControl.

    gridControl1.UpdateGrouping();

    Note that when you want to know how to do specific task like this one, you can use the designer to do it (e.g. drop a column header in the GroupByRow at design time), then look at the code automatically generated by the grid. Afterward, simply reproduce this in code, and you should be up and running.

    Imported from legacy forums. Posted by André (had 3048 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.