* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
4.5 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| How to: Manipulate a Table's Columns through the Columns Property | 03/30/2017 |
|
|
3f8884f4-7e1f-456b-be06-fbd3cf469bf3 |
How to: Manipulate a Table's Columns through the Columns Property
This example demonstrates some of the more common operations that can be performed on a table's columns through the xref:System.Windows.Documents.Table.Columns%2A property.
Example
The following example creates a new table and then uses the xref:System.Windows.Documents.TableColumnCollection.Add%2A method to add columns to the table's xref:System.Windows.Documents.Table.Columns%2A collection.
[!code-csharpTableSnippets2#_Table_Columns_Add] [!code-vbTableSnippets2#_Table_Columns_Add]
Example
The following example inserts a new xref:System.Windows.Documents.TableColumn. The new column is inserted at index position 0, making it the new first column in the table.
Note
The xref:System.Windows.Documents.TableColumnCollection collection uses standard zero-based indexing.
[!code-csharpTableSnippets2#_Table_Columns_Insert] [!code-vbTableSnippets2#_Table_Columns_Insert]
Example
The following example accesses some arbitrary properties on columns in the xref:System.Windows.Documents.TableColumnCollection collection, referring to particular columns by index.
[!code-csharpTableSnippets2#_Table_Columns_Manip] [!code-vbTableSnippets2#_Table_Columns_Manip]
Example
The following example gets the number of columns currently hosted by the table.
[!code-csharpTableSnippets2#_Table_Columns_Count] [!code-vbTableSnippets2#_Table_Columns_Count]
Example
The following example removes a particular column by reference.
[!code-csharpTableSnippets2#_Table_Columns_DelRef] [!code-vbTableSnippets2#_Table_Columns_DelRef]
Example
The following example removes a particular column by index.
[!code-csharpTableSnippets2#_Table_Columns_DelIndex] [!code-vbTableSnippets2#_Table_Columns_DelIndex]
Example
The following example removes all columns from the table's columns collection.
[!code-csharpTableSnippets2#_Table_Columns_Clear] [!code-vbTableSnippets2#_Table_Columns_Clear]