FlowDocument Constructors

Definitie

Initialiseert een nieuw exemplaar van de FlowDocument klasse.

Overloads

Name Description
FlowDocument()

Initialiseert een nieuwe, lege instantie van de FlowDocument klasse.

FlowDocument(Block)

Initialiseert een nieuw exemplaar van de FlowDocument klasse, waarbij een opgegeven Block element wordt toegevoegd als de eerste inhoud.

FlowDocument()

Initialiseert een nieuwe, lege instantie van de FlowDocument klasse.

public:
 FlowDocument();
public FlowDocument();
Public Sub New ()

Van toepassing op

FlowDocument(Block)

Initialiseert een nieuw exemplaar van de FlowDocument klasse, waarbij een opgegeven Block element wordt toegevoegd als de eerste inhoud.

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)

Parameters

block
Block

Een object dat is afgeleid van de abstracte Block klasse, die moet worden toegevoegd als de eerste inhoud.

Uitzonderingen

block is null.

Voorbeelden

In het volgende voorbeeld ziet u het gebruik van deze constructor. In dit geval bevat de FlowDocument structuur een stroomelementblokstructuur die bestaat uit een tekstuitvoering die is genest in een alinea.

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...")))

In het volgende voorbeeld wordt programmatisch een eenvoudige tabel van 2 x 2 gemaakt en wordt vervolgens de FlowDocument constructor gebruikt om een nieuwe FlowDocument tabel te maken die de tabel bevat. Hoewel een iets gecompliceerdere blokstructuur voor stroomelementen wordt gebruikt, is het gebruik van de constructor hetzelfde als in het voorgaande voorbeeld.

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

Opmerkingen

Geldige invoertypen voor block onder andere BlockUIContainer, List, Paragraph, Sectionen Table.

Van toepassing op