<Page x:Class="RichTextBoxSamples.Printing"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:c1RTB="using:C1.Xaml.RichTextBox"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="using:RichTextBoxSamples"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      mc:Ignorable="d" RequestedTheme="Light">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.Resources>
            <DataTemplate x:Name="printTemplate">
                <Grid Width="{Binding ViewManager.PresenterInfo.Width}" Height="{Binding ViewManager.PresenterInfo.Height}" />
            </DataTemplate>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="35" />
            <RowDefinition Height="35" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <StackPanel Orientation="Horizontal">
            <TextBlock Margin="5 0"
                       VerticalAlignment="Center"
                       FontSize="16"
                       Text="{Binding ViewModeText_Text, Source={StaticResource RichTextBoxSamplesLocalization}}" />
            <ComboBox x:Name="cmbViewMode"
                      Width="120"
                      Margin="5 0"
                      SelectionChanged="cmbViewMode_SelectionChanged">
                <ComboBoxItem Content="{Binding ComboBoxItemDraft_Content, Source={StaticResource RichTextBoxSamplesLocalization}}"></ComboBoxItem>
                <ComboBoxItem Content="{Binding ComboBoxItemPrint_Content, Source={StaticResource RichTextBoxSamplesLocalization}}"></ComboBoxItem>
            </ComboBox>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Grid.Row="1">
            <Button x:Name="btnPrint"
                    HorizontalAlignment="Left"
                    Margin="5 0"
                    Click="btnPrint_Click"
                    Content="{Binding Print_Content, Source={StaticResource RichTextBoxSamplesLocalization}}"/>
            <Button x:Name="btnSave"
                    HorizontalAlignment="Left"
                    Margin="5 0"
                    Click="btnSave_Click"
                    Content="{Binding Save_Content, Source={StaticResource RichTextBoxSamplesLocalization}}"/>
        </StackPanel>
        <c1RTB:C1RichTextBoxMenu x:Name="rtbMenu"
                                 Grid.Row="2"
                                 RichTextBox="{Binding ElementName=rtb}" />
        <c1RTB:C1RichTextBox x:Name="rtb"
                             Grid.Row="2"
                             HorizontalContentAlignment="Center"
                             Background="#EEEEEE"
                             FontFamily="Times New Roman"
                             FontSize="20"
                             ViewMode="Print" />
        <VisualStateManager.VisualStateGroups>
            <!-- Visual states reflect the application's window size -->
            <VisualStateGroup>
                <VisualState x:Name="WideLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="540" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                    </VisualState.Setters>
                </VisualState>

                <VisualState x:Name="NarrowLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="0" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="rtbMenu.Visibility" Value="Collapsed" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</Page>