<ContentDialog
    x:Class="JumpPoint.Uwp.Dialogs.FolderTemplatePicker"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:JumpPoint.Uwp.Dialogs"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:templates="using:JumpPoint.Platform.Items.Templates"
    xmlns:converters="using:JumpPoint.Uwp.Converters"
    mc:Ignorable="d"
    Title="Folder Templates"
    PrimaryButtonText="Pick"
    CloseButtonText="Cancel"
    DefaultButton="Primary"
    IsPrimaryButtonEnabled="{x:Bind ViewModel.IsValid, Mode=OneWay}">

    <ContentDialog.Resources>
        <Style TargetType="local:FolderTemplatePicker"
               BasedOn="{StaticResource DefaultContentDialogStyle}" />
    </ContentDialog.Resources>

    <Grid>
        <GridView SelectionMode="Single"
                  ItemsSource="{x:Bind ViewModel.FolderTemplates, Mode=OneWay}"
                  SelectedItem="{Binding Template, Mode=TwoWay}">
            <GridView.ItemTemplate>
                <DataTemplate x:DataType="templates:FolderTemplate">
                    <Image Height="32"
                           Width="32">
                        <Image.Source>
                            <BitmapImage DecodePixelHeight="32"
                                         DecodePixelWidth="32"
                                         DecodePixelType="Logical"
                                         UriSource="{x:Bind converters:IconConverter.GetFolderIconUri((templates:FolderTemplate))}" />
                        </Image.Source>
                    </Image>
                </DataTemplate>
            </GridView.ItemTemplate>
        </GridView>
    </Grid>
</ContentDialog>
