<controls:DockPanel
    x:Class="Pixeval.Pages.Tags.TagsEntry"
    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:controls1="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.Pages.Tags"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    HorizontalSpacing="20"
    mc:Ignorable="d">
    <controls1:LazyImage
        Width="50"
        Height="50"
        controls:DockPanel.Dock="Left"
        Source="{x:Bind ViewModel.Thumbnail, Mode=OneWay}" />
    <CommandBar
        Width="125"
        VerticalAlignment="Center"
        controls:DockPanel.Dock="Right"
        DefaultLabelPosition="Right"
        OverflowButtonVisibility="Visible">
        <!--  Width="125" 是试出来刚好只显示一个按钮的宽度  -->
        <AppBarButton
            x:Uid="/TagsEntry/EditTagItem"
            Click="EditTagItem_OnClicked"
            Icon="{fluent:SymbolIcon Symbol=Tag}" />
        <AppBarButton
            x:Uid="/TagsEntry/OpenItem"
            Click="OpenItem_OnClicked"
            Icon="{fluent:SymbolIcon Symbol=Open}" />
        <AppBarButton
            x:Uid="/TagsEntry/GoToPageItem"
            Click="GoToPageItem_OnClicked"
            Icon="{fluent:SymbolIcon Symbol=OpenFolder}"
            IsEnabled="{x:Bind controls1:C.IsNotZeroL(ViewModel.Id), Mode=OneWay}" />
        <AppBarButton
            x:Uid="/TagsEntry/DeleteItem"
            Click="DeleteItem_OnClicked"
            Icon="{fluent:SymbolIcon Symbol=Delete}" />
        <AppBarButton
            x:Uid="/TagsEntry/OpenLocationItem"
            Click="OpenLocationItem_OnClicked"
            Icon="{fluent:SymbolIcon Symbol=FolderArrowRight}" />
    </CommandBar>
    <StackPanel VerticalAlignment="Center" Spacing="5">
        <TextBlock
            Style="{StaticResource CaptionTextBlockStyle}"
            Text="{x:Bind ViewModel.Name, Mode=OneWay}"
            TextTrimming="CharacterEllipsis"
            TextWrapping="NoWrap" />
        <!--  ItemsRepeater+WrapLayout，回收后的控件会出现重叠bug，不知道怎么解决  -->
        <labs:TokenView
            MinHeight="10"
            IsItemClickEnabled="True"
            ItemClick="TagButton_OnClicked"
            ItemsSource="{x:Bind ViewModel.Tags, Mode=OneWay}"
            SelectionMode="None" />
    </StackPanel>
</controls:DockPanel>
