<Page
    x:Class="PhotoFilter.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:PhotoFilter"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="using:Windows.UI.Xaml.Controls"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Page.Resources>
        <DataTemplate x:Key="NormalImageTemplate">
            <Grid Height="75">
                <Grid.RowDefinitions>
                    <RowDefinition Height="1"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="1"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="5"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="10"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Image Source="{Binding Photo}" Height="75" Width="75" Grid.Row="1" Grid.RowSpan="3" Grid.Column="1"></Image>
                <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" Grid.Column="3" Grid.Row="2"/>
            </Grid>
        </DataTemplate>
    </Page.Resources>

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.Resources>
            <CollectionViewSource x:Name="groupInfoCVS" IsSourceGrouped="false"/>
            <SolidColorBrush x:Name="textColor" Color="White"></SolidColorBrush>
            <SolidColorBrush x:Name="backgroundColor" Color="Black"></SolidColorBrush>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="50"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Vertical">
            <ProgressBar Name="progressBar" IsIndeterminate="True" Grid.Row="0"></ProgressBar>
            <TextBlock FontSize="32"> PhotoFilter</TextBlock>
        </StackPanel>
        <ListBox x:Name="pictureList" 
                 ItemsSource="{Binding Source={StaticResource groupInfoCVS}}"
                 Tapped="pictureList_Tapped"
                 Grid.Row="1">
            
            <ListBox.GroupStyle>
                <GroupStyle>
                    <GroupStyle.HeaderTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Key}" FontWeight="Bold" />
                        </DataTemplate>
                    </GroupStyle.HeaderTemplate>
                </GroupStyle>
            </ListBox.GroupStyle>

            <ListBox.ItemTemplate>
                <DataTemplate>
                    <ContentControl x:Name="cc" Content="{Binding}" ContentTemplate="{StaticResource NormalImageTemplate}"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</Page>