Browse Source

PDF工具 - 调整代码逻辑,命名规范

chenrongqian 2 năm trước cách đây
mục cha
commit
63cf1c3245

+ 3 - 3
PDF Office/CustomControl/ListBoxItemToolBar.cs

@@ -9,10 +9,10 @@ using System.Windows.Input;
 
 namespace PDF_Office.CustomControl
 {
-    public class MyListBoxItem : ListBoxItem
+    public class ListItemQuickTool : ListBoxItem
     {
         // 属性的定义与注册
-        public static DependencyProperty IsOverModularProperty = DependencyProperty.Register("IsOverModular", typeof(bool), typeof(MyListBoxItem), new PropertyMetadata(false));
+        public static DependencyProperty IsOverModularProperty = DependencyProperty.Register("IsOverModular", typeof(bool), typeof(ListItemQuickTool), new PropertyMetadata(false));
 
         // 属性的包装
         public bool IsOverModular
@@ -54,6 +54,6 @@ namespace PDF_Office.CustomControl
 
     public class ListBoxEx : ListBox
     {
-        protected override DependencyObject GetContainerForItemOverride() => new MyListBoxItem();
+        protected override DependencyObject GetContainerForItemOverride() => new ListItemQuickTool();
     }
 }

+ 0 - 44
PDF Office/CustomControl/Utils.cs

@@ -1,44 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Media;
-
-namespace PDF_Office.CustomControl
-{
-    internal static class Utils
-    {
-        //根据子元素查找父元素
-        public static T FindVisualParent<T>(DependencyObject obj) where T : class
-        {
-            while (obj != null)
-            {
-                if (obj is T)
-                    return obj as T;
-
-                obj = VisualTreeHelper.GetParent(obj);
-            }
-            return null;
-        }
-
-        public static childItem FindVisualChild<childItem>(DependencyObject obj)
-  where childItem : DependencyObject
-        {
-            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
-            {
-                DependencyObject child = VisualTreeHelper.GetChild(obj, i);
-                if (child != null && child is childItem)
-                    return (childItem)child;
-                else
-                {
-                    childItem childOfChild = FindVisualChild<childItem>(child);
-                    if (childOfChild != null)
-                        return childOfChild;
-                }
-            }
-            return null;
-        }
-    }
-}

+ 19 - 14
PDF Office/PDF Office.csproj

@@ -117,7 +117,6 @@
     <Compile Include="CustomControl\ToastControl.xaml.cs">
       <DependentUpon>ToastControl.xaml</DependentUpon>
     </Compile>
-    <Compile Include="CustomControl\Utils.cs" />
     <Compile Include="EventAggregators\PageEditNotifyEvent.cs" />
     <Compile Include="EventAggregators\PageEditRefreshEvent.cs" />
     <Compile Include="Helper\SettingHelper.cs" />
@@ -175,17 +174,17 @@
     <Compile Include="Views\HomePanel\HomeGuidContent.xaml.cs">
       <DependentUpon>HomeGuidContent.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\HomePanel\HomeToolIControl.xaml.cs">
-      <DependentUpon>HomeToolIControl.xaml</DependentUpon>
-    </Compile>
-    <Compile Include="Views\HomePanel\HomeToolItem.xaml.cs">
-      <DependentUpon>HomeToolItem.xaml</DependentUpon>
+    <Compile Include="Views\HomePanel\PDFTools\PDFToolItem.xaml.cs">
+      <DependentUpon>PDFToolItem.xaml</DependentUpon>
     </Compile>
     <Compile Include="Views\HomePanel\HomeToolsContent.xaml.cs">
       <DependentUpon>HomeToolsContent.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\HomePanel\PDFTools\ToolbarContent.xaml.cs">
-      <DependentUpon>ToolbarContent.xaml</DependentUpon>
+    <Compile Include="Views\HomePanel\PDFTools\PDFToolsContent.xaml.cs">
+      <DependentUpon>PDFToolsContent.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\HomePanel\PDFTools\QuickToolsContent.xaml.cs">
+      <DependentUpon>QuickToolsContent.xaml</DependentUpon>
     </Compile>
     <Compile Include="Views\HomePanel\PromotionContent.xaml.cs">
       <DependentUpon>PromotionContent.xaml</DependentUpon>
@@ -224,6 +223,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Styles\CustomListItemStyle.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Styles\ExpanderStyle.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -280,11 +283,7 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Views\HomePanel\HomeToolIControl.xaml">
-      <Generator>MSBuild:Compile</Generator>
-      <SubType>Designer</SubType>
-    </Page>
-    <Page Include="Views\HomePanel\HomeToolItem.xaml">
+    <Page Include="Views\HomePanel\PDFTools\PDFToolItem.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
@@ -292,10 +291,14 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Views\HomePanel\PDFTools\ToolbarContent.xaml">
+    <Page Include="Views\HomePanel\PDFTools\PDFToolsContent.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Views\HomePanel\PDFTools\QuickToolsContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\HomePanel\PromotionContent.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -410,6 +413,8 @@
     <Resource Include="Resources\PromotionIcon\IPhoneiPad.png" />
     <Resource Include="Resources\PromotionIcon\SignFlow.png" />
     <Resource Include="Resources\PromotionIcon\Windows.png" />
+    <Resource Include="Resources\FilesType\ic_propertybar_file_pdf_lock.png" />
+    <Resource Include="Resources\FilesType\ic_propertybar_file_png_Large.png" />
     <Content Include="SystemService\PreviewHandler.dll">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>

BIN
PDF Office/Resources/FilesType/ic_propertybar_file_pdf_lock.png


BIN
PDF Office/Resources/FilesType/ic_propertybar_file_png_Large.png


+ 105 - 0
PDF Office/Styles/CustomListItemStyle.xaml

@@ -0,0 +1,105 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
+                    >
+
+    <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}" />
+
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type customControl:ListItemQuickTool}">
+                    <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>
+
+                    </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,30"
+                                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>
+</ResourceDictionary>

+ 2 - 2
PDF Office/ViewModels/HomePanel/HomeToolsContentViewModel.cs

@@ -15,13 +15,13 @@ namespace PDF_Office.ViewModels.HomePanel
         }
     }
 
