<UserControl
    x:Class="Pixeval.Controls.WorkContainer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:Pixeval.Controls"
    xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:fluent="using:FluentIcons.WinUI"
    xmlns:flyoutContent="using:Pixeval.Controls.FlyoutContent"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pixeval="using:Pixeval"
    mc:Ignorable="d">
    <UserControl.Resources>
        <TeachingTip
            x:Name="AddToBookmarkTeachingTip"
            x:Uid="/WorkContainer/AddToBookmarkTeachingTip"
            CloseButtonClick="AddToBookmarkTeachingTip_OnCloseButtonClick"
            IsLightDismissEnabled="True"
            Tag="{x:Bind AddAllToBookmarkButton}">
            <flyoutContent:BookmarkTagSelector
                x:Name="BookmarkTagSelector"
                MaxHeight="{StaticResource TeachingTipContentMaxHeightWithTarget}"
                Loading="Content_OnLoading"
                Tag="{x:Bind AddToBookmarkTeachingTip}"
                Type="{x:Bind WorkView.Type, Mode=OneWay}" />
        </TeachingTip>
    </UserControl.Resources>
    <controls1:DockPanel>
        <controls1:DockPanel
            Margin="{StaticResource ComboBoxLeftIndent}"
            controls1:DockPanel.Dock="Top"
            HorizontalSpacing="10">
            <StackPanel
                x:Name="ExtraCommandsBar"
                VerticalAlignment="Center"
                controls1:DockPanel.Dock="Left"
                Orientation="Horizontal"
                Spacing="10">
                <controls:EnumComboBox
                    x:Name="SortOptionComboBox"
                    SelectedEnum="{x:Bind pixeval:App.AppViewModel.AppSettings.WorkSortOption}"
                    SelectionChanged="SortOptionComboBox_OnSelectionChanged"
                    Style="{StaticResource WorkSortOptionComboBoxStyle}" />
                <AutoSuggestBox
                    x:Uid="/WorkContainer/FilterAutoSuggestBox"
                    Width="250"
                    VerticalAlignment="Center"
                    QueryIcon="{fluent:SymbolIcon Symbol=Filter,
                                                  FontSize={StaticResource SmallIconFontSize}}"
                    QuerySubmitted="FilterAutoSuggestBox_QuerySubmitted" />
            </StackPanel>
            <CommandBar controls1:DockPanel.Dock="Right" DefaultLabelPosition="Right">
                <AppBarToggleButton
                    x:Uid="/WorkContainer/SelectionButton"
                    Icon="{fluent:SymbolIcon Symbol=Multiselect}"
                    IsChecked="{x:Bind WorkView.ViewModel.IsSelecting, Mode=TwoWay}" />
            </CommandBar>
            <CommandBar
                x:Name="CommandBar"
                DefaultLabelPosition="Right"
                Visibility="{x:Bind controls:C.ToVisibility(WorkView.ViewModel.IsSelecting), Mode=OneWay}">
                <AppBarButton
                    Click="CancelSelectionButton_OnClicked"
                    Icon="{fluent:SymbolIcon Symbol=SelectAllOff}"
                    IsEnabled="{x:Bind WorkView.ViewModel.IsAnyEntrySelected, Mode=OneWay}"
                    Label="{x:Bind WorkView.ViewModel.SelectionLabel, Mode=OneWay}" />
                <AppBarButton
                    x:Uid="/WorkContainer/SelectAllButton"
                    Click="SelectAllToggleButton_OnClicked"
                    Icon="{fluent:SymbolIcon Symbol=SelectAllOn}" />
                <AppBarSeparator />
                <AppBarButton
                    x:Name="AddAllToBookmarkButton"
                    x:Uid="/WorkContainer/AddAllToBookmarkButton"
                    Click="AddAllToBookmarkButton_OnClicked"
                    Icon="{fluent:SymbolIcon Symbol=Bookmark}"
                    IsEnabled="{x:Bind WorkView.ViewModel.IsAnyEntrySelected, Mode=OneWay}" />
                <AppBarButton
                    x:Uid="/WorkContainer/SaveAllButton"
                    Click="SaveAllButton_OnClicked"
                    Icon="{fluent:SymbolIcon Symbol=Save}"
                    IsEnabled="{x:Bind WorkView.ViewModel.IsAnyEntrySelected, Mode=OneWay}" />
                <AppBarButton
                    x:Uid="/WorkContainer/OpenAllInBrowserButton"
                    Click="OpenAllInBrowserButton_OnClicked"
                    Icon="{fluent:SymbolIcon Symbol=GlobeArrowUp}"
                    IsEnabled="{x:Bind WorkView.ViewModel.IsAnyEntrySelected, Mode=OneWay}" />
            </CommandBar>
        </controls1:DockPanel>
        <controls:WorkView
            x:Name="WorkView"
            x:FieldModifier="public"
            ViewModelChanged="WorkView_OnViewModelChanged" />
    </controls1:DockPanel>
</UserControl>
