Training
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This example demonstrates some of the more common operations that can be performed on a table's row groups through the RowGroups property.
The following example creates a new table and then uses the Add method to add columns to the table's RowGroups collection.
Table tbl = new Table();
int rowGroupsToAdd = 4;
for (int x = 0; x < rowGroupsToAdd; x++)
tbl.RowGroups.Add(new TableRowGroup());
Dim tbl As New Table()
Dim rowGroupsToAdd As Integer = 4
For x As Integer = 0 To rowGroupsToAdd - 1
tbl.RowGroups.Add(New TableRowGroup())
Next x
The following example inserts a new TableRowGroup. The new column is inserted at index position 0, making it the new first row group in the table.
Note
The TableRowGroupCollection collection uses standard zero-based indexing.
tbl.RowGroups.Insert(0, new TableRowGroup());
tbl.RowGroups.Insert(0, New TableRowGroup())
The following example adds several rows to a particular TableRowGroup (specified by index) in the table.
int rowsToAdd = 10;
for (int x = 0; x < rowsToAdd; x++)
tbl.RowGroups[0].Rows.Add(new TableRow());
Dim rowsToAdd As Integer = 10
For x As Integer = 0 To rowsToAdd - 1
tbl.RowGroups(0).Rows.Add(New TableRow())
Next x
The following example accesses some arbitrary properties on rows in the first row group in the table.
// Alias the working TableRowGroup for ease in referencing.
TableRowGroup trg = tbl.RowGroups[0];
trg.Rows[0].Background = Brushes.CornflowerBlue;
trg.Rows[1].FontSize = 24;
trg.Rows[2].ToolTip = "This row's tooltip";
' Alias the working TableRowGroup for ease in referencing.
Dim trg As TableRowGroup = tbl.RowGroups(0)
trg.Rows(0).Background = Brushes.CornflowerBlue
trg.Rows(1).FontSize = 24
trg.Rows(2).ToolTip = "This row's tooltip"
The following example adds several cells to a particular TableRow (specified by index) in the table.
int cellsToAdd = 10;
for (int x = 0; x < cellsToAdd; x++)
tbl.RowGroups[0].Rows[0].Cells.Add(new TableCell(new Paragraph(new Run("Cell " + (x + 1)))));
Dim cellsToAdd As Integer = 10
For x As Integer = 0 To cellsToAdd - 1
tbl.RowGroups(0).Rows(0).Cells.Add(New TableCell(New Paragraph(New Run("Cell " & (x + 1)))))
Next x
The following example access some arbitrary methods and properties on cells in the first row in the first row group.
// Alias the working for for ease in referencing.
TableRow row = tbl.RowGroups[0].Rows[0];
row.Cells[0].Background = Brushes.PapayaWhip;
row.Cells[1].FontStyle = FontStyles.Italic;
// This call clears all of the content from this cell.
row.Cells[2].Blocks.Clear();
' Alias the working for for ease in referencing.
Dim row As TableRow = tbl.RowGroups(0).Rows(0)
row.Cells(0).Background = Brushes.PapayaWhip
row.Cells(1).FontStyle = FontStyles.Italic
' This call clears all of the content from this cell.
row.Cells(2).Blocks.Clear()
The following example returns the number of TableRowGroup elements hosted by the table.
int rowGroups = tbl.RowGroups.Count;
Dim rowGroups As Integer = tbl.RowGroups.Count
The following example removes a particular row group by reference.
tbl.RowGroups.Remove(tbl.RowGroups[0]);
tbl.RowGroups.Remove(tbl.RowGroups(0))
The following example removes a particular row group by index.
tbl.RowGroups.RemoveAt(0);
tbl.RowGroups.RemoveAt(0)
The following example removes all row groups from the table's row groups collection.
tbl.RowGroups.Clear();
tbl.RowGroups.Clear()
.NET Desktop feedback feedback
.NET Desktop feedback is an open source project. Select a link to provide feedback:
Training
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization
Events
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in