<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="FooEditor.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:FooEditor"
    xmlns:common="using:FooEditor.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">    
    <Page.TopAppBar>
        <AppBar Padding="10" Name="DocumentCollectionBar" IsOpen="{Binding TopAppBarOpen,Mode=TwoWay}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <GridView Grid.Column="0" Name="DocumentCollectionList" Height="120"
                          IsItemClickEnabled="True" ItemClick="DocumentCollectionList_ItemClick"
                          ItemsSource="{Binding DocumentCollection}"
                          SelectedIndex="{Binding CurrentDocumentIndex,Mode=TwoWay}">
                    <GridView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel Orientation="Horizontal"/>
                        </ItemsPanelTemplate>
                    </GridView.ItemsPanel>
                    <GridView.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Height="120" Width="180">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Button Style="{StaticResource RemoveNoTextLabelAppBarButtonStyle}"
                                            Command="{Binding DataContext.RemoveCommand,ElementName=DocumentCollectionBar}"
                                            CommandParameter="{Binding}"
                                            Grid.Column="1"/>
                                </Grid>
                                <TextBlock Text="{Binding Title}" Padding="10"/>
                            </StackPanel>
                        </DataTemplate>
                    </GridView.ItemTemplate>
                </GridView>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="1">
                    <Button Style="{StaticResource AddNoTextLabelButtonStyle}" Command="{Binding AddCommand}" AutomationProperties.AcceleratorKey="Control N"/>
                </StackPanel>
            </Grid>
        </AppBar>
    </Page.TopAppBar>
    <Frame Name="Frame" Grid.Column="1"/>
    <Page.BottomAppBar>
        <CommandBar Padding="10,0,10,0" IsOpen="{Binding BottomAppBarOpen,Mode=TwoWay}">
            <AppBarButton Icon="Find" x:Uid="SearchButton" Command="{Binding ShowSearchFlyoutCommand}" AutomationProperties.AcceleratorKey="Control F"/>
            <AppBarButton Icon="Go" x:Uid="GoToButton" Command="{Binding ShowGoToFlyoutCommand}" AutomationProperties.AcceleratorKey="Control G"/>
            <AppBarButton Icon="Document" x:Uid="PropertyButton" Command="{Binding ShowPropertyFlyoutCommand}"/>
            <CommandBar.SecondaryCommands>
                <AppBarButton Icon="Undo" x:Uid="UndoButton" Command="{Binding UndoCommand}"/>
                <AppBarButton Icon="Redo" x:Uid="RedoButton" Command="{Binding RedoCommand}"/>
                <AppBarButton Icon="SaveLocal" x:Uid="SaveButton" Command="{Binding SaveCommand}" AutomationProperties.AcceleratorKey="Control S"/>
            </CommandBar.SecondaryCommands>
        </CommandBar>
    </Page.BottomAppBar>
</common:LayoutAwarePage>
