<UserControl x:Class="Compdfkit_Tools.PDFControlUI.CPDFSearchResultUI"
             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">
    <UserControl.Resources>
        <ResourceDictionary>
            <convert:ListViewWidthConverter x:Key="ListViewWidthConverter"/>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Background="#FAFCFF">
        <ListView Name="ResultListControl" SelectionChanged="ListView_SelectionChanged" VirtualizingPanel.IsVirtualizingWhenGrouping="True" 
                  ScrollViewer.HorizontalScrollBarVisibility="Hidden" BorderThickness="0" SelectionMode="Single" Visibility="Collapsed">
            <ListView.GroupStyle>
                <GroupStyle>
                    <GroupStyle.HeaderTemplate>
                        <DataTemplate>
                            <StackPanel Background="White" Height="24">
                                <TextBlock Padding="0,4,12,4" VerticalAlignment="Stretch" TextAlignment="Center" HorizontalAlignment="Right" 
                                           FontWeight="SemiBold" FontSize="12" Text="{Binding Name}" FontFamily="Segoe UI" Foreground="#666666 "/>
                            </StackPanel>
                        </DataTemplate>
                    </GroupStyle.HeaderTemplate>
                    <GroupStyle.Panel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel/>
                        </ItemsPanelTemplate>
                    </GroupStyle.Panel>
                </GroupStyle>
            </ListView.GroupStyle>
            
            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel Background="#FAFCFF" Margin="-5,0,0,0"></VirtualizingStackPanel>
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>

            <ListView.ItemTemplate>
                <ItemContainerTemplate>
                    <StackPanel>
                        <RichTextBox Background="Transparent" Foreground="#000000" FontFamily="Segoe UI" FontSize="14" IsReadOnly="True" BorderThickness="0" 
                                     Padding="12,6,10,6" local:SearchResultBindHelper.DocumentBind="{Binding BindProperty}" 
                                      Width="{Binding ElementName=ResultListControl,Path=ActualWidth,Converter={StaticResource ListViewWidthConverter}}"
                                     VerticalContentAlignment="Center" VerticalAlignment="Center" IsHitTestVisible="False" >
                        </RichTextBox>
                    </StackPanel>
                </ItemContainerTemplate>
            </ListView.ItemTemplate>
        </ListView>

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