Share via


RichTextBox.Document プロパティ

定義

FlowDocument のコンテンツを表す 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

プロパティ値

FlowDocument

FlowDocument のコンテンツを表す RichTextBox オブジェクト。

既定では、このプロパティは空の FlowDocument に設定されます。 具体的には、空の FlowDocument には Paragraph が 1 つあり、その中にテキストを含まない Run が 1 つあります。

例外

このプロパティを null に設定しようとしました。

このプロパティを、別の FlowDocument のコンテンツを表す RichTextBox に設定しようとしました。

このプロパティは、変更ブロックがアクティブになっている場合に設定されます。

次の例は、このプロパティの使用方法を示しています。

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

注釈

FlowDocument は、1 つの RichTextBoxみホストできます。 複数 RichTextBox のコントロールの内容として 1 つの FlowDocument を指定することはサポートされていません。

適用対象