Mega Code Archive

 
Categories / C# / WPF
 

Styled Document

<Window x:Class="Documents.StyledDocument"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="StyleDocument" Height="500" Width="400">   <Window.Resources>     <Style x:Key="Heading">       <Setter Property="Paragraph.FontSize" Value="30"></Setter>       <Setter Property="Paragraph.TextDecorations" Value="Underline"></Setter>       <Setter Property="Paragraph.TextAlignment" Value="Center"></Setter>     </Style>     <Style x:Key="Subheading">       <Setter Property="Paragraph.FontWeight" Value="Bold"></Setter>       <Setter Property="Paragraph.TextAlignment" Value="Center"></Setter>     </Style>   </Window.Resources>   <Grid>     <Grid.RowDefinitions>       <RowDefinition></RowDefinition>       <RowDefinition></RowDefinition>     </Grid.RowDefinitions>     <FlowDocumentScrollViewer>     <FlowDocument Background="LightYellow" IsOptimalParagraphEnabled="False">       <Paragraph Style="{StaticResource Heading}" >         Chapter 1       </Paragraph>       <Paragraph Style="{StaticResource Subheading}">         Part One       </Paragraph>       <Paragraph>         paragraph       </Paragraph>       <Paragraph>         paragraph       </Paragraph>     </FlowDocument>     </FlowDocumentScrollViewer>   <FlowDocumentScrollViewer Grid.Row="1">     <FlowDocument Background="LightYellow" IsOptimalParagraphEnabled="True">       <Paragraph Style="{StaticResource Heading}" >         Chapter 1       </Paragraph>       <Paragraph Style="{StaticResource Subheading}">         Part One       </Paragraph>       <Paragraph>         paragraph       </Paragraph>       <Paragraph>         paragraph       </Paragraph>     </FlowDocument>   </FlowDocumentScrollViewer>        </Grid> </Window>