TextBlock TextBlock TextBlock TextBlock Constructors

Definition

Overloads

TextBlock() TextBlock() TextBlock()

Initializes a new instance of the TextBlock class.

TextBlock(Inline) TextBlock(Inline) TextBlock(Inline)

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

TextBlock() TextBlock() TextBlock()

Initializes a new instance of the TextBlock class.

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

TextBlock(Inline) TextBlock(Inline) 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

Parameters

inline
Inline Inline Inline Inline

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

Exceptions

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