* 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
3.7 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | ||||
|---|---|---|---|---|---|---|---|---|
| How to: Manipulate a FlowDocument through the Blocks Property | 03/30/2017 |
|
|
cbb7291e-3f1b-433e-9e16-f4d93ced14e8 |
How to: Manipulate a FlowDocument through the Blocks Property
These examples demonstrate some of the more common operations that can be performed on a xref:System.Windows.Documents.FlowDocument through the xref:System.Windows.Documents.FlowDocument.Blocks%2A property.
Example
The following example creates a new xref:System.Windows.Documents.FlowDocument and then appends a new xref:System.Windows.Documents.Paragraph element to the xref:System.Windows.Documents.FlowDocument.
[!code-csharpFlowDocumentSnippets#_FlowDocumentBlocksAdd] [!code-vbFlowDocumentSnippets#_FlowDocumentBlocksAdd]
Example
The following example creates a new xref:System.Windows.Documents.Paragraph element and inserts it at the beginning of the xref:System.Windows.Documents.FlowDocument.
[!code-csharpFlowDocumentSnippets#_FlowDocumentBlocksInsert] [!code-vbFlowDocumentSnippets#_FlowDocumentBlocksInsert]
Example
The following example gets the number of top-level xref:System.Windows.Documents.Block elements contained in the xref:System.Windows.Documents.FlowDocument.
[!code-csharpFlowDocumentSnippets#_FlowDocumentBlocksCount] [!code-vbFlowDocumentSnippets#_FlowDocumentBlocksCount]
Example
The following example deletes the last xref:System.Windows.Documents.Block element in the xref:System.Windows.Documents.FlowDocument.
[!code-csharpFlowDocumentSnippets#_FlowDocumentBlocksRemoveLast] [!code-vbFlowDocumentSnippets#_FlowDocumentBlocksRemoveLast]
Example
The following example clears all of the contents (xref:System.Windows.Documents.Block elements) from the xref:System.Windows.Documents.FlowDocument.
[!code-csharpFlowDocumentSnippets#_FlowDocumentBlocksClear] [!code-vbFlowDocumentSnippets#_FlowDocumentBlocksClear]