RichTextBox.Document Właściwość

Definicja

Pobiera lub ustawia obiekt FlowDocument reprezentujący zawartość obiektu 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

Wartość właściwości

FlowDocument Obiekt reprezentujący zawartość obiektu RichTextBox.

Domyślnie ta właściwość jest ustawiona na pustą FlowDocumentwartość . W szczególności wartość pusta FlowDocument zawiera pojedynczy Paragraphelement , który zawiera pojedynczy element Run , który nie zawiera tekstu.

Wyjątki

Podjęto próbę ustawienia tej właściwości na null.

Podjęto próbę ustawienia tej właściwości na wartość FlowDocument , która reprezentuje zawartość innego RichTextBoxobiektu .

Ta właściwość jest ustawiana podczas aktywowania bloku zmian.

Przykłady

Poniższy przykład ilustruje użycie tej właściwości.

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

Uwagi

Element FlowDocument może być hostowany tylko przez jeden RichTextBoxelement . Określanie pojedynczego elementu FlowDocument jako zawartości wielu RichTextBox kontrolek nie jest obsługiwane.

Dotyczy