-    public class ToolBarsViewModel : BindableBase
+    public class QuickToolItem : BindableBase
     {
         public int Id { get; set; }
         public string Image { get; set; }
         public string NameInfo { get; set; }
         public string Name { get; set; }
-        public ToolBarsViewModel()
+        public QuickToolItem()
         {
 
         }

+ 3 - 2
PDF Office/Views/HomePanel/HomeGuidContent.xaml

@@ -4,7 +4,8 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.HomePanel"
-              xmlns:recentFiles="clr-namespace:PDF_Office.Views.HomePanel.RecentFiles"
+             xmlns:recentFiles="clr-namespace:PDF_Office.Views.HomePanel.RecentFiles"
+             xmlns:pDFTools="clr-namespace:PDF_Office.Views.HomePanel.PDFTools"
              xmlns:prism="http://prismlibrary.com/"
              prism:ViewModelLocator.AutoWireViewModel="True"
              Background="#F8F9FB"
@@ -20,7 +21,7 @@
                     <RowDefinition Height="Auto" />
                     <RowDefinition />
                 </Grid.RowDefinitions>
-                <local:HomeToolIControl x:Name="hometool" Margin="32,32,0,0"/>
+                <pDFTools:QuickToolsContent x:Name="hometool" Margin="32,32,0,0"/>
                 <recentFiles:RecentFilesView x:Name="Recentlist" Grid.Row="1" Margin="0,0,32,0" />
             </Grid>
         </ScrollViewer>

+ 1 - 1
PDF Office/Views/HomePanel/HomeToolsContent.xaml

@@ -11,6 +11,6 @@
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>
-        <toolBar:ToolbarContent/>
+        <toolBar:PDFToolsContent/>
     </Grid>
 </UserControl>

+ 4 - 12
PDF Office/Views/HomePanel/HomeToolItem.xaml

@@ -1,4 +1,4 @@
-<UserControl x:Class="PDF_Office.Views.HomePanel.HomeToolItem"
+<UserControl x:Class="PDF_Office.Views.HomePanel.PDFTools.PDFToolItem"
              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" 
@@ -27,11 +27,8 @@
                         <RowDefinition Height="auto"></RowDefinition>
                         <RowDefinition Height="*"></RowDefinition>
                     </Grid.RowDefinitions>
-                    <Image VerticalAlignment="Top" Source="{Binding Image}" HorizontalAlignment="Center" Width="28" Height="28" Margin="5,10,5,5" >
-                        <!--<Rectangle.Fill>
-                            <ImageBrush x:Name="IconBrush"></ImageBrush>
-                        </Rectangle.Fill>-->
-                    </Image>
+                    <Image VerticalAlignment="Top" Source="{Binding Image}" HorizontalAlignment="Center" Width="28" Height="28" Margin="5,10,5,5" />
+
                     <TextBlock  Name="TxbTitle" Grid.Column="1" Text="{Binding Name}" 
                                     FontSize="14" FontWeight="SemiBold" Foreground="Black"
                                     VerticalAlignment="Top" Margin="0,15,0,0"></TextBlock>
@@ -55,12 +52,7 @@
                     <ColumnDefinition Width="*"/>
                 </Grid.ColumnDefinitions>
                 <Grid x:Name="GridToolMaskConcise" Grid.ColumnSpan="2" Background="#477EDE" Visibility="Collapsed"/>
-                <Image VerticalAlignment="Top" Source="{Binding Image}" HorizontalAlignment="Center" Width="28" Height="28" Margin="5,10,5,5" >
-                    <!--<Rectangle.Fill>
-                        <ImageBrush x:Name="IconConcise" ></ImageBrush>
-                    </Rectangle.Fill>-->
-                </Image>
-
+                <Image VerticalAlignment="Top" Source="{Binding Image}" HorizontalAlignment="Center" Width="28" Height="28" Margin="5,10,5,5" />
                 <TextBlock  Name="TxbTitleConcise" Grid.Column="1" Text="{Binding Name}" FontSize="14" FontWeight="SemiBold" VerticalAlignment="Top" Margin="0,15,0,0"></TextBlock>
             </Grid>
         </Border>

+ 9 - 10
PDF Office/Views/HomePanel/HomeToolItem.xaml.cs

@@ -5,18 +5,17 @@ using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 
-namespace PDF_Office.Views.HomePanel
+namespace PDF_Office.Views.HomePanel.PDFTools
 {
     /// <summary>
-    /// HomeToolItem.xaml 的交互逻辑
+    /// PDFToolItem.xaml 的交互逻辑
     /// </summary>
-    public partial class HomeToolItem : UserControl
+    public partial class PDFToolItem : UserControl
     {
-        public HomeToolItem()
+        public PDFToolItem()
         {
             InitializeComponent();
             this.Loaded += usercontrol_Loaded;
-            
         }
 
         private void usercontrol_Loaded(object sender, RoutedEventArgs e)
@@ -140,7 +139,7 @@ namespace PDF_Office.Views.HomePanel
             }
         }
 
-        public static readonly DependencyProperty IconPathProperty = DependencyProperty.Register("IconPath", typeof(string), typeof(HomeToolItem), new PropertyMetadata(string.Empty));
+        public static readonly DependencyProperty IconPathProperty = DependencyProperty.Register("IconPath", typeof(string), typeof(PDFToolItem), new PropertyMetadata(string.Empty));
         public string IconHoverPath
         {
             get
@@ -152,7 +151,7 @@ namespace PDF_Office.Views.HomePanel
                 SetValue(IconHoverPathProperty, value);
             }
         }
-        public static readonly DependencyProperty IconHoverPathProperty = DependencyProperty.Register("IconHoverPath", typeof(string), typeof(HomeToolItem), new PropertyMetadata(string.Empty));
+        public static readonly DependencyProperty IconHoverPathProperty = DependencyProperty.Register("IconHoverPath", typeof(string), typeof(PDFToolItem), new PropertyMetadata(string.Empty));
 
         public string ToolTitile
         {
@@ -165,7 +164,7 @@ namespace PDF_Office.Views.HomePanel
                 SetValue(ToolTitileProperty, value);
             }
         }
