Home Forums WinForms controls Xceed Grid for WinForms change the text for the header row?

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

    Hi,

    I wonder if it is possible to change the default text for the header row? Currently, the header row shows the title and value of the column by which the grid is grouped, and the number of items belonging to that group. Can I change the text to something different?

     Thanks.

    Imported from legacy forums. Posted by Sop (had 1231 views)

    Xceed Support
    Member
    Post count: 5658

    You need to modify the GroupManagerRow. To access it, you can go through the HeaderRows collection from each group.

    Imported from legacy forums. Posted by CharlesB (had 1068 views)

    User (Old forums)
    Member
    Post count: 23064

    I’m still not sure how to do it. Can you please give an example?

    Thanks!

    Imported from legacy forums. Posted by Sop (had 617 views)

    User (Old forums)
    Member
    Post count: 23064

    Access the TitleFormat property on the GroupManagerRow.  You can do it in the designer if you create your group at design time, or through code if you create your group at run time.

    e.g.:

     

    Group countryGroup = new Group( “Country” );

    ( ( GroupManagerRow )countryGroup.HeaderRows[ 0 ] ).TitleFormat = “%ColumnTitle% : %GroupTitle% – %DataRowCount% item(s)”;

    gridControl1.GroupTemplates.Add( countryGroup );

     

    The first HeaderRow of the group is the GroupManagerRow,

    where you find the title of the group.

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

    User (Old forums)
    Member
    Post count: 23064

    Thank you for the example. I can successfully change the text if I have the grouping created beforehand. However, I am still not sure how to change the text if I don’t have the group created. ie. I drag a column header to the top of the grid where I can create a grouping from there. In this case, I don’t have any group created in my code nor in the designer. How can I change the format of the text in this case?

     Thanks for your help.

    Imported from legacy forums. Posted by Sop (had 841 views)

    User (Old forums)
    Member
    Post count: 23064

    Simply use the GroupAdded event, and do the same as above in the event handler.

    e.g. : 

    private void Form1_Load( object sender, EventArgs e )

    {

        gridControl1.GroupAdded +=

    new GroupAddedEventHandler( gridControl1_GroupAdded );

    }

    void gridControl1_GroupAdded( object sender, GroupAddedEventArgs e )

    {

        ( (

    GroupManagerRow )e.Group.HeaderRows[ 0 ] ).TitleFormat = “%ColumnTitle% : %GroupTitle% – %DataRowCount% item(s)”;

    }

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

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