<UserControl
    x:Class="PDF_Office.Views.HomePanel.PDFTools.QuickToolsContent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:PDF_Office.Views.HomePanel"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
    xmlns:Converter="clr-namespace:PDF_Office.DataConvert"
    xmlns:homePanel="clr-namespace:PDF_Office.Views.HomePanel"
    d:DesignHeight="450"
    d:DesignWidth="800"
    mc:Ignorable="d">
    <UserControl.Resources>

        <Style x:Key="LabelSty"
               TargetType="{x:Type Label}">
            <Setter Property="Padding"
                    Value="10,5" />
            <Setter Property="Background"
                    Value="CadetBlue" />
            <Setter Property="Foreground"
                    Value="White" />
        </Style>
        <Style x:Key="FocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Rectangle Margin="0"
                                   SnapsToDevicePixels="true"
                                   Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
                                   StrokeDashArray="1 2"
                                   StrokeThickness="0" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!--  set SelectedBackgroundColor to Transparent when you do not need the background in selected items  -->
        <Color x:Key="SelectedBackgroundColor">LightBlue</Color>
        <Color x:Key="SelectedUnfocusedColor">AliceBlue</Color>

        <!--  set the MouseOverColor to Transparent when you do not need the effect in the unselected items  -->
        <Color x:Key="MouseOverColor">LightBlue</Color>
        <SolidColorBrush x:Key="Item.MouseOver.Background"
                         Color="LightBlue" />
        <SolidColorBrush x:Key="Item.MouseOver.Border"
                         Color="LightBlue" />
        <SolidColorBrush x:Key="Item.SelectedInactive.Background"
                         Color="AliceBlue" />
        <SolidColorBrush x:Key="Item.SelectedInactive.Border"
                         Color="AliceBlue" />
        <SolidColorBrush x:Key="Item.SelectedActive.Background"
                         Color="Beige" />
        <SolidColorBrush x:Key="Item.SelectedActive.Border"
                         Color="Beige" />
        <Style x:Key="ListBoxItemStyle"
               TargetType="{x:Type customControl:ListItemQuickTool}">
            <Setter Property="SnapsToDevicePixels"
                    Value="True" />
            <Setter Property="FocusVisualStyle"
                    Value="{x:Null}" />
            <!-- 导致模块闪烁，并且时有时无
            <EventSetter Event="DragLeave"
                         Handler="MyListBoxItem_DragLeave">
            </EventSetter>-->
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type customControl:ListItemQuickTool}">
                        <!--Width="230"  Margin="50,20,0,10"-->
                        <Border x:Name="Border"
                                Margin="0,0,0,30"
                               
                                Background="AliceBlue"
                                SnapsToDevicePixels="true">
                            <ContentPresenter />
                        </Border>
                        <ControlTemplate.Triggers>

                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsOverModular"
                                               Value="True" />
                                </MultiTrigger.Conditions>
                                <Setter TargetName="Border"
                                        Property="Background"
                                        Value="{StaticResource Item.MouseOver.Background}" />
                                <Setter TargetName="Border"
                                        Property="BorderBrush"
                                        Value="{StaticResource Item.MouseOver.Border}" />
                            </MultiTrigger>
                            <!--<MultiTrigger>
                                <MultiTrigger.Conditions>
                            -->
                            <!--<Condition Property="DragLeave"
                                               Value="True" />-->
                            <!--
                                    <Condition Property="IsFilePicked"
                                               Value="False" />
                                </MultiTrigger.Conditions>
                                <Setter TargetName="Border"
                                        Property="Background"
                                        Value="AliceBlue" />
                                <Setter TargetName="Border"
                                        Property="BorderBrush"
                                        Value="AliceBlue" />
                            </MultiTrigger>-->

                            <!--<MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsMouseOver"
                                               Value="True" />
                                </MultiTrigger.Conditions>
                                <Setter TargetName="Border"
                                        Property="Background"
                                        Value="{StaticResource Item.MouseOver.Background}" />
                                <Setter TargetName="Border"
                                        Property="BorderBrush"
                                        Value="{StaticResource Item.MouseOver.Border}" />
                            </MultiTrigger>-->
                            <!--<MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="Selector.IsSelectionActive"
                                               Value="False" />
                                    <Condition Property="IsSelected"
                                               Value="True" />
                                </MultiTrigger.Conditions>
                                <Setter TargetName="Border"
                                        Property="Background"
                                        Value="{StaticResource Item.SelectedInactive.Background}" />
                                <Setter TargetName="Border"
                                        Property="BorderBrush"
                                        Value="{StaticResource Item.SelectedInactive.Border}" />
                            </MultiTrigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="Selector.IsSelectionActive"
                                               Value="True" />
                                    <Condition Property="IsSelected"
                                               Value="True" />
                                </MultiTrigger.Conditions>
                                <Setter TargetName="Border"
                                        Property="Background"
                                        Value="{StaticResource Item.SelectedActive.Background}" />
                                <Setter TargetName="Border"
                                        Property="BorderBrush"
                                        Value="{StaticResource Item.SelectedActive.Border}" />
                            </MultiTrigger>
                            <Trigger Property="IsEnabled"
                                     Value="False">
                                <Setter TargetName="Border"
                                        Property="TextElement.Foreground"
                                        Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                            </Trigger>-->
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers />
        </Style>

        <Style x:Key="MoreListBoxItemStyle"
               TargetType="{x:Type customControl:ListItemQuickTool}">
            <Setter Property="SnapsToDevicePixels"
                    Value="True" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type customControl:ListItemQuickTool}">
                        <Border x:Name="Border"  Margin="0,0,0,0"
                                Background="LightGray"
                                SnapsToDevicePixels="False">
                            <ContentPresenter />
                        </Border>
                        <ControlTemplate.Triggers>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsSelected"
                                               Value="true" />
                                </MultiTrigger.Conditions>
                                <MultiTrigger.Setters>
                                    <Setter TargetName="Border"
                                            Property="Background"
                                            Value="LightGoldenrodYellow" />
                                </MultiTrigger.Setters>
                            </MultiTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Converter:BoolToVisible x:Key="BoolToVisibilityConverter" />
        <DataTemplate x:Key="DataTemplate">
            <homePanel:HomeToolItem x:Name="data"/>
        </DataTemplate>
        <ItemsPanelTemplate x:Key="ListItemsPanelTemplate">
            <WrapPanel AllowDrop="True"
                       Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </UserControl.Resources>
    <Grid Grid.ColumnSpan="2" Margin="0,0,20,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <TextBlock
                x:Name="TxbQuickToolsTitle"
                Margin="0,0,0,16"
                FontSize="24"
                FontWeight="SemiBold"
                Text="Quick Tools" />


        <StackPanel
            x:Name="PnlToolsUIBtns" Grid.ColumnSpan="2"
            Grid.Column="0" 
            Margin="0,0,12,0"
            HorizontalAlignment="Right"
            VerticalAlignment="Top"
            Orientation="Horizontal"
            Visibility="Visible">

            <Button
                x:Name="BtnTools"
                Width="68"
                Height="28"
                Margin="0,0,0,0"
                Background="#FFFFFF"
                Content="Tools"
                Click="BtnTools_Click"
               >

            </Button>


            <Button
                x:Name="BtnMore"
                Width="28"
                Height="28"
                Margin="12,0,0,0"
                 Background="#FFFFFF" BorderThickness="0" Content="..."
                Click="BtnMore_Click"
               >
            </Button>

        </StackPanel>

        <Grid
                x:Name="GridAllTools"
                Grid.Row="1" Height="270"
                SizeChanged="GridAllTools_SizeChanged">

            <customControl:ListBoxEx x:Name="ListBoxToolBars" HorizontalAlignment="Stretch"  MinWidth="540" 
                        Grid.Row="3"
                        AllowDrop="True"
                        BorderThickness="0"
                        SizeChanged="ListBoxShortCuts_SizeChanged"
                        ItemContainerStyle="{StaticResource MoreListBoxItemStyle}"
                        ItemTemplate="{StaticResource DataTemplate}"
                        ItemsPanel="{StaticResource ListItemsPanelTemplate}"
                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                        SelectionMode="Single" />


            <!--<WrapPanel Visibility="Collapsed"
                    x:Name="Pnlwrap"
                    MinWidth="230"
                    HorizontalAlignment="Left"
                    IsEnabled="True">

                <local:HomeToolItem x:Name="ToolItemBatch"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="Batch convert, compress, secure, watermark PDFs."
                        ToolTitile="Batch" />

                <local:HomeToolItem x:Name="ToolItemOCR"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="Convert PDFs to Word/ HTML/ TXT/ JPEG/ PNG files."
                        ToolTitile="OCR" />

                <local:HomeToolItem x:Name="ToolItemConvertPDF"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="Protect PDFs with image/ text watermarks from plagiarism."
                        ToolTitile="Convert PDF" />

                <local:HomeToolItem x:Name="ToolItemImageToPDF"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="Protect PDFs with image/ text watermarks from plagiarism."
                        ToolTitile="Image To PDF" />

                <local:HomeToolItem x:Name="ToolItemMergePDF"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="Protect PDFs with image/ text watermarks from plagiarism."
                        ToolTitile="Merge PDF"
                        />

                <local:HomeToolItem x:Name="ToolItemCompressPDF"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="Convert JPEG/ JPG/ PNG/ TIFF/ BMP/ PSD files to PDFs."
                        ToolTitile="Compress PDF" />

                <local:HomeToolItem x:Name="ToolItemSecurity"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="Convert PDFs to Word, Fonts  formatting get converted."
                        ToolTitile="Security" />

                <local:HomeToolItem x:Name="ToolItem1"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="QuickTools_ToolMergeInfo"
                        ToolTitile="QuickTools_ToolMerge" />

                <local:HomeToolItem x:Name="ToolItem2"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="Protect PDFs with image/ text watermarks from plagiarism."
                        ToolTitile="Compare PDF" />

                <local:HomeToolItem x:Name="ToolItem3"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="Protect PDFs with image/ text watermarks from plagiarism."
                        ToolTitile="QuickTools_ToolImageToPDF"
                        Visibility="Collapsed" />

                <local:HomeToolItem x:Name="ToolItem4"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="QuickTools_ToolSecurityInfo"
                        ToolTitile="QuickTools_ToolSecurity"
                        Visibility="Collapsed" />

                <local:HomeToolItem x:Name="ToolItem5"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="QuickTools_ToolWatermarkInfo"
                        ToolTitile="QuickTools_ToolWatermark"
                        Visibility="Visible" />

                <local:HomeToolItem x:Name="ToolItem6"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="QuickTools_ToolHeaderFooterInfo"
                        ToolTitile="QuickTools_ToolHeaderFooter"
                        Visibility="Visible" />

                <local:HomeToolItem x:Name="ToolItem7"
                        IconHoverPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        IconPath="pack://application:,,,/Resources/QuickToolIcon/Batch.png"
                        ToolInfo="QuickTools_ToolBatesInfo"
                        ToolTitile="QuickTools_ToolBates"
                        Visibility="Visible" />

            </WrapPanel>-->

        </Grid>

    </Grid>
</UserControl>