-        public static readonly DependencyProperty ToolTitileProperty = DependencyProperty.Register("ToolTitile", typeof(string), typeof(HomeToolItem), new PropertyMetadata(string.Empty));
+        public static readonly DependencyProperty ToolTitileProperty = DependencyProperty.Register("ToolTitile", typeof(string), typeof(PDFToolItem), new PropertyMetadata(string.Empty));
 
         public string ToolInfo
         {
@@ -178,7 +177,7 @@ namespace PDF_Office.Views.HomePanel
                 SetValue(ToolInfoProperty, value);
             }
         }
-        public static readonly DependencyProperty ToolInfoProperty = DependencyProperty.Register("ToolInfo", typeof(string), typeof(HomeToolItem), new PropertyMetadata(string.Empty));
+        public static readonly DependencyProperty ToolInfoProperty = DependencyProperty.Register("ToolInfo", typeof(string), typeof(PDFToolItem), new PropertyMetadata(string.Empty));
 
 
         /// <summary>
@@ -195,7 +194,7 @@ namespace PDF_Office.Views.HomePanel
                 SetValue(IsShowConciseContentProperty, value);
             }
         }
-        public static readonly DependencyProperty IsShowConciseContentProperty = DependencyProperty.Register("IsShowConciseContent", typeof(bool), typeof(HomeToolItem), new PropertyMetadata(false));
+        public static readonly DependencyProperty IsShowConciseContentProperty = DependencyProperty.Register("IsShowConciseContent", typeof(bool), typeof(PDFToolItem), new PropertyMetadata(false));
 
 
     }

+ 169 - 0
PDF Office/Views/HomePanel/PDFTools/PDFToolsContent.xaml

@@ -0,0 +1,169 @@
+<UserControl x:Class="PDF_Office.Views.HomePanel.PDFTools.PDFToolsContent"
+      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:PDF_Office.Views.HomePanel.PDFTools"
+      xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
+      xmlns:converter="clr-namespace:PDF_Office.DataConvert"
+      Background="White"  MinWidth="540" MinHeight="460"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+     >
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../../Styles/CustomListItemStyle.xaml"/>
+            </ResourceDictionary.MergedDictionaries>
+            <converter:BoolToVisible x:Key="BoolToVisibilityConverter" />
+
+            <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>
+
+            <DataTemplate x:Key="DataTemplate">
+                <local:PDFToolItem x:Name="data"/>
+            </DataTemplate>
+
+            <ItemsPanelTemplate x:Key="ListItemsPanelTemplate">
+                <WrapPanel AllowDrop="True"
+                       Orientation="Horizontal" />
+            </ItemsPanelTemplate>
+
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <Grid x:Name="Grid" Margin="70,51,0,0">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="auto" />
+            <RowDefinition Height="auto" MinHeight="200" />
+            <RowDefinition Height="auto" />
+            <RowDefinition Height="*" />
+        </Grid.RowDefinitions>
+        <StackPanel AllowDrop="True"
+                    DragOver="ListBoxShortCuts_DragOver"
+                    Drop="ListBoxShortCuts_Drop"
+                    PreviewMouseMove="ListBoxMoreCuts_PreviewMouseMove"
+                    >
+            <Grid>
+                <TextBlock Text="PDF 工具" FontSize="16" FontFamily="PingFang SC"/>
+                <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>
+           
+            <TextBlock Text="首页快捷工具" Margin="0,16,0,0" FontSize="14" FontFamily="PingFang SC"/> 
+        </StackPanel>
+        <Label Name="label1" Visibility="Collapsed"
+               Grid.Row="0"
+               AllowDrop="True"
+               Content="快捷工具"
+               DragOver="ListBoxShortCuts_DragOver"
+               Drop="ListBoxShortCuts_Drop"
+               FontSize="20"
+               PreviewMouseMove="ListBoxMoreCuts_PreviewMouseMove"
+               Style="{StaticResource LabelSty}" />
+
+        <customControl:ListBoxEx x:Name="ListShortCuts" HorizontalAlignment="Stretch" Margin="0,8,0,0"  MinWidth="540" 
+                        Grid.Row="1"
+                        AllowDrop="True"
+                        BorderThickness="0"
+                        SizeChanged="ListBoxShortCuts_SizeChanged"
+                        DragOver="ListBoxShortCuts_DragOver"
+                        Drop="ListBoxShortCuts_Drop"
+                        ItemContainerStyle="{StaticResource ListBoxItemStyle}"
+                        ItemTemplate="{StaticResource DataTemplate}"
+                        ItemsPanel="{StaticResource ListItemsPanelTemplate}"
+                        PreviewMouseMove="ListBoxShortCuts_PreviewMouseMove"
+                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                        SelectionMode="Extended" />
+        <StackPanel Grid.Row="2" Margin="0,16,0,16" AllowDrop="True"
+                     DragOver="ListBoxShortCuts_DragOver"
+                     Drop="ListBoxShortCuts_Drop"
+                     PreviewMouseMove="ListBoxMoreCuts_PreviewMouseMove"   
+                    >
+            <TextBlock Text="更多工具" FontSize="14" FontFamily="PingFang SC"/>
+        </StackPanel>
+        <Label Grid.Row="2" Visibility="Collapsed"
+               AllowDrop="True"
+               Content="更多工具"
+               DragOver="ListBoxShortCuts_DragOver"
+               Drop="ListBoxShortCuts_Drop"
+               FontSize="20"
+               PreviewMouseMove="ListBoxMoreCuts_PreviewMouseMove"
+               Style="{StaticResource LabelSty}" />
+        <customControl:ListBoxEx x:Name="ListMoreCuts" HorizontalAlignment="Stretch" MinWidth="540"
+                        Grid.Row="3"
+                        AllowDrop="True"
+                        BorderThickness="0"
+                        SizeChanged="ListBoxMoreCuts_SizeChanged" 
+                        DragOver="ListBoxShortCuts_DragOver"
+                        ItemContainerStyle="{StaticResource MoreListBoxItemStyle}"
+                        ItemTemplate="{StaticResource DataTemplate}"
+                        ItemsPanel="{StaticResource ListItemsPanelTemplate}"
+                        PreviewMouseMove="ListBoxMoreCuts_PreviewMouseMove"
+                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                        SelectionMode="Extended" />
+        <Image x:Name="sourceImage" 
+               Grid.RowSpan="4"
+               Width="260"
+               Height="80"
+               HorizontalAlignment="Left"
+               VerticalAlignment="Top"
+               AllowDrop="True"
+               IsHitTestVisible="False" />
+
+        <Grid>
+            <Image x:Name="moveImage"
+               Grid.RowSpan="4"
+               Width="260"
+               Height="80"
+               HorizontalAlignment="Left"
+               VerticalAlignment="Top"
+               IsHitTestVisible="False"
+               Visibility="Hidden">
+                <Image.RenderTransform>
+                    <TranslateTransform x:Name="tt"
+                                    X="0"
+                                    Y="0" />
+                </Image.RenderTransform>
+            </Image>
+        </Grid>
+
+    </Grid>
+</UserControl>

