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