<UserControl x:Class="ComPDFKit.Controls.PDFControlUI.CPDFBookmarkAddUI"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:ComPDFKit.Controls.PDFControlUI"
             xmlns:common="clr-namespace:ComPDFKit.Controls.Common"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800" Background="#FAFCFF">
    <UserControl.Resources>
        <ResourceDictionary>
            <local:BoolEnableConvert x:Key="BoolEnableCovert"/>
            <common:TextLengthToVisibilityConverter x:Key="TextLengthToVisibilityConverter"/>
            <common:InvertTextLengthToVisibilityConverter x:Key="InvertTextLengthToVisibilityConvert"/>
            <common:TextLengthToBoolConverter x:Key="TextLengthToBoolConvert"/>
            <common:BotaResourceConverter x:Key="BotaResourceConverter"></common:BotaResourceConverter>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../../Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"></RowDefinition>
            <RowDefinition Height="auto"></RowDefinition>
        </Grid.RowDefinitions>

        <Border Height="36">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Text="{Binding Converter={StaticResource BotaResourceConverter},ConverterParameter=Title_Bookmarks}" Foreground="#43474D" FontSize="14" Margin="16,0,0,0" VerticalAlignment="Center" FontWeight="SemiBold"></TextBlock>

                <Border  Grid.Column="1" Width="16" Height="16" Background="#01000000" HorizontalAlignment="Right" Margin="0,0,16,0" VerticalAlignment="Center"
                         MouseLeftButtonDown="Border_MouseLeftButtonDown">
                    <Path Fill="#43474D">
                        <Path.Data>
                            M8.5 7.5V3H7.5V7.5H3V8.5H7.5V13H8.5V8.5H13V7.5H8.5Z
                        </Path.Data>
                    </Path>
                </Border>
            </Grid>
        </Border>

        <Border Name="BookmarkInputPanel" Grid.Row="1" Background="#DDE9FF" Height="108" Margin="0,5,0,0" Padding="16,0,16,0" Visibility="Collapsed">
            <Grid >
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                </Grid.RowDefinitions>

                <Border Height="28">
                    <TextBlock Name="PageNumText" VerticalAlignment="Center"></TextBlock>
                </Border>

                <Grid  Grid.Row="1">
                    <TextBox Name="BookmarkText" VerticalContentAlignment="Center" Height="30" Padding="5,0,30,0"></TextBox>
                    <TextBlock VerticalAlignment="Center" IsHitTestVisible="False" Margin="10,0,0,0" Foreground="#999999"
                       Visibility="{Binding ElementName=BookmarkText,Path=Text,Converter={StaticResource TextLengthToVisibilityConverter}}"
                       Text="{Binding Converter={StaticResource BotaResourceConverter},ConverterParameter=Holder_BookmarkTitle}"></TextBlock>

                    <Border x:Name="DeleteBorder" Visibility="{Binding ElementName=BookmarkText,Path=Text,Converter={StaticResource InvertTextLengthToVisibilityConvert}}"
                    HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0"
                    Background="#01000000" MouseLeftButtonDown="DeleteBorder_MouseLeftButtonDown">
                        <Path Fill="Black" IsHitTestVisible="False">
                            <Path.Data>
                                M12.5762 3.95117L8.5332 8L12.5762 12.0488L12.0488 12.5762L8 8.5332L3.95117 12.5762L3.42383 
                                12.0488L7.4668 8L3.42383 3.95117L3.95117 3.42383L8 7.4668L12.0488 3.42383L12.5762 3.95117Z
                            </Path.Data>
                        </Path>
                    </Border>
                </Grid>
                
                <StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Right" Margin="0,10,0,0">
                    <Border Width="56" Height="30" Background="#01000000" MouseLeftButtonDown="ButtonCancel_Click">
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="14" Foreground="#1460F3"
                                   Text="{Binding Converter={StaticResource BotaResourceConverter},ConverterParameter=Button_Cancel}"></TextBlock>
                    </Border>

                    <Button Style="{StaticResource ButtonStyle}" IsEnabled="{Binding ElementName=BookmarkText, Path=Text, Converter={StaticResource TextLengthToBoolConvert}}" Margin="10,0,0,0" Width="56" Height="30" Click="ButtonAdd_Click"
                            Content="{Binding Converter={StaticResource BotaResourceConverter},ConverterParameter=Button_Done}"></Button>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>
