Upravit

Sdílet prostřednictvím


TextBlock Constructors

Definition

Initializes a new instance of the TextBlock class.

Overloads

TextBlock()

Initializes a new instance of the TextBlock class.

TextBlock(Inline)

Initializes a new instance of the TextBlock class, adding a specified Inline element as the initial display content.

TextBlock()

Initializes a new instance of the TextBlock class.

public:
 TextBlock();
public TextBlock ();
Public Sub New ()

Applies to

TextBlock(Inline)

Initializes a new instance of the TextBlock class, adding a specified Inline element as the initial display content.

public:
 TextBlock(System::Windows::Documents::Inline ^ inline);
public TextBlock (System.Windows.Documents.Inline inline);
new System.Windows.Controls.TextBlock : System.Windows.Documents.Inline -> System.Windows.Controls.TextBlock
Public Sub New (inline As Inline)

Parameters

inline
Inline

An object deriving from the abstract Inline class, to be added as the initial content.

Exceptions

inline is null.

Examples

The following example demonstrates the use of this constructor. In this case, the TextBlock contains a text Run.

TextBlock txtBlock = new TextBlock(new Run("A bit of text content..."));
Dim txtBlock As New TextBlock(New Run("A bit of text content..."))

Remarks

Valid input types for inline include AnchoredBlock, InlineUIContainer, LineBreak, Run, and Span.

Applies to