<Page
    x:Class="PdfSamples.RenderUIPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:PdfSamples"
    xmlns:c1="using:C1.Xaml"
    xmlns:fv="using:C1.Xaml.FlexViewer"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Loaded="Page_Loaded"
    mc:Ignorable="d">
    <Page.Resources>
        <Style TargetType="fv:C1FlexViewer">
            <Setter Property="Background" Value="Gray" />
            <Setter Property="BorderThickness" Value="0" />
        </Style>
    </Page.Resources>
    <Grid x:Name="layoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition x:Name="row1" Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid x:Name="panel">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock Text="{Binding Source={StaticResource PdfSamplesLocalization}, Path=TextBlockTB1_Text}" HorizontalAlignment="Left" Grid.ColumnSpan="2" FontSize="14"/>
            <Border x:Name="border1" Grid.Row="1" Grid.Column="0" Background="#8c0095" Margin="3" Padding="5">
                <ToggleSwitch Grid.Column="0" IsOn="True" Header="{Binding Source={StaticResource PdfSamplesLocalization}, Path=ToggleSwitch_Header}" Grid.Row="1"/>
            </Border>
            <Border Grid.Row="1" Grid.Column="1" Background="#D24726" Margin="3" Padding="5">
                <ListBox Width="150">
                    <ListBoxItem Content="{Binding Source={StaticResource PdfSamplesLocalization}, Path=ListBoxItem1_Content}" />
                    <ListBoxItem Content="{Binding Source={StaticResource PdfSamplesLocalization}, Path=ListBoxItem2_Content}" />
                </ListBox>
            </Border>
            <Border Grid.Row="2" Grid.Column="0"  Background="#094AB2" Margin="3" Padding="5">
                <ComboBox x:Name="combo" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="0" />
            </Border>
            <Border Grid.Row="2" Grid.Column="1"  Background="#008B00" Margin="3" Padding="5">
                <CheckBox Content="{Binding Source={StaticResource PdfSamplesLocalization}, Path=CheckBoxCB_Content}" Grid.Row="2" Grid.Column="1" IsChecked="True" />
            </Border>
        </Grid>
        <Grid x:Name="viewer" Margin="5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <TextBlock Text="{Binding Source={StaticResource PdfSamplesLocalization}, Path=TextBlockTB2_Text}" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Bottom" FontSize="14"/>
            <Button Content="{Binding Source={StaticResource PdfSamplesLocalization}, Path=RenderBT_Content}" x:Name="btnRender" Click="btnRender_Click"  Grid.Row="0" Grid.Column="1"  HorizontalAlignment="Right" Margin="5"/>
            <fv:C1FlexViewer x:Name="flexViewer" Grid.Row="1" Grid.ColumnSpan="2"  ZoomMode="PageWidth" />
            <ProgressRing x:Name="progressRing" Grid.Row="1" Grid.ColumnSpan="2"/>
        </Grid>
        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's window size -->
            <VisualStateGroup>
                <VisualState x:Name="WideLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="480" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="panel.(Grid.RowSpan)" Value="2" />
                        <Setter Target="viewer.(Grid.RowSpan)" Value="2" />
                        <Setter Target="viewer.(Grid.Column)" Value="1" />
                        <Setter Target="border1.Width" Value="120" />
                    </VisualState.Setters>
                </VisualState>

                <VisualState x:Name="NarrowLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="0" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="panel.(Grid.ColumnSpan)" Value="2" />
                        <Setter Target="viewer.(Grid.Row)" Value="1" />
                        <Setter Target="viewer.(Grid.ColumnSpan)" Value="2" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
       
    </Grid>
</Page>