<Page
    x:Class="YellowPad.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:YellowPad"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <local:IndexToPageNumberConverter x:Key="indexToPageNumber" />
    </Page.Resources>

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <FlipView Name="flipView"
                  SelectionChanged="OnFlipViewSelectionChanged">
            <FlipView.ItemTemplate>
                <DataTemplate>
                    <Grid HorizontalAlignment="Center"
                          VerticalAlignment="Center">

                        <local:YellowPadPage InkFileManager="{Binding}" />

                        <TextBlock Name="pageNumTextBlock"
                                   HorizontalAlignment="Right"
                                   VerticalAlignment="Top"
                                   FontSize="12"
                                   Foreground="Black"
                                   Margin="6"
                                   Text="{Binding ElementName=flipView, 
                                                  Path=SelectedIndex,
                                   Converter={StaticResource indexToPageNumber}}" />
                    </Grid>
                </DataTemplate>
            </FlipView.ItemTemplate>
        </FlipView>
    </Grid>

    <Page.BottomAppBar>
        <AppBar Name="bottomAppBar"
        Opened="OnAppBarOpened">
            <Grid>
                <StackPanel Orientation="Horizontal"
                    HorizontalAlignment="Left">

                    <Button Name="copyAppBarButton"
                    Style="{StaticResource CopyAppBarButtonStyle}"
                    Click="OnCopyAppBarButtonClick" />

                    <Button Name="cutAppBarButton"
                    Style="{StaticResource CutAppBarButtonStyle}"
                    Click="OnCutAppBarButtonClick" />

                    <Button Name="pasteAppBarButton"
                    Style="{StaticResource PasteAppBarButtonStyle}"
                    Click="OnPasteAppBarButtonClick" />

                    <Button Name="deleteAppBarButton"
                    Style="{StaticResource DeleteAppBarButtonStyle}"
                    Click="OnDeleteAppBarButtonClick" />
                </StackPanel>

                <StackPanel Orientation="Horizontal"
                    HorizontalAlignment="Right">
                    <ComboBox Name="penSizeComboBox"
                        SelectionChanged="OnPenSizeComboBoxSelectionChanged"
                        Width="200"
                        Margin="20 0">
                        <x:Double>2</x:Double>
                        <x:Double>3</x:Double>
                        <x:Double>4</x:Double>
                        <x:Double>5</x:Double>
                        <x:Double>7</x:Double>
                        <x:Double>10</x:Double>

                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <Path StrokeThickness="{Binding}"
                                Stroke="Black"
                                StrokeStartLineCap="Round"
                                StrokeEndLineCap="Round"
                                Data="M 0 0 C 50 20 100 0 150 20" />
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>

                    <ComboBox Name="colorComboBox"
                        SelectionChanged="OnColorComboBoxSelectionChanged"
                        Width="200"
                        Margin="20 0">
                        <Color>#FF0000</Color>
                        <Color>#800000</Color>
                        <Color>#FFFF00</Color>
                        <Color>#808000</Color>
                        <Color>#00FF00</Color>
                        <Color>#008000</Color>
                        <Color>#00FFFF</Color>
                        <Color>#008080</Color>
                        <Color>#0000FF</Color>
                        <Color>#000080</Color>
                        <Color>#FF00FF</Color>
                        <Color>#800080</Color>
                        <Color>#C0C0C0</Color>
                        <Color>#808080</Color>
                        <Color>#404040</Color>
                        <Color>#000000</Color>

                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <Path StrokeThickness="6"
                                StrokeStartLineCap="Round"
                                StrokeEndLineCap="Round"
                                Data="M 0 0 C 50 20 100 0 150 20">
                                    <Path.Stroke>
                                        <SolidColorBrush Color="{Binding}" />
                                    </Path.Stroke>
                                </Path>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>
                </StackPanel>
            </Grid>
        </AppBar>
    </Page.BottomAppBar>
</Page>
