* Suggestion/warning fixes for US-1889327. * Updated H2s. * Minor content edit. * Review edits. * Minor edits. * Update dotnet-desktop-guide/framework/wpf/advanced/localization-attributes-and-comments.md Co-authored-by: Andy (Steve) De George <[email protected]>
6.3 KiB
title, ms.date, ms.custom, description, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | ms.custom | description | dev_langs | helpviewer_keywords | ms.assetid | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| How to: Manipulate a Table's Row Groups through the RowGroups Property | 03/30/2017 | devdivchpfy22 | Learn how to manipulate a Table's Row Groups through the RowGroups property. |
|
|
ea61440f-08ae-44ed-b314-5716aaaae3ed |
How to: Manipulate a Table's Row Groups through the RowGroups Property
This example demonstrates some of the more common operations that can be performed on a table's row groups through the xref:System.Windows.Documents.Table.RowGroups%2A property.
Create a new table using Add method
The following example creates a new table and then uses the xref:System.Windows.Documents.TableRowGroupCollection.Add%2A method to add columns to the table's xref:System.Windows.Documents.Table.RowGroups%2A collection.
[!code-csharpTableSnippets2#_Table_RowGroups_Add] [!code-vbTableSnippets2#_Table_RowGroups_Add]
Inserts a new TableRowGroup
The following example inserts a new xref:System.Windows.Documents.TableRowGroup. The new column is inserted at index position 0, making it the new first row group in the table.
Note
The xref:System.Windows.Documents.TableRowGroupCollection collection uses standard zero-based indexing.
[!code-csharpTableSnippets2#_Table_RowGroups_Insert] [!code-vbTableSnippets2#_Table_RowGroups_Insert]
Add rows to the TableRowGroup
The following example adds several rows to a particular xref:System.Windows.Documents.TableRowGroup (specified by index) in the table.
[!code-csharpTableSnippets2#_Table_RowGroups_AddRows] [!code-vbTableSnippets2#_Table_RowGroups_AddRows]
Access row properties in the first row group
The following example accesses some arbitrary properties on rows in the first row group in the table.
[!code-csharpTableSnippets2#_Table_RowGroups_ManipRows] [!code-vbTableSnippets2#_Table_RowGroups_ManipRows]
Add cells to a TableRow
The following example adds several cells to a particular xref:System.Windows.Documents.TableRow (specified by index) in the table.
[!code-csharpTableSnippets2#_Table_RowGroups_AddCells] [!code-vbTableSnippets2#_Table_RowGroups_AddCells]
Access methods and properties on cells in the first row group
The following example access some arbitrary methods and properties on cells in the first row in the first row group.
[!code-csharpTableSnippets2#_Table_RowGroups_ManipCells] [!code-vbTableSnippets2#_Table_RowGroups_ManipCells]
Get the number of TableRowGroup elements in a table
The following example returns the number of xref:System.Windows.Documents.TableRowGroup elements hosted by the table.
[!code-csharpTableSnippets2#_Table_RowGroups_Count] [!code-vbTableSnippets2#_Table_RowGroups_Count]
Remove a row group by reference
The following example removes a particular row group by reference.
[!code-csharpTableSnippets2#_Table_RowGroups_DelRef] [!code-vbTableSnippets2#_Table_RowGroups_DelRef]
Remove a row group by index
The following example removes a particular row group by index.
[!code-csharpTableSnippets2#_Table_RowGroups_DelIndex] [!code-vbTableSnippets2#_Table_RowGroups_DelIndex]
Remove all row groups from the table's row groups collection
The following example removes all row groups from the table's row groups collection.
[!code-csharpTableSnippets2#_Table_RowGroups_Clear] [!code-vbTableSnippets2#_Table_RowGroups_Clear]