<ResourceDictionary
    x:Class="CharacterMap.Styles.ItemTemplates"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:core="using:CharacterMap.Core"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:h="using:CharacterMap.Helpers"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:models="using:CharacterMap.Models"
    xmlns:services="using:CharacterMap.Services"
    xmlns:viewmodels="using:CharacterMap.ViewModels"
    mc:Ignorable="d">

    <DataTemplate x:Key="SearchResultTemplate" x:DataType="services:IGlyphData">
        <Grid Name="TemplateContent" HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="30" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock
                Margin="4,0,0,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                DataContext="{Binding ElementName=SearchBox}"
                FontFamily="{Binding Path=(core:Properties.FontFamily)}"
                FontSize="16"
                FontStretch="{Binding Path=(core:Properties.FontStretch)}"
                FontStyle="{Binding Path=(core:Properties.FontStyle)}"
                FontWeight="{Binding Path=(core:Properties.FontWeight)}"
                IsColorFontEnabled="True"
                Text="{x:Bind core:Converters.ToHex(UnicodeIndex)}" />
            <TextBlock
                Grid.Column="1"
                VerticalAlignment="Center"
                Text="{x:Bind Description}"
                TextTrimming="CharacterEllipsis" />
            <TextBlock
                Grid.Column="2"
                Margin="12 0 0 0"
                VerticalAlignment="Center"
                FontSize="12"
                Opacity="0.4"
                Text="{x:Bind UnicodeHex}" />
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="FontListItemTemplateSimple" x:DataType="core:InstalledFont">
        <Grid Padding="0 4" Background="Transparent">
            <TextBlock
                Padding="5"
                VerticalAlignment="Center"
                FontFamily="{x:Bind core:Converters.GetPreviewFontSource(DefaultVariant)}"
                FontSize="{ThemeResource FontListFontSize}"
                Text="{x:Bind Name}"
                TextAlignment="Center"
                TextTrimming="CharacterEllipsis"
                TextWrapping="NoWrap" />

        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="FontListToolTipTemplate" x:DataType="core:InstalledFont">
        <StackPanel Spacing="8">
            <TextBlock
                FontSize="12.666"
                Opacity="0.71"
                Text="{x:Bind Name}"
                TextWrapping="Wrap" />
            <TextBlock
                core:Properties.PreviewStringTrigger="{x:Bind DefaultVariant}"
                FontFamily="{x:Bind DefaultVariant.Source}"
                FontSize="32"
                FontStretch="{x:Bind DefaultVariant.DirectWriteProperties.Stretch}"
                FontStyle="{x:Bind DefaultVariant.DirectWriteProperties.Style}"
                FontWeight="{x:Bind DefaultVariant.DirectWriteProperties.Weight}"
                TextWrapping="Wrap" />
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="FontListItemToolTipTemplate" x:DataType="viewmodels:FontItem">
        <StackPanel Spacing="8">
            <TextBlock
                FontSize="12.666"
                Opacity="0.7"
                Text="{x:Bind Tooltip}"
                TextWrapping="Wrap" />
            <TextBlock
                FontFamily="{x:Bind Selected.Source}"
                FontSize="32"
                FontStretch="{x:Bind Selected.DirectWriteProperties.Stretch}"
                FontStyle="{x:Bind Selected.DirectWriteProperties.Style}"
                FontWeight="{x:Bind Selected.DirectWriteProperties.Weight}"
                Text="{x:Bind h:ResourceHelper.AppSettings.GetFamilyPreviewString()}"
                TextWrapping="Wrap" />
        </StackPanel>
    </DataTemplate>


    <DataTemplate x:Key="FontListItemTemplate" x:DataType="core:InstalledFont">
        <Grid
            Name="TemplateContent"
            ColumnSpacing="12"
            Padding="12 4"
            Background="Transparent">
            <!--
                ToolTipService.ToolTip="{x:Bind Name}"
            -->
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock
                Padding="5"
                VerticalAlignment="Center"
                FontFamily="{x:Bind core:Converters.GetPreviewFontSource(DefaultVariant)}"
                FontSize="{ThemeResource FontListFontSize}"
                Text="{x:Bind Name}"
                TextTrimming="CharacterEllipsis"
                TextWrapping="NoWrap" />
            <TextBlock
                Grid.Column="1"
                Padding="5"
                HorizontalAlignment="Right"
                VerticalAlignment="Center"
                Opacity="0.5"
                Text="{x:Bind Variants.Count}"
                Visibility="{x:Bind HasVariants}" />
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="ExportNotificationTemplate" x:DataType="core:ExportResult">
        <Grid ColumnSpacing="12" HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock
                VerticalAlignment="Center"
                FontSize="16"
                IsColorFontEnabled="True"
                TextWrapping="Wrap">
                <Run x:Uid="CharacterSavedMessage" />
                <Run FontWeight="Bold" Text="{x:Bind File.Name}" />
            </TextBlock>

            <Button
                x:Uid="BtnOpenFolder"
                Grid.Column="1"
                Click="OpenFolderButton_Click"
                Style="{StaticResource ButtonRevealStyle}" />

            <Button
                x:Uid="BtnOpenFile"
                Grid.Column="2"
                Click="OpenFileButton_Click"
                Style="{StaticResource ButtonRevealStyle}" />
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="ExportGlyphsTemplate" x:DataType="core:ExportGlyphsResult">
        <Grid ColumnSpacing="12" HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock
                VerticalAlignment="Center"
                FontSize="16"
                IsColorFontEnabled="True"
                Text="{x:Bind GetMessage()}"
                TextWrapping="Wrap" />

            <Button
                x:Uid="BtnOpenFolder"
                Grid.Column="1"
                Click="OpenFolderButton_Click"
                Style="{StaticResource ButtonRevealStyle}" />

        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="ExportFontNotificationTemplate" x:DataType="core:ExportFontFileResult">
        <Grid ColumnSpacing="12" HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock
                VerticalAlignment="Center"
                FontSize="16"
                IsColorFontEnabled="True"
                Text="{x:Bind GetMessage()}"
                TextWrapping="Wrap" />

            <Button
                x:Uid="BtnOpenFolder"
                Grid.Column="1"
                Click="OpenFolderButton_Click"
                Style="{StaticResource ButtonRevealStyle}" />

        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="AddedToCollectionNotificationTemplate" x:DataType="services:AddToCollectionResult">
        <Grid ColumnSpacing="12" HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock VerticalAlignment="Center">
                <Run FontWeight="SemiBold" Text="{x:Bind GetTitle()}" />
                <Run x:Uid="NotificationFontAddedBody" />
                <Hyperlink Click="BtnViewCollection_Click" Foreground="{StaticResource SystemAccentColorLight3}">
                    <Run Text="{x:Bind Collection.Name}" />
                </Hyperlink>
            </TextBlock>

            <Button
                Grid.Column="1"
                Margin="12 0 0 0"
                VerticalAlignment="Center"
                Click="BtnUndo_Click"
                Content="{core:Localizer Key='UndoLabel'}"
                Style="{StaticResource ButtonRevealStyle}"
                Tag="{x:Bind}" />
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="RemoveFromCollectionNotification" x:DataType="models:CollectionUpdatedArgs">
        <Grid ColumnSpacing="12" HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock VerticalAlignment="Center">
                <Run FontWeight="SemiBold" Text="{x:Bind GetTitle()}" />
                <Run x:Uid="NotificationFontRemovedBody" />
                <Hyperlink>
                    <Run Text="{x:Bind Collection.Name}" />
                </Hyperlink>
            </TextBlock>

            <Button
                Grid.Column="1"
                Margin="12 0 0 0"
                VerticalAlignment="Center"
                Click="BtnUndo_Click"
                Content="{core:Localizer Key='UndoLabel'}"
                Style="{StaticResource ButtonRevealStyle}"
                Tag="{x:Bind}"
                d:Content="Undo" />
        </Grid>
    </DataTemplate>

</ResourceDictionary>
