<controls:SettingsExpander
    x:Class="Pixeval.Controls.Settings.DownloadMacroSettingsExpander"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:CommunityToolkit.WinUI.Controls"
    xmlns:controls2="using:Pixeval.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:fluent="using:FluentIcons.WinUI"
    xmlns:labs="using:CommunityToolkit.Labs.WinUI"
    xmlns:local="using:Pixeval.Settings"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:models="using:Pixeval.Settings.Models"
    x:Uid="/SettingsPage/DownloadPathMacroEntry"
    Description="{x:Bind Entry.DescriptionControl}"
    Header="{x:Bind Entry.Header}"
    Tag="{x:Bind Entry.Attribute}"
    mc:Ignorable="d">
    <controls:SettingsExpander.HeaderIcon>
        <fluent:SymbolIcon Symbol="{x:Bind Entry.HeaderIcon}" />
    </controls:SettingsExpander.HeaderIcon>
    <controls:SettingsExpander.Items>
        <controls:SettingsCard ContentAlignment="Left">
            <StackPanel Spacing="3">
                <labs:TokenView
                    IsItemClickEnabled="True"
                    IsWrapped="True"
                    ItemClick="PathMacroTokenInputBox_OnTokenClick"
                    ItemsSource="{x:Bind models:DownloadMacroAppSettingsEntry.AvailableMacros}"
                    SelectionMode="None">
                    <labs:TokenView.ItemTemplate>
                        <DataTemplate x:DataType="controls2:StringRepresentableItem">
                            <TextBlock Text="{x:Bind StringRepresentation}" ToolTipService.ToolTip="{x:Bind Item}" />
                        </DataTemplate>
                    </labs:TokenView.ItemTemplate>
                </labs:TokenView>
                <RichEditBox
                    x:Name="DownloadPathMacroTextBox"
                    x:Uid="/SettingsPage/DownloadPathMacroTextBox"
                    AcceptsReturn="False"
                    ContextMenuOpening="DownloadPathMacroTextBox_OnContextMenuOpening"
                    GotFocus="DownloadPathMacroTextBox_OnGotFocus"
                    IsSpellCheckEnabled="False"
                    LostFocus="DownloadPathMacroTextBox_OnLostFocus"
                    TextChanged="DownloadPathMacroTextBox_OnTextChanged" />
                <InfoBar
                    x:Name="DownloadMacroInvalidInfoBar"
                    x:Uid="/SettingsPage/DownloadMacroInvalidInfoBar"
                    Severity="Error" />
            </StackPanel>
        </controls:SettingsCard>
    </controls:SettingsExpander.Items>
</controls:SettingsExpander>
