Block Block Block Block Class

Definition

Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Prerelease APIs are identified by a Prerelease label.

[Contains prerelease APIs.]
An abstract class that provides a base for all block-level content elements.

public : class Block : TextElement, IBlockpublic class Block : TextElement, IBlockPublic Class Block Inherits TextElement Implements IBlock// This API is not available in Javascript.
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Inherited events

Inherited methods

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.

Constructors

Block() Block() Block() Block()

Provides base class initialization behavior for Block derived classes.

protected : Block()protected Block()Protected Sub New()// This API is not available in Javascript.
Attributes

Properties

HorizontalTextAlignment HorizontalTextAlignment HorizontalTextAlignment HorizontalTextAlignment

Prerelease. Gets or sets a value that indicates how text is aligned in the Block.

public : TextAlignment HorizontalTextAlignment { get; set; }public TextAlignment HorizontalTextAlignment { get; set; }Public ReadWrite Property HorizontalTextAlignment As TextAlignment// This API is not available in Javascript.
<Paragraph HorizontalTextAlignment="textAlignmentValue"/>

Value
TextAlignment TextAlignment TextAlignment TextAlignment

One of the TextAlignment enumeration values that specifies how text is aligned. The default is Left.

Attributes
Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.16225.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Remarks

This property supports XAML Standard. It provides the same functionality as the TextAlignement property. If both properties are set to conflicting values, the last one set is used.

HorizontalTextAlignmentProperty HorizontalTextAlignmentProperty HorizontalTextAlignmentProperty HorizontalTextAlignmentProperty

Prerelease. Identifies the HorizontalTextAlignment dependency property.

public : static DependencyProperty HorizontalTextAlignmentProperty { get; }public static DependencyProperty HorizontalTextAlignmentProperty { get; }Public Static ReadOnly Property HorizontalTextAlignmentProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the HorizontalTextAlignment dependency property.

Attributes
Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.16225.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

LineHeight LineHeight LineHeight LineHeight

Gets or sets the height of each line of content.

public : double LineHeight { get; set; }public double LineHeight { get; set; }Public ReadWrite Property LineHeight As double// This API is not available in Javascript.
<Paragraph LineHeight="double"/>
Value
double double double double

The pixel height of each line as modified by LineStackingStrategy. A value of 0 indicates that the line height is determined automatically from the current font characteristics. The default is 0.

Attributes

Remarks

Block is a base class for Paragraph. Paragraph is the only element that you can set a LineHeight value on in Windows Runtime XAML, unless you create a custom class based on Block.

See Also

LineHeightProperty LineHeightProperty LineHeightProperty LineHeightProperty

Identifies the LineHeight dependency property.

public : static DependencyProperty LineHeightProperty { get; }public static DependencyProperty LineHeightProperty { get; }Public Static ReadOnly Property LineHeightProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the LineHeight dependency property.

Attributes

LineStackingStrategy LineStackingStrategy LineStackingStrategy LineStackingStrategy

Gets or sets a value that indicates how a line box is determined for each line of text in the Block.

public : LineStackingStrategy LineStackingStrategy { get; set; }public LineStackingStrategy LineStackingStrategy { get; set; }Public ReadWrite Property LineStackingStrategy As LineStackingStrategy// This API is not available in Javascript.
<Paragraph LineStackingStrategy="BlockLineHeight"/>
-or-
<Paragraph LineStackingStrategy="MaxHeight"/>
Value
LineStackingStrategy LineStackingStrategy LineStackingStrategy LineStackingStrategy

A value that indicates how a line box is determined for each line of text in the Block. The default is MaxHeight.

Attributes

Remarks

Block is a base class for Paragraph. Paragraph is the only element that you can set a LineStackingStrategy value on in Windows Runtime XAML, unless you create a custom class based on Block.

BlockLineHeight and MaxHeight are the only two constant names that exist in the LineStackingStrategy enumeration, so the XAML syntax shows those two choices.

See Also

LineStackingStrategyProperty LineStackingStrategyProperty LineStackingStrategyProperty LineStackingStrategyProperty

Identifies the LineStackingStrategy dependency property.

public : static DependencyProperty LineStackingStrategyProperty { get; }public static DependencyProperty LineStackingStrategyProperty { get; }Public Static ReadOnly Property LineStackingStrategyProperty As DependencyProperty// This API is not available in Javascript.
Attributes

Margin Margin Margin Margin

Gets or sets the amount of space around a Block element.

public : Thickness Margin { get; set; }public Thickness Margin { get; set; }Public ReadWrite Property Margin As Thickness// This API is not available in Javascript.
<Paragraph Margin="uniform"/>
- or -
<Paragraph Margin="left+right,top+bottom"/>
- or -
<Paragraph Margin="left,top,right,bottom"/>
 
Value
Thickness Thickness Thickness Thickness

The amount of space around a Block element.

Attributes

Remarks

Code migration note Microsoft Silverlight doesn't support a Margin property on Block or Paragraph. Windows Presentation Foundation (WPF) has a Margin property on Block and Paragraph, but also has a Padding property there that the Windows Runtime doesn't support. If you need per-paragraph padding support, you might need to put each Paragraph in a different Border container and use a Panel for layout control, and set Border.Padding on each Border. Or, use RichTextBlock.

See Also

MarginProperty MarginProperty MarginProperty MarginProperty

Identifies the Margin dependency property.

public : static DependencyProperty MarginProperty { get; }public static DependencyProperty MarginProperty { get; }Public Static ReadOnly Property MarginProperty As DependencyProperty// This API is not available in Javascript.
Value
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

The identifier for the Margin dependency property.

Attributes

TextAlignment TextAlignment TextAlignment TextAlignment

Gets or sets the horizontal alignment of the text content.

public : TextAlignment TextAlignment { get; set; }public TextAlignment TextAlignment { get; set; }Public ReadWrite Property TextAlignment As TextAlignment// This API is not available in Javascript.
<Paragraph TextAlignment="textAlignmentMemberName"/>
Value
TextAlignment TextAlignment TextAlignment TextAlignment

The horizontal alignment of the text content. The default is Left.

Attributes

Remarks

Block is a base class for Paragraph. Paragraph is the only element that you can set a TextAlignment value on in Windows Runtime XAML, unless you create a custom class based on Block.

TextAlignmentProperty TextAlignmentProperty TextAlignmentProperty TextAlignmentProperty

Identifies the TextAlignment dependency property.

public : static DependencyProperty TextAlignmentProperty { get; }public static DependencyProperty TextAlignmentProperty { get; }Public Static ReadOnly Property TextAlignmentProperty As DependencyProperty// This API is not available in Javascript.
Attributes

See Also