Home Forums WinForms controls Xceed Grid for WinForms Group Header rows

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

    This is probably easy, but I can’t find the documentation for this.

    I want to use Group Header rows that will scroll with the grid content. I want to have more than one header row.

    Basically, I want functionality similar to the GroupManagerRow, but with a lot more formatting flexibility. I have a block of data to present before each group (set of data rows) that describes the group. But I can’t figure out how to populate the Group Header rows.

    I have an unbound grid. At design time, I created my columns in the grid. I created a Group and dragged one column into the GroupByRow. There is a GroupManagerRow with visible set to false. I inserted a ColumnManagerRow into the group (which puts nice headers on my grid’s columns).

    I also inserted a TextRow into the group which appears just below my ColumnManagerRow. I can hard-code a text value at design time, but how do I fill the TextRow dynamically at run time?

    My code (in C#) looks kinda like this:

    /* Create query, open database connection … */

    SqlDataReader reader = command.ExecuteReader();
    while ( reader.Read() )
    {
    Xceed.Grid.DataRow myDataRow = myGrid.DataRows.AddNew();

    myDataRow.Cells[0].Value = reader[0];
    myDataRow.Cells[1].Value = reader[1];

    myDataRow.EndEdit();
    }
    reader.Close();

    Jon Z

    Imported from legacy forums. Posted by AlphaGuys (had 2293 views)

    User (Old forums)
    Member
    Post count: 23064

    The GridControl class has an event GroupAdded, that is called whenever a new group is added.<code>grid.GroupAdded += new GroupAddedEventHandler(grid_GroupAdded);
    private void grid_GroupAdded(object sender, GroupAddedEventArgs e) {
    Group group = e.Group; // the group that was added
    RowList headerRows = group.HeaderRows; // the header rows of the group
    foreach(Row row in headerRows) {
    TextRow textRow = row as TextRow;
    if (textRow != null) {
    textRow.Text = “My info”;
    break;
    }
    }
    }</code>

    Imported from legacy forums. Posted by Tommy (had 3315 views)

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