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

プロパティ値

RichTextBoxの内容を表すFlowDocument オブジェクト。

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

例外

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

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

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

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

// 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 を指定することはサポートされていません。

適用対象