RichTextBox.Document Propiedad
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene o establece el FlowDocument objeto 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
Objeto FlowDocument que representa el contenido de .RichTextBox
De forma predeterminada, esta propiedad se establece en un vacío FlowDocument. En concreto, el vacío FlowDocument contiene un único Paragraph, que contiene un único Run que no contiene texto.
Excepciones
Se intenta establecer esta propiedad nullen .
Se intenta establecer esta propiedad en un FlowDocument objeto que representa el contenido de otro RichTextBox.
Esta propiedad se establece mientras se activa 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 puede hospedarse en un único RichTextBoxobjeto . No se admite especificar un solo FlowDocument como contenido de varios RichTextBox controles.