<UserControl
    x:Class="PDF_Master.Views.BOTA.BOTAContent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:bota="clr-namespace:PDF_Master.ViewModels.BOTA"
    xmlns:convert="clr-namespace:PDF_Master.DataConvert"
    xmlns:customcontrol="clr-namespace:PDF_Master.CustomControl"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
    xmlns:local="clr-namespace:PDF_Master.Views.BOTA"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:prism="http://prismlibrary.com/"
    d:DataContext="{d:DesignInstance Type=bota:BOTAContentViewModel}"
    d:DesignHeight="450"
    d:DesignWidth="800"
    SizeChanged="UserControl_SizeChanged"
    prism:ViewModelLocator.AutoWireViewModel="True"
    mc:Ignorable="d">
    <UserControl.Resources>
        <ResourceDictionary>
            <convert:VisibleToBoolConvert x:Key="VisibleToBoolConvert" />
            <convert:BoolToVisible x:Key="BoolToVisibleConvert" />
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid Background="{StaticResource color.sys.layout.mg}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="48" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Border Background="Transparent">
            <Border.ContextMenu>
                <!--  CnotextMenu 不在视觉书树内,绑定其他控件名称需要用到x:Refrence  -->
                <ContextMenu>
                    <MenuItem
                        Name="MenuThumbnail"
                        Header="{Binding Source={x:Reference Name=TabItemThumbnail}, Path=Name}"
                        IsCheckable="True"
                        IsChecked="True"
                        Unchecked="MenuThumbnail_Unchecked" />
                    <MenuItem
                        Name="MenuOutLine"
                        Header="{Binding Source={x:Reference Name=TabItemOutLine}, Path=Name}"
                        IsCheckable="True"
                        IsChecked="True"
                        Unchecked="MenuThumbnail_Unchecked" />
                    <MenuItem
                        Name="MenuBookMark"
                        Header="{Binding Source={x:Reference Name=TabItemBookMark}, Path=Name}"
                        IsCheckable="True"
                        IsChecked="True"
                        Unchecked="MenuThumbnail_Unchecked" />
                    <MenuItem
                        Name="MenuAnnotation"
                        Header="{Binding Source={x:Reference Name=TabItemAnnotation}, Path=Name}"
                        IsCheckable="True"
                        IsChecked="True"
                        Unchecked="MenuThumbnail_Unchecked" />
                    <MenuItem
                        Name="MenuSearch"
                        Header="{Binding Source={x:Reference Name=TabItemSearch}, Path=Name}"
                        IsCheckable="True"
                        IsChecked="True"
                        Unchecked="MenuThumbnail_Unchecked" />
                    <MenuItem
                        Name="MenuFrom"
                        Header="{Binding Source={x:Reference Name=TabItemForm}, Path=Name}"
                        IsCheckable="True"
                        Unchecked="MenuThumbnail_Unchecked"
                        Visibility="Collapsed" />
                    <MenuItem
                        Name="MenuSign"
                        Header="{Binding Source={x:Reference Name=TabItemSign}, Path=Name}"
                        IsCheckable="True"
                        Unchecked="MenuThumbnail_Unchecked"
                        Visibility="Collapsed" />
                </ContextMenu>
            </Border.ContextMenu>
        </Border>
        <TabControl
            Name="TabBOTA"
            Grid.ColumnSpan="2"
            Background="Transparent"
            SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}"
            Style="{StaticResource TabControlWithUnderLineStyle}"
            TabStripPlacement="Left">
            <TabControl.ItemContainerStyle>
                <Style BasedOn="{StaticResource BOTATab}" TargetType="{x:Type customcontrol:IconAndTextTabItem}">
                    <EventSetter Event="PreviewMouseLeftButtonDown" Handler="IconAndTextTabItem_PreviewMouseLeftButtonDown" />
                </Style>
            </TabControl.ItemContainerStyle>
            <!--  建立一个空的标头占位  -->
            <customcontrol:IconAndTextTabItem
                Height="0"
                Margin="0"
                BorderThickness="0"
                IsSelected="True" />
            <customcontrol:IconAndTextTabItem
                x:Name="TabItemThumbnail"
                Width="48"
                Height="48"
                ToolTip="{Binding Tip_Thumbnail}"
                Visibility="{Binding ElementName=MenuThumbnail, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}">
                <customcontrol:IconAndTextTabItem.NormalPathIcon>
                    <PathGeometry Figures="M15 9V17H5L5 3L9 3V7C9 8.10457 9.89543 9 11 9H15ZM14.1716 7H11V3.82843L12.5858 5.41421L14.1716 7ZM17 8V17C17 18.1046 16.1046 19 15 19H5C3.89543 19 3 18.1046 3 17V3C3 1.89543 3.89543 1 5 1H10H10.1716C10.702 1 11.2107 1.21071 11.5858 1.58579L14 4L16.4142 6.41421C16.7893 6.78929 17 7.29799 17 7.82843V8Z" />
                </customcontrol:IconAndTextTabItem.NormalPathIcon>
                <customcontrol:IconAndTextTabItem.SelectedIcon>
                    <PathGeometry Figures="M3 3C3 1.89543 3.89543 1 5 1H10.1716C10.702 1 11.2107 1.21071 11.5858 1.58579L14 4L16.4142 6.41421C16.7893 6.78929 17 7.29799 17 7.82843V17C17 18.1046 16.1046 19 15 19H5C3.89543 19 3 18.1046 3 17V3Z" />
                </customcontrol:IconAndTextTabItem.SelectedIcon>
            </customcontrol:IconAndTextTabItem>
            <customcontrol:IconAndTextTabItem
                x:Name="TabItemOutLine"
                Width="48"
                Height="48"
                Header="大纲"
                ToolTip="{Binding Tip_OutLine}"
                Visibility="{Binding ElementName=MenuOutLine, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}">
                <customcontrol:IconAndTextTabItem.NormalPathIcon>
                    <PathGeometry Figures="M3 6H6V5C6 4.44772 6.44772 4 7 4H18C18.5523 4 19 4.44772 19 5V9C19 9.55228 18.5523 10 18 10H7C6.44772 10 6 9.55228 6 9V8H3V14L6 14V13C6 12.4477 6.44772 12 7 12H18C18.5523 12 19 12.4477 19 13V17C19 17.5523 18.5523 18 18 18H7C6.44772 18 6 17.5523 6 17V16H3C1.89543 16 1 15.1046 1 14V6V2H3V6ZM8 6V8H17V6H8ZM8 16V14H17V16H8Z" />
                </customcontrol:IconAndTextTabItem.NormalPathIcon>
                <customcontrol:IconAndTextTabItem.SelectedIcon>
                    <PathGeometry Figures="M3 6H6V5C6 4.44772 6.44772 4 7 4H18C18.5523 4 19 4.44772 19 5V9C19 9.55228 18.5523 10 18 10H7C6.44772 10 6 9.55228 6 9V8H3V14L6 14V13C6 12.4477 6.44772 12 7 12H18C18.5523 12 19 12.4477 19 13V17C19 17.5523 18.5523 18 18 18H7C6.44772 18 6 17.5523 6 17V16H3C1.89543 16 1 15.1046 1 14V6V2H3V6Z" />
                </customcontrol:IconAndTextTabItem.SelectedIcon>
            </customcontrol:IconAndTextTabItem>
            <customcontrol:IconAndTextTabItem
                x:Name="TabItemBookMark"
                Width="48"
                Height="48"
                Header="书签"
                ToolTip="{Binding Tip_BookMark}"
                Visibility="{Binding ElementName=MenuBookMark, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}">
                <customcontrol:IconAndTextTabItem.NormalPathIcon>
                    <PathGeometry Figures="M11.3793 12.8851C10.6069 12.1494 9.3931 12.1494 8.62069 12.8851L5 16.3333V3H15V16.3333L11.3793 12.8851ZM15.3103 19.3908L10 14.3333L4.68966 19.3908C4.053 19.9971 3 19.5459 3 18.6667V3C3 1.89543 3.89543 1 5 1H15C16.1046 1 17 1.89543 17 3V18.6667C17 19.5459 15.947 19.9971 15.3103 19.3908ZM7 5H8H12H13V6V7H12H8H7V6V5Z" />
                </customcontrol:IconAndTextTabItem.NormalPathIcon>
                <customcontrol:IconAndTextTabItem.SelectedIcon>
                    <PathGeometry Figures="M3 3C3 1.89543 3.89543 1 5 1H15C16.1046 1 17 1.89543 17 3V18.6667C17 19.5459 15.947 19.9971 15.3103 19.3908L10 14.3333L4.68966 19.3908C4.053 19.9971 3 19.5459 3 18.6667V3Z" />
                </customcontrol:IconAndTextTabItem.SelectedIcon>
            </customcontrol:IconAndTextTabItem>
            <customcontrol:IconAndTextTabItem
                x:Name="TabItemAnnotation"
                Width="48"
                Height="48"
                Header="注释"
                ToolTip="{Binding Tip_Annote}"
                Visibility="{Binding ElementName=MenuAnnotation, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}">
                <customcontrol:IconAndTextTabItem.NormalPathIcon>
                    <PathGeometry Figures="M3.5 1.5C2.39543 1.5 1.5 2.39543 1.5 3.5V16.5C1.5 17.6046 2.39543 18.5 3.5 18.5H16.5C17.6046 18.5 18.5 17.6046 18.5 16.5V3.5C18.5 2.39543 17.6046 1.5 16.5 1.5H3.5ZM8.06104 14H6.3584L9.04932 6.24951H10.9561L13.6523 14H11.9443L11.3696 12.1201H8.63574L8.06104 14ZM10.0537 7.79639H9.95703L9.00635 10.9062H10.999L10.0537 7.79639Z" />
                </customcontrol:IconAndTextTabItem.NormalPathIcon>
                <customcontrol:IconAndTextTabItem.SelectedIcon>
                    <PathGeometry Figures="M3.5 1.5C2.39543 1.5 1.5 2.39543 1.5 3.5V16.5C1.5 17.6046 2.39543 18.5 3.5 18.5H16.5C17.6046 18.5 18.5 17.6046 18.5 16.5V3.5C18.5 2.39543 17.6046 1.5 16.5 1.5H3.5ZM8.06104 14H6.3584L9.04932 6.24951H10.9561L13.6523 14H11.9443L11.3696 12.1201H8.63574L8.06104 14ZM10.0537 7.79639H9.95703L9.00635 10.9062H10.999L10.0537 7.79639Z" />
                </customcontrol:IconAndTextTabItem.SelectedIcon>
            </customcontrol:IconAndTextTabItem>
            <customcontrol:IconAndTextTabItem
                x:Name="TabItemSearch"
                Width="48"
                Height="48"
                Header="搜索"
                ToolTip="{Binding Tip_Search}"
                Visibility="{Binding ElementName=MenuSearch, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}">
                <customcontrol:IconAndTextTabItem.NormalPathIcon>
                    <PathGeometry Figures="M14 8.5C14 11.5376 11.5376 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3C11.5376 3 14 5.46243 14 8.5ZM13.0492 14.4633C11.7874 15.4274 10.2106 16 8.5 16C4.35786 16 1 12.6421 1 8.5C1 4.35786 4.35786 1 8.5 1C12.6421 1 16 4.35786 16 8.5C16 10.2105 15.4274 11.7873 14.4634 13.0491L18.4572 17.0429L17.043 18.4571L13.0492 14.4633Z" />
                </customcontrol:IconAndTextTabItem.NormalPathIcon>
                <customcontrol:IconAndTextTabItem.SelectedIcon>
                    <PathGeometry Figures="M14 8.5C14 11.5376 11.5376 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3C11.5376 3 14 5.46243 14 8.5ZM13.0492 14.4633C11.7874 15.4274 10.2106 16 8.5 16C4.35786 16 1 12.6421 1 8.5C1 4.35786 4.35786 1 8.5 1C12.6421 1 16 4.35786 16 8.5C16 10.2105 15.4274 11.7873 14.4634 13.0491L18.4572 17.0429L17.043 18.4571L13.0492 14.4633Z" />
                </customcontrol:IconAndTextTabItem.SelectedIcon>
            </customcontrol:IconAndTextTabItem>
            <customcontrol:IconAndTextTabItem
                x:Name="TabItemForm"
                Width="48"
                Height="48"
                Header="域"
                Visibility="{Binding ElementName=MenuFrom, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}" />
            <customcontrol:IconAndTextTabItem
                x:Name="TabItemSign"
                Width="48"
                Height="48"
                Header="签名"
                Visibility="{Binding ElementName=MenuSign, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}" />
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="SelectionChanged">
                    <i:InvokeCommandAction Command="{Binding TabControlSelectionChangedCommand}" PassEventArgsToCommand="True" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </TabControl>
        <Border
            Grid.Column="1"
            BorderBrush="{StaticResource color.sys.border.neutral.lv3}"
            BorderThickness="1,0">
            <ContentControl prism:RegionManager.RegionName="{Binding BOTAContentRegionName}" />
        </Border>
    </Grid>
</UserControl>