FlowDocument Konstruktoren
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Initialisiert eine neue Instanz der FlowDocument-Klasse.
Überlädt
| Name | Beschreibung |
|---|---|
| FlowDocument() |
Initialisiert eine neue, leere Instanz der FlowDocument Klasse. |
| FlowDocument(Block) |
Initialisiert eine neue Instanz der FlowDocument Klasse und fügt ein angegebenes Block Element als anfänglichen Inhalt hinzu. |
FlowDocument()
Initialisiert eine neue, leere Instanz der FlowDocument Klasse.
public:
FlowDocument();
public FlowDocument();
Public Sub New ()
Gilt für:
FlowDocument(Block)
Initialisiert eine neue Instanz der FlowDocument Klasse und fügt ein angegebenes Block Element als anfänglichen Inhalt hinzu.
public:
FlowDocument(System::Windows::Documents::Block ^ block);
public FlowDocument(System.Windows.Documents.Block block);
new System.Windows.Documents.FlowDocument : System.Windows.Documents.Block -> System.Windows.Documents.FlowDocument
Public Sub New (block As Block)
Parameter
- block
- Block
Ein Objekt, das von der abstrakten Block Klasse abgeleitet wird, die als anfänglicher Inhalt hinzugefügt werden soll.
Ausnahmen
block ist null.
Beispiele
Im folgenden Beispiel wird die Verwendung dieses Konstruktors veranschaulicht. In diesem Fall enthält die FlowDocument Flusselementblockstruktur, die aus einem in einem Absatz geschachtelten Textlauf besteht.
FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("A bit of text content...")));
Dim flowDocSimple As New FlowDocument(New Paragraph(New Run("A bit of text content...")))
Im folgenden Beispiel wird programmgesteuert eine einfache 2 x 2-Tabelle erstellt und anschließend der FlowDocument Konstruktor verwendet, um eine neue FlowDocument Tabelle mit der Tabelle zu erstellen. Obwohl eine etwas kompliziertere Flusselementblockstruktur verwendet wird, ist die Verwendung des Konstruktors identisch mit dem vorherigen Beispiel.
// A paragraph with sample text will serve as table content.
Paragraph tableText = new Paragraph(new Run("A bit of text content..."));
Table sampleTable = new Table();
// Create and add a couple of columns.
sampleTable.Columns.Add(new TableColumn());
sampleTable.Columns.Add(new TableColumn());
// Create and add a row group and a couple of rows.
sampleTable.RowGroups.Add(new TableRowGroup());
sampleTable.RowGroups[0].Rows.Add(new TableRow());
sampleTable.RowGroups[0].Rows.Add(new TableRow());
// Create four cells initialized with the sample text paragraph.
sampleTable.RowGroups[0].Rows[0].Cells.Add(new TableCell(tableText));
sampleTable.RowGroups[0].Rows[0].Cells.Add(new TableCell(tableText));
sampleTable.RowGroups[0].Rows[1].Cells.Add(new TableCell(tableText));
sampleTable.RowGroups[0].Rows[1].Cells.Add(new TableCell(tableText));
// Finally, use the FlowDocument constructor to create a new FlowDocument containing
// the table constructed above.
FlowDocument flowDoc = new FlowDocument(sampleTable);
' A paragraph with sample text will serve as table content.
Dim tableText As New Paragraph(New Run("A bit of text content..."))
Dim sampleTable As New Table()
' Create and add a couple of columns.
sampleTable.Columns.Add(New TableColumn())
sampleTable.Columns.Add(New TableColumn())
' Create and add a row group and a couple of rows.
sampleTable.RowGroups.Add(New TableRowGroup())
sampleTable.RowGroups(0).Rows.Add(New TableRow())
sampleTable.RowGroups(0).Rows.Add(New TableRow())
' Create four cells initialized with the sample text paragraph.
sampleTable.RowGroups(0).Rows(0).Cells.Add(New TableCell(tableText))
sampleTable.RowGroups(0).Rows(0).Cells.Add(New TableCell(tableText))
sampleTable.RowGroups(0).Rows(1).Cells.Add(New TableCell(tableText))
sampleTable.RowGroups(0).Rows(1).Cells.Add(New TableCell(tableText))
' Finally, use the FlowDocument constructor to create a new FlowDocument containing
' the table constructed above.
Dim flowDocTable As New FlowDocument(sampleTable)
Hinweise
Gültige Eingabetypen für block include BlockUIContainer, , List, Paragraph, , Sectionund Table.