<phone:PhoneApplicationPage xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"  
    x:Class="HolidayManager.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    xmlns:local="clr-namespace:HolidayManager"
    SupportedOrientations="Portrait" Orientation="Portrait"
    xmlns:WPControls="clr-namespace:WPControls;assembly=WPControls"
    shell:SystemTray.IsVisible="True">

    <phone:PhoneApplicationPage.Resources>
        <local:ColorConverter x:Key="ColorConverter"/>
        <local:ShortDateConverter x:Key="ShortDateConverter"/>
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="Holiday Calendar" Style="{StaticResource PhoneTextNormalStyle}"/>
        </StackPanel>

        <controls:Panorama Grid.Row="1">
            <controls:PanoramaItem Header="Calendar">
                <controls:PanoramaItem.HeaderTemplate>
                    <DataTemplate>
                        
                    </DataTemplate>
                </controls:PanoramaItem.HeaderTemplate>
                <Grid x:Name="ContentPanel" Grid.Row="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"></RowDefinition>
                        <RowDefinition Height="80"></RowDefinition>
                        <RowDefinition Height="80"></RowDefinition>
                    </Grid.RowDefinitions>
                    <WPControls:Calendar HorizontalAlignment="Stretch"
                                 MonthChanged="calendar_MonthChanged"
                                 DoubleTap="calendar_DoubleTap"
                                 ColorConverter="{StaticResource ColorConverter}"
                                 SelectedDate="{Binding SelectedDate, Mode=TwoWay}"
                                 Name="calendar" VerticalAlignment="Top" />

                    <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>

                        <TextBlock FontSize="48" Text="{Binding TotalHolidays}"></TextBlock>
                    </Grid>

                    <Grid Grid.Row="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>

                        <Button IsEnabled="{Binding EnableFullButton, Mode=TwoWay}" Click="Button_Full_Click">Full</Button>
                        <Button IsEnabled="{Binding EnableHalfButton, Mode=TwoWay}" Click="Button_Half_Click" Grid.Column="1">Half</Button>
                        <Button IsEnabled="{Binding EnableRemoveButton, Mode=TwoWay}" Click="Button_Remove_Click" Grid.Column="2">Remove</Button>
                    </Grid>
                </Grid>
            </controls:PanoramaItem>
            <controls:PanoramaItem Header="History">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition Height="80"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>

                        <TextBlock Text="{Binding EmptyMessage}" />
                        <ListBox ItemsSource="{Binding MyHolidays}" SelectedItem="{Binding SelectedListDate, Mode=TwoWay}"
                                 SelectionChanged="ListBox_SelectionChanged">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                                            <ColumnDefinition></ColumnDefinition>
                                            <ColumnDefinition></ColumnDefinition>
                                        </Grid.ColumnDefinitions>

                                        <TextBlock HorizontalAlignment="Left" FontSize="40" Text="{Binding Date, Converter={StaticResource ShortDateConverter}}"></TextBlock>
                                        <TextBlock Grid.Column="1" FontSize="40" Text="  "></TextBlock>
                                        <TextBlock Grid.Column="2" HorizontalAlignment="Right" FontSize="40" Text="{Binding Type}"></TextBlock>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </Grid>
                    <Button Width="200" IsEnabled="{Binding EnableListRemoveButton, Mode=TwoWay}" Click="Button_RemoveList_Click"
                            Grid.Row="1">Remove</Button>
                </Grid>
            </controls:PanoramaItem>
        </controls:Panorama>
        
    </Grid>
 
</phone:PhoneApplicationPage>