AnchoredBlock::Blocks Property
Gets a BlockCollection containing the top-level Block elements that comprise the contents of the element.
Namespace: System.Windows.Documents
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
<object> <BlockCollection .../> </object>
Property Value
Type: System.Windows.Documents::BlockCollectionA BlockCollection containing the Block elements that comprise the contents of the element.
This property has no default value.
These examples demonstrate some of the more common operations that can be performed on flow content elements through the Blocks property. This property is used to add and remove items from BlockCollection. Flow content elements that feature a Blocks property include:
These examples happen to use Section as the flow content element, but these techniques are applicable to all elements that host a flow content element collection.
The following example creates a new Section and then uses the Add method to add a new Paragraph to the Section contents.
The following example creates a new Paragraph element and inserts it at the beginning of the Section.
The following example gets the number of top-level Block elements contained in the Section.
The following example deletes the last Block element in the Section.
The following example clears all of the contents (Block elements) from the Section.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.