xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="FlowDocument Optimal Paragraph Sample">
IsOptimalParagraphEnabled="True" IsHyphenationEnabled="True"
IsColumnWidthFlexible="True" Background="AliceBlue"
ColumnWidth="300" ColumnGap="20">
this is a test
- Donald E. Knuth
Principle of Optimal Paragraph
this is a test italic
this is a test
this is a test
this is a test
//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Media
Imports System.Windows.Shapes
Namespace WpfApplication1
Public Partial Class Window1
Inherits Window
Private Sub ToggleHyphenation(sender As [Object], args As RoutedEventArgs)
flowDoc.IsHyphenationEnabled = DirectCast(sender, CheckBox).IsChecked.Value
End Sub
Private Sub ToggleOptimalParagraph(sender As [Object], args As RoutedEventArgs)
flowDoc.IsOptimalParagraphEnabled = DirectCast(sender, CheckBox).IsChecked.Value
End Sub
Private Sub ToggleColumnFlex(sender As [Object], args As RoutedEventArgs)
flowDoc.IsColumnWidthFlexible = DirectCast(sender, CheckBox).IsChecked.Value
End Sub
Private Sub ChangeColumnWidth(sender As [Object], args As RoutedEventArgs)
If columnWidthSlider.Value = 0 Then
flowDoc.ColumnWidth = 100
ElseIf columnWidthSlider.Value = 1 Then
flowDoc.ColumnWidth = 200
ElseIf columnWidthSlider.Value = 2 Then
flowDoc.ColumnWidth = 300
ElseIf columnWidthSlider.Value = 3 Then
flowDoc.ColumnWidth = 400
ElseIf columnWidthSlider.Value = 4 Then
flowDoc.ColumnWidth = 500
End If
End Sub
Private Sub ChangeColumnGap(sender As [Object], args As RoutedEventArgs)
If columnGapSlider.Value = 0 Then
flowDoc.ColumnGap = 5
ElseIf columnGapSlider.Value = 1 Then
flowDoc.ColumnGap = 10
ElseIf columnGapSlider.Value = 2 Then
flowDoc.ColumnGap = 15
ElseIf columnGapSlider.Value = 3 Then
flowDoc.ColumnGap = 20
ElseIf columnGapSlider.Value = 4 Then
flowDoc.ColumnGap = 25
End If
End Sub
End Class
End Namespace