RichTextBox.Document Eigenschaft

Definition

Dient zum Abrufen oder Festlegen der FlowDocument , die den Inhalt der .RichTextBox

public:
 property System::Windows::Documents::FlowDocument ^ Document { System::Windows::Documents::FlowDocument ^ get(); void set(System::Windows::Documents::FlowDocument ^ value); };
public System.Windows.Documents.FlowDocument Document { get; set; }
member this.Document : System.Windows.Documents.FlowDocument with get, set
Public Property Document As FlowDocument

Eigenschaftswert

Ein FlowDocument Objekt, das den Inhalt der RichTextBox.

Diese Eigenschaft ist standardmäßig auf ein leeres FlowDocumentObjekt festgelegt. Insbesondere enthält die Leere FlowDocument einen einzelnen Paragraph, der einen einzigen Run enthält, der keinen Text enthält.

Ausnahmen

Es wird versucht, diese Eigenschaft auf .null

Es wird versucht, diese Eigenschaft auf eine FlowDocument Eigenschaft festzulegen, die den Inhalt eines anderen RichTextBoxdarstellt.

Diese Eigenschaft wird festgelegt, während ein Änderungsblock aktiviert wurde.

Beispiele

Das folgende Beispiel veranschaulicht die Verwendung dieser Eigenschaft.

// Create a simple FlowDocument to serve as content.
FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("Simple FlowDocument")));
// Create an empty, default RichTextBox.
RichTextBox rtb = new RichTextBox();
// This call sets the contents of the RichTextBox to the specified FlowDocument.
rtb.Document = flowDoc;
// This call gets a FlowDocument representing the contents of the RichTextBox.
FlowDocument rtbContents = rtb.Document;
' Create a simple FlowDocument to serve as content.
Dim flowDoc As New FlowDocument(New Paragraph(New Run("Simple FlowDocument")))
' Create an empty, default RichTextBox.
Dim rtb As New RichTextBox()
' This call sets the contents of the RichTextBox to the specified FlowDocument.
rtb.Document = flowDoc
' This call gets a FlowDocument representing the contents of the RichTextBox.
Dim rtbContents As FlowDocument = rtb.Document

Hinweise

Ein FlowDocument kann nur von einem einzelnen RichTextBoxgehostet werden. Das Angeben eines einzelnen FlowDocument-Elements als Inhalt mehrerer RichTextBox Steuerelemente wird nicht unterstützt.

Gilt für: