<UserControl x:Class="Compdfkit_Tools.PDFControlUI.CPDFBookmarkResultUI"
             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_Tools.PDFControlUI"
             xmlns:convert="clr-namespace:Compdfkit_Tools.Common"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800"  Background="#FAFCFF">
    <UserControl.Resources>
        <ResourceDictionary>
            <convert:ListViewWidthConverter x:Key="ListViewWidthConverter"/>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <ListView Name="ResultListControl" VirtualizingPanel.IsVirtualizingWhenGrouping="True" 
                  SelectionChanged="ResultListControl_SelectionChanged"
                  ScrollViewer.HorizontalScrollBarVisibility="Hidden" BorderThickness="0" SelectionMode="Single" 
                  MouseLeftButtonDown="ResultListControl_MouseLeftButtonDown" Background="#01000000">
            <ListView.GroupStyle>
                <GroupStyle>
                    <GroupStyle.HeaderTemplate>
                        <DataTemplate>
                            <StackPanel Background="#EFF4FF" Height="30" Orientation="Horizontal">
                                
                                <TextBlock Padding="16,4,0,4" FontWeight="SemiBold" FontSize="12"  
                                           FontFamily="Segoe UI" Foreground="#43474D ">Page</TextBlock>
                                <TextBlock  HorizontalAlignment="Left" Padding="10,4,0,4"
                                           FontWeight="SemiBold" FontSize="12"  FontFamily="Segoe UI" Foreground="#43474D" Text="{Binding Name}">
                                </TextBlock>
                                
                            </StackPanel>
                        </DataTemplate>
                    </GroupStyle.HeaderTemplate>
                    <GroupStyle.Panel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel/>
                        </ItemsPanelTemplate>
                    </GroupStyle.Panel>
                </GroupStyle>
            </ListView.GroupStyle>

            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel Background="#EFF4FF" Margin="-5,0,0,0"></VirtualizingStackPanel>
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>

            <ListView.ItemTemplate>
                <ItemContainerTemplate>
                    <Grid Background="#01FFFFFF" Width="{Binding ElementName=ResultListControl,Path=ActualWidth,Converter={StaticResource ListViewWidthConverter}}" MinHeight="30" 
                          MouseEnter="Grid_MouseEnter" MouseLeave="Grid_MouseLeave" Tag="{Binding}" MouseLeftButtonDown="Grid_MouseLeftButtonDown">
                       
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                            <ColumnDefinition Width="auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        
                        <TextBox MinHeight="20" VerticalAlignment="Center" Margin="20,0,5,0" IsReadOnly="True" BorderThickness="0" IsHitTestVisible="False"
                                 AcceptsReturn="True" Background="Transparent" Foreground="#43474D" Text="{Binding BindProperty.BookmarkTitle}"></TextBox>

                        <Border VerticalAlignment="Center" Grid.Column="1" Padding="10,5,10,5" Visibility="Collapsed">
                            <StackPanel Orientation="Horizontal">
                                <Border MouseLeftButtonDown="EditBorder_Click" Background="#01FFFFFF">
                                    <Viewbox Width="16" Height="16">
                                        <Path Fill="#43474D">
                                            <Path.Data>
                                                M7.71094 15L15.2031 7.5L9.5 1.79688L0.890625 10.4062C0.765625 10.5312 0.670573 10.6784 0.605469 10.8477C0.540365 11.0169 0.507812 11.1927
                                                0.507812 11.375C0.507812 11.5573 0.540365 11.7331 0.605469 11.9023C0.670573 12.0716 0.768229 12.2214 0.898438 12.3516L3.53906 
                                                15H7.71094ZM8.5 12.7969L4.20312 8.5L9.5 3.20312L13.7969 7.5L8.5 12.7969ZM3.95312 14H7.28906L7.79688 13.5L3.5 9.20312L1.60156 
                                                11.1016C1.53385 11.1693 1.5 11.2604 1.5 11.375C1.5 11.4896 1.53646 11.5833 1.60938 11.6562L3.95312 14ZM16 15V14H10.0182L9 
                                                15H16ZM1.06227 14L2 15H0V14H1.06227Z
                                            </Path.Data>
                                        </Path>
                                    </Viewbox>
                                </Border>

                                <Border MouseLeftButtonDown="DelBorder_Click"  Background="#01FFFFFF">
                                    <Viewbox Margin="10,0,0,0" Width="16" Height="16">
                                        <Path Fill="#43474D">
                                            <Path.Data>
                                                M11.1998 1.19995V3.59995H15.1998V4.39995H13.1998V14.8H2.7998V4.39995H0.799805V3.59995H4.7998V1.19995H11.1998ZM3.5998 
                                                4.39995V14H12.3998V4.39995H3.5998ZM10.3998 1.99995V3.59995H5.5998V1.99995H10.3998ZM6.7998 6.39995V12H5.9998V6.39995H6.7998ZM9.9998 
                                                12V6.39995H9.1998V12H9.9998Z
                                            </Path.Data>
                                        </Path>
                                    </Viewbox>
                                </Border>
                            </StackPanel>
                        </Border>
                    </Grid>
                </ItemContainerTemplate>
            </ListView.ItemTemplate>
        </ListView>

        <TextBlock Name="NoResultText" Foreground="#43474D" FontSize="14" LineHeight="16" VerticalAlignment="Center" HorizontalAlignment="Center">No Bookmark</TextBlock>
    </Grid>
</UserControl>
