Windows.UI.Xaml.Documents.Block
June 22, 2022 ยท View on GitHub
-description
An abstract class that provides a base for all block-level content elements.
-remarks
Block defines text formatting properties that should apply to all types of Block content. These properties are: LineHeight, LineStackingStrategy, Margin, and TextAlignment. Block also inherits the text formatting properties and other API of TextElement.
In the Windows Runtime XAML vocabulary the only block type is Paragraph. You use Paragraph to define the blocks of text to display within a RichTextBlock control. Every RichTextBlock should include at least one Paragraph.
BlockCollection is a strongly typed collection class that is used by the RichTextBlock.Blocks property. By specifying XAML object elements within a RichTextBlock, you can assign the block text content for the RichTextBlock. This is usually done using an implicit collection and XAML property syntax, such that the Paragraph elements appear as direct children of RichTextBlock in XAML markup. For example:
<RichTextBlock>
<Paragraph>First paragraph.</Paragraph>
<Paragraph>Second paragraph.</Paragraph>
<Paragraph>Third paragraph. <Bold>With an inline.</Bold></Paragraph>
</RichTextBlock>
Block derived classes
Block is the parent class for Paragraph.
Migration notes
The Windows Runtime XAML vocabulary doesn't support a Section class. If you're migrating XAML from Windows Presentation Foundation (WPF) or Microsoft Silverlight, use a Paragraph block element instead.
Version history
| Windows version | SDK version | Value added |
|---|---|---|
| 1709 | 16299 | HorizontalTextAlignment |