<Page
    x:Class="PdfViewerSamples.LargeFile"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:PdfViewerSamples"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:c1="using:C1.Xaml"
    xmlns:c1Pdf="using:C1.Xaml.PdfViewer"
    mc:Ignorable="d">
    <Grid>
        <StackPanel x:Name="loading" VerticalAlignment="Center">
            <TextBlock x:Name="tbloading" Text="Downloading document from ComponentOne..." TextAlignment="Center"/>
            <c1:C1ProgressBar IsIndeterminate="True" IndeterminateForeground="#FF2C383D" Height="8"/>
        </StackPanel>
        <Button x:Name="retry" HorizontalAlignment="Center" VerticalAlignment="Center" Content="Retry" Visibility="Collapsed" Click="Retry_Click" />
        <Grid x:Name="viewer">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <c1Pdf:C1PdfViewer x:Name="pdfViewer" ViewMode="Fitted" Grid.Row="1" Grid.ColumnSpan="2"/>
            <TextBlock x:Name="tb" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Foreground="{ThemeResource ApplicationForegroundThemeBrush}" >
                <Run Text="{Binding ElementName=pdfViewer, Path=PageNumber}"/>
                <Run Text=" / "/>
                <Run Text="{Binding ElementName=pdfViewer, Path=PageCount}"/>
            </TextBlock>
        </Grid>
        <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="tb.FontSize" Value="12" />
                        <Setter Target="tbloading.FontSize" Value="12" />
                        <Setter Target="retry.FontSize" Value="12" />
                        <Setter Target="retry.Width" Value="80" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</Page>