<Window x:Class="Documents.RichTextEditor"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="RichTextEditor" Height="400" Width="442"
    >
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"></RowDefinition>
        <RowDefinition></RowDefinition>
        <RowDefinition Height="Auto"></RowDefinition>
        <RowDefinition></RowDefinition>
      </Grid.RowDefinitions>
      <ToolBarTray >
        <ToolBar>
          <Button Click="cmdNew_Click">New</Button>
          <Button Click="cmdOpen_Click">Open</Button>
          <Button Click="cmdSave_Click">Save</Button>
        </ToolBar>
        <ToolBar FontFamily="Times New Roman">
          <Button FontWeight="Bold" Click="cmdBold_Click">B</Button>
          <Button FontStyle="Italic" Command="EditingCommands.ToggleItalic">I</Button>
          <Button Command="EditingCommands.ToggleUnderline">U</Button>
        </ToolBar>
        <ToolBar>
          <Button Click="cmdShowXAML_Click">Show Flow Document XAML</Button>
        </ToolBar>
      </ToolBarTray>
      <RichTextBox Name="richTextBox" Grid.Row="1" PreviewMouseDown="richTextBox_MouseDown">
        <FlowDocument>
          <Paragraph FontSize="20" FontWeight="Bold" TextDecorations="Underline">
            Chapter 1
          </Paragraph>
          
          <Paragraph>
            It was a bright cold day in April, and the clocks were striking thirteen. Winston Smith, his chin nuzzled into his breast in an effort to escape the vile wind, slipped quickly through the glass doors of Victory Mansions, though not quickly enough to prevent a swirl of gritty dust from entering along with him.
          </Paragraph>
          <Paragraph>
            The hallway smelt of boiled cabbage and old rag mats. At one end of it a coloured poster, too large for indoor display, had been tacked to the wall. It depicted simply an enormous face, more than a metre wide: the face of a man of about forty-five, with a heavy black moustache and ruggedly handsome features. Winston made for the stairs. It was no use trying the lift. Even at the best of times it was seldom working, and at present the electric current was cut off during daylight hours. It was part of the economy drive in preparation for Hate Week. The flat was seven flights up, and Winston, who was thirty-nine and had a varicose ulcer above his right ankle, went slowly, resting several times on the way. On each landing, opposite the lift-shaft, the poster with the enormous face gazed from the wall. It was one of those pictures which are so contrived that the eyes follow you about when you move. BIG BROTHER IS WATCHING YOU, the caption beneath it ran.
          </Paragraph>
        </FlowDocument>
      </RichTextBox>
      <GridSplitter Grid.Row="2" Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Center"></GridSplitter>
      
      <TextBox Grid.Row="3" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" Margin="5" Name="txtFlowDocumentMarkup"></TextBox>
    </Grid>
</Window>
