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.
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