TextBlock Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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)
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.