RichTextBox.Document Propiedad

Definición

Obtiene o establece el FlowDocument que representa el contenido de RichTextBox.Gets or sets the FlowDocument that represents the contents of the 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.A FlowDocument object that represents the contents of the RichTextBox.

De forma predeterminada, esta propiedad está establecida en un FlowDocument vacío.By default, this property is set to an empty FlowDocument. En concreto, el FlowDocument vacío contiene un Paragraph único, que contiene un Run único sin texto.Specifically, the empty FlowDocument contains a single Paragraph, which contains a single Run which contains no text.

Excepciones

Se intentó establecer esta propiedad en null.An attempt is made to set this property to null.

Se realiza un intento para establecer esta propiedad en un FlowDocument que representa el contenido de otro RichTextBox.An attempt is made to set this property to a FlowDocument that represents the contents of another RichTextBox.

Esta propiedad se establece mientras se ha activado un bloque de cambios.This property is set while a change block has been activated.

Ejemplos

En el siguiente ejemplo se muestra el uso de esta propiedad.The following example illustrates the use of this property.

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

Un FlowDocument solo se puede hospedar en un único RichTextBox .A FlowDocument may only be hosted by a single RichTextBox. No se admite la especificación de un único FlowDocument como contenido de varios RichTextBox controles.Specifying a single FlowDocument as the contents of multiple RichTextBox controls is not supported.

Se aplica a