Table Flow Content : FlowDocument « Windows Presentation Foundation « VB.Net






Table Flow Content

Table Flow Content
    
<Window x:Class="Documents.FlowContent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="FlowContent" Height="400" Width="600">

    <FlowDocumentScrollViewer Name="docViewer" IsToolBarVisible="True" >
    <FlowDocument>      
      <BlockUIContainer>
        <Button Click="cmdCreateDynamicDocument_Click" HorizontalAlignment="Left" Padding="5">Create a Dynamic Document</Button>
      </BlockUIContainer>
      <Paragraph FontSize="20pt">Largest Cities in the Year 100</Paragraph>
      <Table>
        <Table.Columns>
          <TableColumn Width="*"></TableColumn>
          <TableColumn Width="3*"></TableColumn>
          <TableColumn Width="*"></TableColumn>
        </Table.Columns>

        <TableRowGroup  >
          <TableRow FontWeight="Bold" >
            <TableCell >
              <Paragraph>Title 1</Paragraph>
            </TableCell>
            <TableCell>
              <Paragraph>Title 2</Paragraph>
            </TableCell>
            <TableCell>
              <Paragraph>Title 3</Paragraph>
            </TableCell>
          </TableRow>
          <TableRow>
            <TableCell>
              <Paragraph>A</Paragraph>
            </TableCell>
            <TableCell>
              <Paragraph>A</Paragraph>
            </TableCell>
            <TableCell>
              <Paragraph>A</Paragraph>
            </TableCell>
          </TableRow>
        </TableRowGroup>
      </Table>
    </FlowDocument>
  </FlowDocumentScrollViewer>

</Window>

//File:Window.xaml.vb

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes

Namespace Documents
  Public Partial Class FlowContent
    Inherits System.Windows.Window
    Public Sub New()
      InitializeComponent()
    End Sub
    Private Sub cmdCreateDynamicDocument_Click(sender As Object, e As RoutedEventArgs)
      Dim runFirst As New Run()
      runFirst.Text = "A "

      Dim bold As New Bold()
      Dim runBold As New Run()
      runBold.Text = "bold "
      bold.Inlines.Add(runBold)

      Dim runLast As New Run()
      runLast.Text = " documents"

      Dim paragraph As New Paragraph()
      paragraph.Inlines.Add(runFirst)
      paragraph.Inlines.Add(bold)
      paragraph.Inlines.Add(runLast)

      Dim document As New FlowDocument()
      document.Blocks.Add(paragraph)

      docViewer.Document = document
    End Sub
  End Class
End Namespace

   
    
    
    
  








Related examples in the same category

1.Add Paragraph to a FlowDocumentAdd Paragraph to a FlowDocument
2.Add Figure into a ParagraphAdd Figure into a Paragraph
3.FlowDocument with a ParagraphFlowDocument with a Paragraph
4.Paragraph elements and FlowDocumentPageViewerParagraph elements and FlowDocumentPageViewer
5.List with ListItems in a FlowDocumentList with ListItems in a FlowDocument
6.Put Paragraph to a ListItemPut Paragraph to a ListItem
7.Table in a FloaterTable in a Floater
8.Set font size for FlowDocumentSet font size for FlowDocument
9.Preserve space in FlowDocumentPreserve space in FlowDocument
10.TableCell and TableRow and TableRowGroupTableCell and TableRow and TableRowGroup
11.Put List to FlowDocumentPut List to FlowDocument
12.Use Table to display tabular data.Use Table to display tabular data.
13.Hyperlink Element
14.Paged ContentPaged Content
15.Text JustificationText Justification
16.Add Bold line to ParagraphAdd Bold line to Paragraph
17.A Paragraph inside a FloaterA Paragraph inside a Floater
18.Add Run of text to a ParagraphAdd Run of text to a Paragraph
19.Set HorizontalAnchor, VerticalAnchor, Background for FigureSet HorizontalAnchor, VerticalAnchor, Background for Figure
20.Nested listsNested lists
21.FontWeight of ParagraphFontWeight of Paragraph
22.BlockUIContainer with a Button along with ParagraphBlockUIContainer with a Button along with Paragraph
23.List MarkerStyleList MarkerStyle
24.Explicit table columnsExplicit table columns
25.Specifying figure widths in columns unitsSpecifying figure widths in columns units
26.Programmatically change the FlowDirection of content within a FlowDocumentReader elementProgrammatically change the FlowDirection of content within a FlowDocumentReader element
27.Use FlowDocumentReader to display FlowDocumentUse FlowDocumentReader to display FlowDocument
28.Programmatically Create and Save a FlowDocumentProgrammatically Create and Save a FlowDocument
29.Use XamlDesignerSerializationManager to write FlowDocumentUse XamlDesignerSerializationManager to write FlowDocument
30.Show FlowDocumentShow FlowDocument
31.Change FlowDocument Width and HeightChange FlowDocument Width and Height
32.Clear FlowDocumentReaderClear FlowDocumentReader
33.Programmatically add rows to a Table element.Programmatically add rows to a Table element.
34.Toggle Hyphenation, Optimal Paragraph, and Column FlexToggle Hyphenation, Optimal Paragraph, and Column Flex
35.Use basic typographic properties.Use basic typographic properties.
36.Annotation ServiceAnnotation Service