<Page
    x:Name="pageRoot"
    x:Class="SSRS.Viewer.App.ViewerPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:SSRS.Viewer.App"
    xmlns:common="using:SSRS.Viewer.App.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:c1="using:C1.Xaml"
    xmlns:sv="using:C1.Xaml.SsrsViewer"
    mc:Ignorable="d">

    <Page.BottomAppBar>
        <CommandBar BorderBrush="Transparent" Opened="CommandBar_Opened">
            <AppBarButton x:Name="btnCopy" Label="Copy" Icon="Copy" Click="btnCopy_Click" />
            <AppBarSeparator />
            <AppBarToggleButton x:Name="btnThumbs" Icon="ViewAll" IsChecked="{Binding IsThumbnailsVisible, ElementName=ssrsViewer, Mode=TwoWay}" Label="Thumbnails" Click="AppBarToggleButton_Click"/>
            <CommandBar.SecondaryCommands>
                <AppBarButton x:Name="btnClose" Label="Close" Icon="Cancel" Click="btnClose_Click" />
                <AppBarSeparator />
                <sv:SearchTool x:Name="searchBar" />
            </CommandBar.SecondaryCommands>
        </CommandBar>
    </Page.BottomAppBar>
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="100"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <sv:C1SsrsViewer x:Name="ssrsViewer" Grid.Row="2" Margin="20,0,20,20" />
        
        <StackPanel Orientation="Horizontal" Grid.Row="1" Visibility="Collapsed">
            <!-- test using C1SsrsViewer commands-->
            <Button Content="Next Page" c1:CommandExtensions.Command="sv:C1SsrsViewer.NextPageCommand" c1:CommandExtensions.CommandTarget="{Binding ElementName=ssrsViewer}"/>
            
        </StackPanel>

        <!-- Back button and page title -->
        <Grid x:Name="titlePanel">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Margin="39,29,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
                        Style="{StaticResource NavigationBackButtonNormalStyle}"
                        VerticalAlignment="Top"
                        AutomationProperties.Name="Back"
                        AutomationProperties.AutomationId="BackButton"
                        AutomationProperties.ItemType="Navigation Button"/>
            <TextBlock x:Name="pageTitle" Text="Loading..." Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1" 
                        IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,0,32"/>
        </Grid>
    </Grid>
</Page>
