RichTextBox.Document Vlastnost

Definice

Získá nebo nastaví FlowDocument , který představuje obsah 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

Hodnota vlastnosti

FlowDocument

Objekt FlowDocument , který představuje obsah objektu RichTextBox.

Ve výchozím nastavení je tato vlastnost nastavena na prázdnou FlowDocument. Konkrétně prázdný FlowDocument obsahuje jeden , který obsahuje jedenParagraphRun, který neobsahuje žádný text.

Výjimky

Došlo k pokusu o nastavení této vlastnosti na null.

Pokus o nastavení této vlastnosti na FlowDocument hodnotu, která představuje obsah jiného RichTextBox.

Tato vlastnost je nastavena, když je aktivovaný blok změn.

Příklady

Následující příklad ukazuje použití této vlastnosti.

// 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

Poznámky

FlowDocument může hostovat pouze jeden RichTextBox. Určení jednoho dokumentu FlowDocument, protože obsah více RichTextBox ovládacích prvků není podporován.

Platí pro