RichTextBox.Document Propiedad

Definición

Obtiene o establece el FlowDocument que representa el contenido de 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

Valor de propiedad

FlowDocument

Objeto FlowDocument que representa el contenido de RichTextBox.

De forma predeterminada, esta propiedad está establecida en un FlowDocument vacío. En concreto, el FlowDocument vacío contiene un Paragraph único, que contiene un Run único sin texto.

Excepciones

Se intentó establecer esta propiedad en null.

Se realiza un intento para establecer esta propiedad en un FlowDocument que representa el contenido de otro RichTextBox.

Esta propiedad se establece mientras se ha activado un bloque de cambios.

Ejemplos

En el ejemplo siguiente se muestra el uso de esta propiedad.

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

Comentarios

FlowDocument solo se puede hospedar en un único RichTextBoxobjeto . No se admite especificar un solo FlowDocument como contenido de varios RichTextBox controles.

Se aplica a