+ 58 - 62
PDF Office/Views/HomePanel/PDFTools/ToolbarContent.xaml.cs

@@ -1,4 +1,5 @@
 using PDF_Office.CustomControl;
+using PDF_Office.Helper;
 using PDF_Office.ViewModels.HomePanel;
 using System;
 using System.Collections.Generic;
@@ -19,25 +20,20 @@ using System.Windows.Shapes;
 
 namespace PDF_Office.Views.HomePanel.PDFTools
 {
-    //public class AToolModule : DependencyObject
-    //{
-    //    public int Id { get; set; }
-    //    public string Image { get; set; }
-    //    public string NameInfo { get; set; }
-    //    public string Name { get; set; }
-    //}
 
     /// <summary>
     /// ToolbarPage.xaml 的交互逻辑
     /// </summary>
-    public partial class ToolbarContent : UserControl
+    public partial class PDFToolsContent : UserControl
     {
-        private MyListBoxItem sourceListItem = null;
-        private MyListBoxItem quickSourceListItem = null;
-        private MyListBoxItem targetListBoxItem = null;
-        private List<ToolBarsViewModel> quickToolbars = null;
-        private List<ToolBarsViewModel> allToolbars = null;
-        private List<ToolBarsViewModel> moreToolbars = null;
+        private ListItemQuickTool sourceListItem = null;
+        private ListItemQuickTool targetListItem = null;
+        private ListItemQuickTool quickSourceListItem = null;
+
+        private List<QuickToolItem> quickTools = null;
+        private List<QuickToolItem> allTools = null;
+        private List<QuickToolItem> moreTools = null;
+
         private string fileName = string.Empty;
         private BitmapSource bitmapSource = null;
         private bool isMoreCuts = false;
@@ -46,12 +42,12 @@ namespace PDF_Office.Views.HomePanel.PDFTools
         private Point wrpnlPoint;
         private Point mousePoint;
 
-        public ToolbarContent()
+        public PDFToolsContent()
         {
             InitializeComponent();
 
-            quickToolbars = new List<ToolBarsViewModel>();
-            allToolbars = new List<ToolBarsViewModel>();
+            quickTools = new List<QuickToolItem>();
+            allTools = new List<QuickToolItem>();
 
             #region ListBox
 
@@ -80,20 +76,20 @@ namespace PDF_Office.Views.HomePanel.PDFTools
 
             for (int i = 0; i < all.Count; i++)
             {
-                ToolBarsViewModel aToolModule = new ToolBarsViewModel();
+                QuickToolItem aToolModule = new QuickToolItem();
                 aToolModule.Id = i + 1;
                 aToolModule.Name = all[i];
                 aToolModule.Image = path;
-                allToolbars.Add(aToolModule);
+                allTools.Add(aToolModule);
             }
 
             //取前10个,如果List里面数据少于5个,则返回所有的
-            quickToolbars = allToolbars.Take(8).ToList<ToolBarsViewModel>();
-            ListShortCuts.ItemsSource = quickToolbars;
+            quickTools = allTools.Take(8).ToList<QuickToolItem>();
+            ListShortCuts.ItemsSource = quickTools;
             //对比两个集合,取差值
-            moreToolbars = allToolbars.Except(quickToolbars).ToList();
+            moreTools = allTools.Except(quickTools).ToList();
 
-            ListMoreCuts.ItemsSource = moreToolbars;
+            ListMoreCuts.ItemsSource = moreTools;
 
         }
 
@@ -115,7 +111,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                     sourceImage.Visibility = Visibility.Hidden;
                     return;
                 }
-                sourceListItem = (MyListBoxItem)Utils.FindVisualParent<ListBoxItem>(result.VisualHit);
+                sourceListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
                 if (sourceListItem == null || sourceListItem.Content != ListMoreCuts.SelectedItem)
                 {
                     return;
@@ -123,7 +119,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                 //获取控件相对于另一控件的坐标
                 wrpnlPoint = sourceListItem.TranslatePoint(new Point(), this);
 
-                System.Windows.DataObject dataObj = new System.Windows.DataObject(sourceListItem.Content as ToolBarsViewModel);
+                System.Windows.DataObject dataObj = new System.Windows.DataObject(sourceListItem.Content as QuickToolItem);
 
                 if (dataObj != null)
                 {
@@ -158,9 +154,9 @@ namespace PDF_Office.Views.HomePanel.PDFTools
 
         private void IsMoreToolbars()
         {
-            var source = sourceListItem.Content as ToolBarsViewModel;
-            if (moreToolbars == null && moreToolbars.Count != 0) return;
-            List<ToolBarsViewModel> toolModule = moreToolbars.FindAll(item => item.Name == source.Name);
+            var source = sourceListItem.Content as QuickToolItem;
+            if (moreTools == null && moreTools.Count != 0) return;
+            List<QuickToolItem> toolModule = moreTools.FindAll(item => item.Name == source.Name);
             if (toolModule.Count > 0)
             {
                 // 判断文件夹是否存在,不存在则创建
@@ -187,17 +183,17 @@ namespace PDF_Office.Views.HomePanel.PDFTools
             }
 
             //查找目标数据
-            targetListBoxItem = (MyListBoxItem)Utils.FindVisualParent<ListBoxItem>(result.VisualHit);
-            if (targetListBoxItem == null)
+            targetListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
+            if (targetListItem == null)
             {
                 WorkingWithAnimation(pos);
                 return;
             }
-            var targetAToolModule = targetListBoxItem.Content as ToolBarsViewModel;
-            ToolBarsViewModel target = quickToolbars.Find(c => c.Name == targetAToolModule.Name);
+            var targetAToolModule = targetListItem.Content as QuickToolItem;
+            QuickToolItem target = quickTools.Find(c => c.Name == targetAToolModule.Name);
 
             //查找元数据
-            var sourceAToolModule = e.Data.GetData(typeof(ToolBarsViewModel)) as ToolBarsViewModel;
+            var sourceAToolModule = e.Data.GetData(typeof(QuickToolItem)) as QuickToolItem;
             if (sourceAToolModule == null)
             {
                 sourceImage.Visibility = Visibility.Hidden;
@@ -221,24 +217,24 @@ namespace PDF_Office.Views.HomePanel.PDFTools
             ModuleExchange(sourceAToolModule, targetAToolModule);
         }
 
-        private void ModuleExchange(ToolBarsViewModel sourceAToolModule, ToolBarsViewModel targetAToolModule)
+        private void ModuleExchange(QuickToolItem sourceAToolModule, QuickToolItem targetAToolModule)
         {
-            if (moreToolbars == null) return;
-            ToolBarsViewModel source = moreToolbars.Find(c => c.Name == sourceAToolModule.Name);
+            if (moreTools == null) return;
+            QuickToolItem source = moreTools.Find(c => c.Name == sourceAToolModule.Name);
 
-            int targetIndex = quickToolbars.FindIndex(item => item.Name == targetAToolModule.Name);
+            int targetIndex = quickTools.FindIndex(item => item.Name == targetAToolModule.Name);
             if (targetIndex < 0) return;
             if (!isMoreCuts)
             {
                 ListMoreCuts.AllowDrop = false;
                 sourceImage.Visibility = Visibility.Hidden;
-                source = quickToolbars.Find(c => c.Name == sourceAToolModule.Name);
+                source = quickTools.Find(c => c.Name == sourceAToolModule.Name);
                 if (source == null) return;
-                int sourceIndex = quickToolbars.FindIndex(item => item.Name == sourceAToolModule.Name);
+                int sourceIndex = quickTools.FindIndex(item => item.Name == sourceAToolModule.Name);
                 if (sourceIndex < 0) return;
-                var temp = quickToolbars[sourceIndex];
-                quickToolbars[sourceIndex] = quickToolbars[targetIndex];
-                quickToolbars[targetIndex] = temp;
+                var temp = quickTools[sourceIndex];
+                quickTools[sourceIndex] = quickTools[targetIndex];
+                quickTools[targetIndex] = temp;
                 ListShortCuts.Items.Refresh();
                 ListBoxCutsWidthChanged(ListShortCuts);
             }
@@ -246,17 +242,17 @@ namespace PDF_Office.Views.HomePanel.PDFTools
             {
                 if (target == null) return;
                 if (source == null) return;
-                moreToolbars.Remove(source);
-                moreToolbars.Insert(0, target);
+                moreTools.Remove(source);
+                moreTools.Insert(0, target);
 
-                quickToolbars.Remove(target);
-                quickToolbars.Insert(targetIndex, source);
+                quickTools.Remove(target);
+                quickTools.Insert(targetIndex, source);
 
                 ListMoreCuts.Items.Refresh();
                 ListShortCuts.Items.Refresh();
 
                 sourceImage.Visibility = Visibility.Hidden;
-                targetListBoxItem.IsOverModular = false;
+                targetListItem.IsOverModular = false;
                 ListBoxCutsWidthChanged(ListShortCuts);
                 ListBoxCutsWidthChanged(ListMoreCuts);
             }
@@ -354,7 +350,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
             stream.Close();
         }
 
-        private ToolBarsViewModel target;
+        private QuickToolItem target;
 
         private void ListBoxShortCuts_DragOver(object sender, DragEventArgs e)
         {
@@ -391,11 +387,11 @@ namespace PDF_Office.Views.HomePanel.PDFTools
 
             if (!isMoreCuts)
             {
-                var sourceAToolModule = e.Data.GetData(typeof(ToolBarsViewModel)) as ToolBarsViewModel;
+                var sourceAToolModule = e.Data.GetData(typeof(QuickToolItem)) as QuickToolItem;
                 if (sourceAToolModule == null) return;
-                int sourceIndex = quickToolbars.FindIndex(item => item.Name == sourceAToolModule.Name);
+                int sourceIndex = quickTools.FindIndex(item => item.Name == sourceAToolModule.Name);
                 //根据index找listbox对应的item
-                sourceListItem = (MyListBoxItem)(ListShortCuts.ItemContainerGenerator.ContainerFromIndex(sourceIndex) as FrameworkElement);
+                sourceListItem = (ListItemQuickTool)(ListShortCuts.ItemContainerGenerator.ContainerFromIndex(sourceIndex) as FrameworkElement);
                 if (sourceListItem == null)
                 {
                     return;
@@ -405,11 +401,11 @@ namespace PDF_Office.Views.HomePanel.PDFTools
             }
             else
             {
-                var sourceAToolModule = e.Data.GetData(typeof(ToolBarsViewModel)) as ToolBarsViewModel;
+                var sourceAToolModule = e.Data.GetData(typeof(QuickToolItem)) as QuickToolItem;
                 if (sourceAToolModule == null) return;
-                int sourceIndex = moreToolbars.FindIndex(item => item.Name == sourceAToolModule.Name);
+                int sourceIndex = moreTools.FindIndex(item => item.Name == sourceAToolModule.Name);
                 //根据index找listbox对应的item
-                sourceListItem = (MyListBoxItem)(ListMoreCuts.ItemContainerGenerator.ContainerFromIndex(sourceIndex) as FrameworkElement);
+                sourceListItem = (ListItemQuickTool)(ListMoreCuts.ItemContainerGenerator.ContainerFromIndex(sourceIndex) as FrameworkElement);
                 if (sourceListItem == null)
                 {
                     return;
@@ -425,16 +421,16 @@ namespace PDF_Office.Views.HomePanel.PDFTools
             }
 
             //查找目标数据
-            targetListBoxItem = (MyListBoxItem)Utils.FindVisualParent<ListBoxItem>(result.VisualHit);
+            targetListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
 
-            if (targetListBoxItem == null)
+            if (targetListItem == null)
             {
                 //sourceImage.Visibility = Visibility.Hidden;
                 return;
             }
-            var targetAToolModule = targetListBoxItem.Content as ToolBarsViewModel;
+            var targetAToolModule = targetListItem.Content as QuickToolItem;
             if (targetAToolModule == null) return;
-            target = quickToolbars.Find(c => c.Name == targetAToolModule.Name);
+            target = quickTools.Find(c => c.Name == targetAToolModule.Name);
         }
 
         /// <summary>
@@ -460,12 +456,12 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                 {
                     return;
                 }
-                quickSourceListItem = (MyListBoxItem)Utils.FindVisualParent<ListBoxItem>(result.VisualHit);
+                quickSourceListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
                 if (quickSourceListItem == null || quickSourceListItem.Content != ListShortCuts.SelectedItem)
                 {
                     return;
                 }
-                System.Windows.DataObject dataObj = new System.Windows.DataObject(quickSourceListItem.Content as ToolBarsViewModel);
+                System.Windows.DataObject dataObj = new System.Windows.DataObject(quickSourceListItem.Content as QuickToolItem);
 
                 if (dataObj != null)
                 {
@@ -525,10 +521,10 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                 {
 
                     var viewItem = listBoxItem.ContentTemplate;
-                    var myContentPresenter = Utils.FindVisualChild<ContentPresenter>(listBoxItem);
+                    var myContentPresenter = CommonHelper.FindVisualChild<ContentPresenter>(listBoxItem);
                     var obj = viewItem.FindName("data", myContentPresenter);
 
-                    var checkNum = obj as HomeToolItem;
+                    var checkNum = obj as PDFToolItem;
 
                     if (checkNum != null)
                     {

+ 108 - 0
PDF Office/Views/HomePanel/PDFTools/QuickToolsContent.xaml

@@ -0,0 +1,108 @@
+<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:pDFTools="clr-namespace:PDF_Office.Views.HomePanel.PDFTools"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    mc:Ignorable="d">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../../Styles/CustomListItemStyle.xaml"/>
+            </ResourceDictionary.MergedDictionaries>
+            <converter:BoolToVisible x:Key="BoolToVisibilityConverter" />
+            <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>
+
+            <DataTemplate x:Key="DataTemplate">
+                <pDFTools:PDFToolItem x:Name="data"/>
+            </DataTemplate>
+            
+            <ItemsPanelTemplate x:Key="ListItemsPanelTemplate">
+                <WrapPanel AllowDrop="True"
+                       Orientation="Horizontal" />
+            </ItemsPanelTemplate>
+
+        </ResourceDictionary>
+        
+    </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" />
+
+        </Grid>
+
+    </Grid>
+</UserControl>

+ 134 - 0
PDF Office/Views/HomePanel/PDFTools/QuickToolsContent.xaml.cs

@@ -0,0 +1,134 @@
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.ViewModels.HomePanel;
+using PDF_Office.Views.HomePanel.PDFTools;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace PDF_Office.Views.HomePanel.PDFTools
+{
+    /// <summary>
+    /// HomeToolIControl.xaml 的交互逻辑0
+    /// 
+    /// </summary>
+    public partial class QuickToolsContent : UserControl
+    {
+
+        private List<QuickToolItem> allToolbars = null;
+        public QuickToolsContent()
+        {
+            InitializeComponent(); 
+             allToolbars = new List<QuickToolItem>();
+            string path = @"pack://application:,,,/Resources/PromotionIcon/Windows.png";
+            List<string> all = new List<string>() { "PDF转Word", "PDF转Excel", "PDF转PPT", "转档PDF", "OCR", "拆分",
+            "提取","合并","压缩","图片转PDF","安全", "水印", "页眉页脚","贝茨Bates码","批量处理","打印", "背景","插入","文件对比"};
+            for (int i = 0; i < 8; i++)
+            {
+                QuickToolItem aToolModule = new QuickToolItem();
+                aToolModule.Id = i + 1;
+                aToolModule.Name = all[i];
+                aToolModule.Image = path;
+                aToolModule.NameInfo = "Batch convert, compress, secure, watermark PDFs.";
+                allToolbars.Add(aToolModule);
+            }
+
+            ListBoxToolBars.ItemsSource = allToolbars;
+        }
+   
+
+        private void BtnMore_Click(object sender, RoutedEventArgs e)
+        {
+            if (GridAllTools.Height != 270)
+            {
+                GridAllTools.Height = 270;
+                ShowToolsUI(false);
+            }
+            else
+            {
+                GridAllTools.Height = 184;
+                ShowToolsUI(true);
+            }
+               
+        }
+
+        /// <summary>
+        /// 扩展收缩UI
+        /// </summary>
+        /// <param name="IsShowConciseContent">是否收缩</param>
+        private void ShowToolsUI(bool IsShowConciseContent)
+        {
+            foreach (var item in ListBoxToolBars.Items)
+            {
+               
+                var listBoxItem = ListBoxToolBars.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
+                if (listBoxItem != null)
+                {
+                   
+                    var viewItem = listBoxItem.ContentTemplate;
+                    var myContentPresenter = CommonHelper.FindVisualChild<ContentPresenter>(listBoxItem);
+                    var obj = viewItem.FindName("data", myContentPresenter);
+
+                    var checkNum = obj as PDFToolItem;
+
+                    if (checkNum != null)
+                    {
+                        checkNum.IsShowConciseContent = IsShowConciseContent;
+                    }
+
+                }
+            }
+            
+        }
+
+      
+
+        /// <summary>
+        /// 编辑工具
+        /// </summary>
+        private void BtnTools_Click(object sender, RoutedEventArgs e)
+        {
+           
+        }
+
+        private void GridAllTools_SizeChanged(object sender, SizeChangedEventArgs e)
+        {
+            ListBoxToolBarsWidthChanged();
+        }
+
+
+        private void ListBoxToolBarsWidthChanged()
+        {
+            double containerWidth = ListBoxToolBars.ActualWidth - 20;
+            int widthItem = (int)containerWidth / 5;
+            double margin = widthItem / 3;
+
+            int i = 0;
+            foreach (var item in ListBoxToolBars.Items)
+            {
+                i++;
+                var listBoxItem = ListBoxToolBars.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
+                if (listBoxItem != null)
+                {
+                    if (i % 4 != 0)
+                    {
+                        listBoxItem.Margin = new Thickness(0, 0, margin, 20);
+
+                    }
+                    else
+                    {
+                        listBoxItem.Margin = new Thickness(0, 0, 0, 20);
+                    }
+                    listBoxItem.Width = widthItem;
+                }
+            }
+        }
+
+        private void ListBoxShortCuts_SizeChanged(object sender, SizeChangedEventArgs e)
+        {
+           
+        }
+    }
+
+}

+ 0 - 353
PDF Office/Views/HomePanel/PDFTools/ToolbarContent.xaml

@@ -1,353 +0,0 @@
-<UserControl x:Class="PDF_Office.Views.HomePanel.PDFTools.ToolbarContent"
-      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:PDF_Office.Views.HomePanel.PDFTools"
-      xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
-      xmlns:Converter="clr-namespace:PDF_Office.DataConvert"
-      xmlns:homePanel="clr-namespace:PDF_Office.Views.HomePanel"
-     Background="White"  MinWidth="540" MinHeight="460"
-      mc:Ignorable="d" 
-      d:DesignHeight="450" d:DesignWidth="800"
-     >
-    <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" />
-        <!--  TargetType="{x:Type local2:MyListBoxItem}"  -->
-        <Style x:Key="ListBoxItemStyle"
-               TargetType="{x:Type customControl:MyListBoxItem}">
-            <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:MyListBoxItem}">
-                        <!--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:MyListBoxItem}">
-            <Setter Property="SnapsToDevicePixels"
-                    Value="True" />
-            <Setter Property="Template">
-                <Setter.Value>
-                    <ControlTemplate TargetType="{x:Type customControl:MyListBoxItem}">
-                        <Border x:Name="Border"  Margin="0,0,0,30"
-                                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"/>
-            <!--<Grid Height="74">
-               --><!--//  实现不全,鼠标拖拽中,移开的模块的时候无法变回-->
-                <!--<Border Width="230"
-                        Padding="30,10"
-                        Background="SkyBlue"
-                        BorderBrush="SkyBlue"
-                        Visibility="{Binding IsFilePicked, Converter={StaticResource BoolToVisibilityConverter}}" />--><!--
-                <Grid Margin="0,0,0,0"
-                           IsHitTestVisible="False">
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="auto"/>
-                        <ColumnDefinition/>
-                    </Grid.ColumnDefinitions>
-                    <Image Width="30"
-                           Height="20"
-                           AllowDrop="True"
-                           IsHitTestVisible="False"
-                           Source="{Binding Image}" />
-                    <Label Margin="5,5,5,5" Grid.Column="1" VerticalContentAlignment="Center"
-                           HorizontalAlignment="Left" FontSize="14"
-                           Content="{Binding Name}"
-                           />
-                </Grid>
-            </Grid>-->
-        </DataTemplate>
-        <ItemsPanelTemplate x:Key="ListItemsPanelTemplate">
-            <WrapPanel AllowDrop="True"
-                       Orientation="Horizontal" />
-        </ItemsPanelTemplate>
-    </UserControl.Resources>
-    <Grid x:Name="Grid" Margin="70,51,0,0">
-        <Grid.RowDefinitions>
-            <RowDefinition Height="auto" />
-            <RowDefinition Height="auto" MinHeight="200" />
-            <RowDefinition Height="auto" />
-            <RowDefinition Height="*" />
-        </Grid.RowDefinitions>
-        <StackPanel AllowDrop="True"
-                    DragOver="ListBoxShortCuts_DragOver"
-                    Drop="ListBoxShortCuts_Drop"
-                    PreviewMouseMove="ListBoxMoreCuts_PreviewMouseMove"
-                    >
-            <Grid>
-                <TextBlock Text="PDF 工具" FontSize="16" FontFamily="PingFang SC"/>
-                <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>
-           
-            <TextBlock Text="首页快捷工具" Margin="0,16,0,0" FontSize="14" FontFamily="PingFang SC"/> 
-        </StackPanel>
-        <Label Name="label1" Visibility="Collapsed"
-               Grid.Row="0"
-               AllowDrop="True"
-               Content="快捷工具"
-               DragOver="ListBoxShortCuts_DragOver"
-               Drop="ListBoxShortCuts_Drop"
-               FontSize="20"
-               PreviewMouseMove="ListBoxMoreCuts_PreviewMouseMove"
-               Style="{StaticResource LabelSty}" />
-
-        <customControl:ListBoxEx x:Name="ListShortCuts" HorizontalAlignment="Stretch" Margin="0,8,0,0"  MinWidth="540" 
-                        Grid.Row="1"
-                        AllowDrop="True"
-                        BorderThickness="0"
-                        SizeChanged="ListBoxShortCuts_SizeChanged"
-                        DragOver="ListBoxShortCuts_DragOver"
-                        Drop="ListBoxShortCuts_Drop"
-                        ItemContainerStyle="{StaticResource ListBoxItemStyle}"
-                        ItemTemplate="{StaticResource DataTemplate}"
-                        ItemsPanel="{StaticResource ListItemsPanelTemplate}"
-                        PreviewMouseMove="ListBoxShortCuts_PreviewMouseMove"
-                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                        SelectionMode="Extended" />
-        <StackPanel Grid.Row="2" Margin="0,16,0,16" AllowDrop="True"
-                     DragOver="ListBoxShortCuts_DragOver"
-                     Drop="ListBoxShortCuts_Drop"
-                     PreviewMouseMove="ListBoxMoreCuts_PreviewMouseMove"   
-                    >
-            <TextBlock Text="更多工具" FontSize="14" FontFamily="PingFang SC"/>
-        </StackPanel>
-        <Label Grid.Row="2" Visibility="Collapsed"
-               AllowDrop="True"
-               Content="更多工具"
-               DragOver="ListBoxShortCuts_DragOver"
-               Drop="ListBoxShortCuts_Drop"
-               FontSize="20"
-               PreviewMouseMove="ListBoxMoreCuts_PreviewMouseMove"
-               Style="{StaticResource LabelSty}" />
-        <customControl:ListBoxEx x:Name="ListMoreCuts" HorizontalAlignment="Stretch" MinWidth="540"
-                        Grid.Row="3"
-                        AllowDrop="True"
-                        BorderThickness="0"
-                        SizeChanged="ListBoxMoreCuts_SizeChanged" 
-                        DragOver="ListBoxShortCuts_DragOver"
-                        ItemContainerStyle="{StaticResource MoreListBoxItemStyle}"
-                        ItemTemplate="{StaticResource DataTemplate}"
-                        ItemsPanel="{StaticResource ListItemsPanelTemplate}"
-                        PreviewMouseMove="ListBoxMoreCuts_PreviewMouseMove"
-                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                        SelectionMode="Extended" />
-        <Image x:Name="sourceImage" 
-               Grid.RowSpan="4"
-               Width="260"
-               Height="80"
-               HorizontalAlignment="Left"
-               VerticalAlignment="Top"
-               AllowDrop="True"
-               IsHitTestVisible="False" />
-
-        <Grid>
-            <Image x:Name="moveImage"
-               Grid.RowSpan="4"
-               Width="260"
-               Height="80"
-               HorizontalAlignment="Left"
-               VerticalAlignment="Top"
-               IsHitTestVisible="False"
-               Visibility="Hidden">
-                <Image.RenderTransform>
-                    <TranslateTransform x:Name="tt"
-                                    X="0"
-                                    Y="0" />
-                </Image.RenderTransform>
-            </Image>
-        </Grid>
-
-    </Grid>
-</UserControl>

+ 8 - 7
PDF Office/Views/HomePanel/HomeToolIControl.xaml.cs

@@ -1,4 +1,5 @@
 using PDF_Office.CustomControl;
+using PDF_Office.Helper;
 using PDF_Office.ViewModels.HomePanel;
 using PDF_Office.Views.HomePanel.PDFTools;
 using System.Collections.Generic;
@@ -6,26 +7,26 @@ using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Media;
 
-namespace PDF_Office.Views.HomePanel
+namespace PDF_Office.Views.HomePanel.PDFTools
 {
     /// <summary>
     /// HomeToolIControl.xaml 的交互逻辑0
     /// 
     /// </summary>
-    public partial class HomeToolIControl : UserControl
+    public partial class QuickToolsContent : UserControl
     {
 
-        private List<ToolBarsViewModel> allToolbars = null;
-        public HomeToolIControl()
+        private List<QuickToolItem> allToolbars = null;
+        public QuickToolsContent()
         {
             InitializeComponent(); 
-             allToolbars = new List<ToolBarsViewModel>();
+             allToolbars = new List<QuickToolItem>();
             string path = @"pack://application:,,,/Resources/PromotionIcon/Windows.png";
             List<string> all = new List<string>() { "PDF转Word", "PDF转Excel", "PDF转PPT", "转档PDF", "OCR", "拆分",
             "提取","合并","压缩","图片转PDF","安全", "水印", "页眉页脚","贝茨Bates码","批量处理","打印", "背景","插入","文件对比"};
             for (int i = 0; i < 8; i++)
             {
-                ToolBarsViewModel aToolModule = new ToolBarsViewModel();
+                QuickToolItem aToolModule = new QuickToolItem();
                 aToolModule.Id = i + 1;
                 aToolModule.Name = all[i];
                 aToolModule.Image = path;
@@ -66,7 +67,7 @@ namespace PDF_Office.Views.HomePanel
                 {
                    
                     var viewItem = listBoxItem.ContentTemplate;
-                    var myContentPresenter = Utils.FindVisualChild<ContentPresenter>(listBoxItem);
+                    var myContentPresenter = CommonHelper.FindVisualChild<ContentPresenter>(listBoxItem);
                     var obj = viewItem.FindName("data", myContentPresenter);
 
                     var checkNum = obj as HomeToolItem;

+ 5 - 6
PDF Office/Views/HomePanel/HomeToolIControl.xaml

@@ -1,5 +1,5 @@
 <UserControl
-    x:Class="PDF_Office.Views.HomePanel.HomeToolIControl"
+    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"
@@ -53,9 +53,8 @@
                          Color="Beige" />
         <SolidColorBrush x:Key="Item.SelectedActive.Border"
                          Color="Beige" />
-        <!--  TargetType="{x:Type local2:MyListBoxItem}"  -->
         <Style x:Key="ListBoxItemStyle"
-               TargetType="{x:Type customControl:MyListBoxItem}">
+               TargetType="{x:Type customControl:ListItemQuickTool}">
             <Setter Property="SnapsToDevicePixels"
                     Value="True" />
             <Setter Property="FocusVisualStyle"
@@ -66,7 +65,7 @@
             </EventSetter>-->
             <Setter Property="Template">
                 <Setter.Value>
-                    <ControlTemplate TargetType="{x:Type customControl:MyListBoxItem}">
+                    <ControlTemplate TargetType="{x:Type customControl:ListItemQuickTool}">
                         <!--Width="230"  Margin="50,20,0,10"-->
                         <Border x:Name="Border"
                                 Margin="0,0,0,30"
@@ -160,12 +159,12 @@
         </Style>
 
         <Style x:Key="MoreListBoxItemStyle"
-               TargetType="{x:Type customControl:MyListBoxItem}">
+               TargetType="{x:Type customControl:ListItemQuickTool}">
             <Setter Property="SnapsToDevicePixels"
                     Value="True" />
             <Setter Property="Template">
                 <Setter.Value>
-                    <ControlTemplate TargetType="{x:Type customControl:MyListBoxItem}">
+                    <ControlTemplate TargetType="{x:Type customControl:ListItemQuickTool}">
                         <Border x:Name="Border"  Margin="0,0,0,0"
                                 Background="LightGray"
                                 SnapsToDevicePixels="False">