<ui:FluentWindow
    x:Class="PowerAccent.UI.Selector"
    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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
    Title="MainWindow"
    MinWidth="0"
    MinHeight="0"
    ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
    DataContext="{Binding RelativeSource={RelativeSource Self}}"
    ExtendsContentIntoTitleBar="True"
    ResizeMode="NoResize"
    ShowInTaskbar="False"
    SizeToContent="WidthAndHeight"
    Visibility="Collapsed"
    WindowBackdropType="None"
    WindowStyle="None"
    mc:Ignorable="d">
    <ui:FluentWindow.Resources>

        <DataTemplate x:Key="DefaultKeyTemplate">
            <TextBlock
                VerticalAlignment="Center"
                FontSize="18"
                Foreground="{DynamicResource TextFillColorPrimaryBrush}"
                Text="{Binding}"
                TextAlignment="Center" />
        </DataTemplate>

        <DataTemplate x:Key="SelectedKeyTemplate">
            <TextBlock
                VerticalAlignment="Center"
                FontSize="18"
                Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
                Text="{Binding}"
                TextAlignment="Center" />
        </DataTemplate>


    </ui:FluentWindow.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <ListBox
            x:Name="characters"
            HorizontalAlignment="Center"
            HorizontalContentAlignment="Stretch"
            VerticalContentAlignment="Stretch"
            Background="Transparent"
            IsHitTestVisible="False">
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="ContentTemplate" Value="{StaticResource DefaultKeyTemplate}" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                <Grid
                                    Width="48"
                                    Height="48"
                                    Margin="0"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    SnapsToDevicePixels="true">
                                    <Rectangle
                                        x:Name="SelectionIndicator"
                                        Margin="7"
                                        HorizontalAlignment="Stretch"
                                        VerticalAlignment="Stretch"
                                        RadiusX="4"
                                        RadiusY="4"
                                        Stroke="{DynamicResource AccentControlElevationBorderBrush}"
                                        StrokeThickness="1"
                                        Visibility="Collapsed">
                                        <Rectangle.Fill>
                                            <SolidColorBrush Color="{DynamicResource SystemAccentColorPrimary}" />
                                        </Rectangle.Fill>
                                    </Rectangle>
                                    <ContentPresenter Margin="12" />

                                </Grid>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsSelected" Value="true">
                                        <Setter TargetName="SelectionIndicator" Property="Visibility" Value="Visible" />
                                        <Setter Property="ContentTemplate" Value="{StaticResource SelectedKeyTemplate}" />
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ListBox.ItemContainerStyle>
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel IsItemsHost="False" Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>

        <Grid
            Grid.Row="1"
            MinWidth="600"
            Background="{DynamicResource LayerOnAcrylicFillColorDefaultBrush}"
            Visibility="{Binding CharacterNameVisibility, UpdateSourceTrigger=PropertyChanged}">
            <TextBlock
                x:Name="characterName"
                Margin="8"
                FontSize="12"
                Foreground="{DynamicResource TextFillColorSecondaryBrush}"
                Text="(U+0000) A COOL LETTER NAME COMES HERE"
                TextAlignment="Center" />
            <Rectangle
                Height="1"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Top"
                Fill="{DynamicResource DividerStrokeColorDefaultBrush}" />
        </Grid>
    </Grid>
</ui:FluentWindow>