<!--  Copyright (c) Microsoft Corporation. All rights reserved.  -->
<!--  Licensed under the MIT License.  -->
<Page
    x:Class="ImageResizer.Views.ResultsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:m="using:ImageResizer.Models"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock
            x:Uid="Results_MainInstruction"
            Margin="{StaticResource PageSectionMargin}"
            Style="{StaticResource SubtitleTextBlockStyle}" />

        <ScrollViewer
            Grid.Row="1"
            HorizontalAlignment="Stretch"
            VerticalScrollBarVisibility="Auto">
            <ItemsControl Margin="12,4,12,0" ItemsSource="{x:Bind ViewModel.Errors, Mode=OneWay}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate x:DataType="m:ResizeError">
                        <StackPanel>
                            <TextBlock
                                Margin="0,8,0,0"
                                FontWeight="Bold"
                                Text="{x:Bind File}" />
                            <TextBlock Text="{x:Bind Error}" TextWrapping="Wrap" />
                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>

        <Border
            Grid.Row="2"
            Margin="0,12,0,0"
            Padding="12"
            Background="{ThemeResource LayerFillColorDefaultBrush}"
            BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"
            BorderThickness="0,1,0,0">
            <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
                <Button MinWidth="{StaticResource ButtonMinWidth}" Command="{x:Bind ViewModel.CloseCommand}">
                    <Button.KeyboardAccelerators>
                        <KeyboardAccelerator Key="Escape" />
                    </Button.KeyboardAccelerators>
                    <TextBlock x:Uid="Results_Close" />
                </Button>
            </StackPanel>
        </Border>
    </Grid>
</Page>
