Przeglądaj źródła

Merge branch 'dev' of http://git.kdan.cc:8865/Windows/PDFOffice_Windows_exe into dev

zhuyi 2 lat temu
rodzic
commit
4b47e0c341

+ 13 - 0
PDF Office/PDF Office.csproj

@@ -361,6 +361,8 @@
     <Compile Include="ViewModels\EditTools\Redaction\RedactionContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Redaction\RedactionDocumentContentViewModel.cs" />
     <Compile Include="ViewModels\Form\FormsToolContentViewModel.cs" />
+    <Compile Include="ViewModels\HomePanel\PDFTools\PDFToolsContentViewModel.cs" />
+    <Compile Include="ViewModels\HomePanel\PDFTools\QuickToolsContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\RecentFiles\RecentFilesContentViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\CustomCreateDialogViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\DynamicPropertyDialogViewModel.cs" />
@@ -670,6 +672,9 @@
     <Compile Include="Views\HomePanel\HomeGuidContent.xaml.cs">
       <DependentUpon>HomeGuidContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\HomePanel\PDFTools\PDFToolExpendItem.xaml.cs">
+      <DependentUpon>PDFToolExpendItem.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\HomePanel\PDFTools\PDFToolItem.xaml.cs">
       <DependentUpon>PDFToolItem.xaml</DependentUpon>
     </Compile>
@@ -834,6 +839,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Styles\ContextMenuStyle.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Styles\ContextMenuTextEditStyle.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1145,6 +1154,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Views\HomePanel\PDFTools\PDFToolExpendItem.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\PropertyPanel\AnnotPanel\CustomCreateDialog.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 23 - 0
PDF Office/Styles/ContextMenuStyle.xaml

@@ -0,0 +1,23 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+    <!--快捷工具展开收缩-->
+    <ContextMenu x:Key="ExpendToolsContextMenu" FontSize="14">
+        <ContextMenu.ItemContainerStyle>
+            <Style TargetType="MenuItem">
+                <Setter Property="Padding" Value="0,7,0,7"/>
+                <Setter Property="VerticalContentAlignment" Value="Center"/>
+            </Style>
+        </ContextMenu.ItemContainerStyle>
+        <MenuItem Name="ExpendMenuItem" Header="展开" IsEnabled="True">
+            <MenuItem.Icon>
+                <Path Fill="Black"
+                                              Data="M5.24031 1.5H0.5V14.5H15.5V4H7.24031L5.24031 1.5ZM1.5 13.5V2.5H4.75969L6.75969 5H14.5V13.5H1.5ZM4 7.5H12V6.5H4V7.5Z">
+                    <Path.RenderTransform>
+                        <TranslateTransform X="3.0000" Y="0"/>
+                    </Path.RenderTransform>
+                </Path>
+            </MenuItem.Icon>
+        </MenuItem>
+
+    </ContextMenu>
+</ResourceDictionary>

+ 4 - 99
PDF Office/ViewModels/HomePanel/HomeGuidContentViewModel.cs

@@ -22,106 +22,11 @@ namespace PDF_Office.ViewModels.HomePanel
 {
     public class HomeGuidContentViewModel : BindableBase
     {
-        public IDialogService dialogs;
-        public DelegateCommand<ToolItem> QuickToolsCommand { get; set; }
-        public HomeGuidContentViewModel(IDialogService dialogService)
+        //Todo:首页快捷工具Command事件,已写在HomePanel/PDFTools/QuickToolsContentViewModel.cs里面了
+        public HomeGuidContentViewModel()
         {
-            QuickToolsCommand = new DelegateCommand<ToolItem>(QuickTools_Click);
-            dialogs = dialogService;
-        }
-
-        public void QuickTools_Click(ToolItem toolItem)
-        {
-            /*
-             *设置这个对话框的起始保存路径
-             */
-            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
-            dlg.Multiselect = false;
-            dlg.Filter = "PDF|*.pdf;*.PDF;";
-            if (toolItem.FnType == (int)PDFFnType.Compress || toolItem.FnType == (int)PDFFnType.Security)
-            {
-                dlg.Multiselect = true;
-            }
-                if (toolItem.FnType == (int)PDFFnType.Merge)
-            {
-                dlg.Multiselect = true;
-                dlg.Filter = "Picture|*.png;*.PNG;*.jpg;*.JPG;*bmp;*jpeg;*gif;*tiff;";
-            }
-            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
-            {
-                CPDFViewer viewer = new CPDFViewer();
-                
-                switch ((PDFFnType)toolItem.FnType)
-                {
-                    case PDFFnType.Split:
-                        
-                        viewer.InitDocument(dlg.FileName);
-                        DialogParameters splitvalue = new DialogParameters();
-                        splitvalue.Add(ParameterNames.PDFViewer, viewer);
-                        splitvalue.Add(ParameterNames.FilePath, dlg.FileName);
-                        dialogs.ShowDialog(DialogNames.HomePageSplitDialog, splitvalue, e => { });
-                        break;
-
-                    case PDFFnType.Extract:
-                        viewer.InitDocument(dlg.FileName);
-                        DialogParameters extractvalue = new DialogParameters();
-                        extractvalue.Add(ParameterNames.PDFViewer, viewer);
-                        extractvalue.Add(ParameterNames.FilePath, dlg.FileName);
-                        dialogs.ShowDialog(DialogNames.HomePageExtractDialog, extractvalue, e => { });
-                        break;
-
-                    case PDFFnType.Insert:
-                        viewer.InitDocument(dlg.FileName);
-                        DialogParameters insertvalue = new DialogParameters();
-                        insertvalue.Add(ParameterNames.PDFViewer, viewer);
-                        insertvalue.Add(ParameterNames.FilePath, dlg.FileName);
-                        dialogs.ShowDialog(DialogNames.HomePageInsertDialog, insertvalue, e => { });
-                        break;
-
-                    case PDFFnType.Compress:
-                        DialogParameters compresspdf = new DialogParameters();
-                        compresspdf.Add(ParameterNames.BatchProcessing_Name, "1");
-                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 1;
-                        compresspdf.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, compresspdf, e => { });
-                        break;
-
-                    case PDFFnType.Merge:
-                        DialogParameters picturetopdf = new DialogParameters();
-                        picturetopdf.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePagePictureToPDFDialog, picturetopdf, e => { });
-                        break;
-
-                    case PDFFnType.Print:
-                        viewer.InitDocument(dlg.FileName);
-                        DialogParameters printvalue = new DialogParameters();
-                        printvalue.Add(ParameterNames.PDFViewer, viewer);
-                        printvalue.Add(ParameterNames.FilePath, dlg.FileName);
-                        dialogs.ShowDialog(DialogNames.HomePagePrinterDialog, printvalue, e => { });
-                        break;
-
-                    case PDFFnType.Security:
-                        DialogParameters securitypdf = new DialogParameters();
-                        securitypdf.Add(ParameterNames.BatchProcessing_Name, "2");
-                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 2;
-                        securitypdf.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, securitypdf, e => { });
-                        
-                        break;
-                    case PDFFnType.ConvertPDF:
-                        DialogParameters convertpdf = new DialogParameters();
-                        convertpdf.Add(ParameterNames.BatchProcessing_Name, "0");
-                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
-                        convertpdf.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdf, e => { });
-
-                        break;
-                }
-
-            }
+          
+          
         }
 
     }

+ 78 - 0
PDF Office/ViewModels/HomePanel/PDFTools/PDFToolsContentViewModel.cs

@@ -0,0 +1,78 @@
+using Prism.Commands;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+
+namespace PDF_Office.ViewModels.HomePanel.PDFTools
+{
+    public class PDFToolsContentViewModel : BindableBase
+    {
+        #region 属性
+        /// <summary>
+        /// 扩展/收缩
+        /// </summary>
+        private bool _isExpendTools = false;
+        public bool IsExpendTools
+        {
+            get { return _isExpendTools; }
+            set { SetProperty(ref _isExpendTools, value); }
+        }
+
+        #endregion
+
+        #region Command and Event
+        public DelegateCommand<object> OpenMenuCommand { get; set; }
+        public DelegateCommand ExpendCommand { get; set; }
+
+        public event EventHandler<bool> ExpendToolsHanlder;
+
+        #endregion
+
+        public PDFToolsContentViewModel()
+        {
+            InitCommand();
+        }
+
+        private void InitCommand()
+        {
+            OpenMenuCommand = new DelegateCommand<object>(OpenMenu);
+            ExpendCommand = new DelegateCommand(Expend);
+        }
+
+        private void Expend()
+        {
+            IsExpendTools = !IsExpendTools;
+            ExpendToolsHanlder?.Invoke(null, IsExpendTools);
+        }
+
+        private void OpenMenu(object obj)
+        {
+            var menu = App.Current.FindResource("ExpendToolsContextMenu") as ContextMenu;
+            var btn = obj as Button;
+            if (menu != null && btn != null)
+            {
+                if (menu.Items.Count == 1)
+                {
+                    var item = menu.Items[0] as MenuItem;
+                    if (_isExpendTools)
+                    {
+                        item.Header = "收缩";
+                    }
+                    else
+                    {
+                        item.Header = "展开";
+                    }
+
+                    item.Command = ExpendCommand;
+                    //btn.ContextMenu = menu;
+                    menu.PlacementTarget = btn;
+                    menu.IsOpen = true;
+                }
+            }
+        }
+    }
+}

+ 222 - 0
PDF Office/ViewModels/HomePanel/PDFTools/QuickToolsContentViewModel.cs

@@ -0,0 +1,222 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
+using PDFSettings;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+
+namespace PDF_Office.ViewModels.HomePanel.PDFTools
+{
+    public class QuickToolsContentViewModel : BindableBase
+    {
+        #region 属性
+        /// <summary>
+        /// 扩展/收缩
+        /// </summary>
+        private bool _isExpendTools = false;
+        public bool IsExpendTools
+        {
+            get { return _isExpendTools; }
+            set { SetProperty(ref _isExpendTools, value); }
+        }
+
+        private string regionName;
+
+        public string ToolRegionName
+        {
+            get { return regionName; }
+            set { SetProperty(ref regionName, value); }
+        }
+
+        #endregion
+
+        #region Command and Event
+        public IDialogService dialogs;
+        public DelegateCommand<ToolItem> QuickToolsCommand { get; set; }
+        public DelegateCommand<object> OpenMenuCommand { get; set; }
+        public DelegateCommand ExpendCommand { get; set; }
+        public DelegateCommand ShowToolCommand { get; set; }
+
+        public IRegionManager toolregion;
+        public event EventHandler<bool> ExpendToolsHanlder;
+        #endregion
+
+        public QuickToolsContentViewModel(IDialogService dialogService, IRegionManager regionManager)
+        {
+            toolregion = regionManager;
+            ToolRegionName = RegionNames.ToolRegionName;
+            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+            {
+                toolregion.RequestNavigate(ToolRegionName, "Guid");
+            }));
+
+            dialogs = dialogService;
+
+            InitVariable();
+            InitCommand();
+            
+        }
+
+        #region 初始化和绑定
+        private void InitVariable()
+        {
+
+        }
+
+        private void InitCommand()
+        {
+            QuickToolsCommand = new DelegateCommand<ToolItem>(QuickTools_Click);
+            OpenMenuCommand = new DelegateCommand<object>(OpenMenu);
+            ExpendCommand = new DelegateCommand(Expend);
+            ShowToolCommand = new DelegateCommand(ShowTool);
+        }
+
+        #endregion
+
+        private void ShowTool()
+        {
+            toolregion.RequestNavigate(ToolRegionName, "Tools");
+        }
+
+
+        public void QuickTools_Click(ToolItem toolItem)
+        {
+            /*
+             *设置这个对话框的起始保存路径
+             */
+            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
+            dlg.Multiselect = false;
+            dlg.Filter = "PDF|*.pdf;*.PDF;";
+            if (toolItem.FnType == (int)PDFFnType.Compress || toolItem.FnType == (int)PDFFnType.Security)
+            {
+                dlg.Multiselect = true;
+            }
+            if (toolItem.FnType == (int)PDFFnType.Merge)
+            {
+                dlg.Multiselect = true;
+                dlg.Filter = "Picture|*.png;*.PNG;*.jpg;*.JPG;*bmp;*jpeg;*gif;*tiff;";
+            }
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                CPDFViewer viewer = new CPDFViewer();
+
+                switch ((PDFFnType)toolItem.FnType)
+                {
+                    case PDFFnType.Split:
+
+                        viewer.InitDocument(dlg.FileName);
+                        DialogParameters splitvalue = new DialogParameters();
+                        splitvalue.Add(ParameterNames.PDFViewer, viewer);
+                        splitvalue.Add(ParameterNames.FilePath, dlg.FileName);
+                        dialogs.ShowDialog(DialogNames.HomePageSplitDialog, splitvalue, e => { });
+                        break;
+
+                    case PDFFnType.Extract:
+                        viewer.InitDocument(dlg.FileName);
+                        DialogParameters extractvalue = new DialogParameters();
+                        extractvalue.Add(ParameterNames.PDFViewer, viewer);
+                        extractvalue.Add(ParameterNames.FilePath, dlg.FileName);
+                        dialogs.ShowDialog(DialogNames.HomePageExtractDialog, extractvalue, e => { });
+                        break;
+
+                    case PDFFnType.Insert:
+                        viewer.InitDocument(dlg.FileName);
+                        DialogParameters insertvalue = new DialogParameters();
+                        insertvalue.Add(ParameterNames.PDFViewer, viewer);
+                        insertvalue.Add(ParameterNames.FilePath, dlg.FileName);
+                        dialogs.ShowDialog(DialogNames.HomePageInsertDialog, insertvalue, e => { });
+                        break;
+
+                    case PDFFnType.Compress:
+                        DialogParameters compresspdf = new DialogParameters();
+                        compresspdf.Add(ParameterNames.BatchProcessing_Name, "1");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 1;
+                        compresspdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, compresspdf, e => { });
+                        break;
+
+                    case PDFFnType.Merge:
+                        DialogParameters picturetopdf = new DialogParameters();
+                        picturetopdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePagePictureToPDFDialog, picturetopdf, e => { });
+                        break;
+
+                    case PDFFnType.Print:
+                        viewer.InitDocument(dlg.FileName);
+                        DialogParameters printvalue = new DialogParameters();
+                        printvalue.Add(ParameterNames.PDFViewer, viewer);
+                        printvalue.Add(ParameterNames.FilePath, dlg.FileName);
+                        dialogs.ShowDialog(DialogNames.HomePagePrinterDialog, printvalue, e => { });
+                        break;
+
+                    case PDFFnType.Security:
+                        DialogParameters securitypdf = new DialogParameters();
+                        securitypdf.Add(ParameterNames.BatchProcessing_Name, "2");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 2;
+                        securitypdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, securitypdf, e => { });
+
+                        break;
+                    case PDFFnType.ConvertPDF:
+                        DialogParameters convertpdf = new DialogParameters();
+                        convertpdf.Add(ParameterNames.BatchProcessing_Name, "0");
+                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
+                        convertpdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdf, e => { });
+
+                        break;
+                }
+
+            }
+        }
+
+
+
+        private void Expend()
+        {
+            IsExpendTools = !IsExpendTools;
+            ExpendToolsHanlder?.Invoke(null, IsExpendTools);
+        }
+
+        private void OpenMenu(object obj)
+        {
+            var menu = App.Current.FindResource("ExpendToolsContextMenu") as ContextMenu;
+            var btn = obj as Button;
+            if (menu != null && btn != null)
+            {
+                if(menu.Items.Count == 1)
+                {
+                  var item = menu.Items[0] as MenuItem;
+                    if(_isExpendTools)
+                    {
+                        item.Header = "收缩";
+                    }
+                    else
+                    {
+                        item.Header = "展开";
+                    }
+
+                    item.Command = ExpendCommand;
+                    //btn.ContextMenu = menu;
+                    menu.PlacementTarget = btn;
+                    menu.IsOpen = true;
+                }
+            }
+        }
+
+
+
+    }
+}

+ 43 - 0
PDF Office/Views/HomePanel/PDFTools/PDFToolExpendItem.xaml

@@ -0,0 +1,43 @@
+<UserControl x:Class="PDF_Office.Views.HomePanel.PDFTools.PDFToolExpendItem"
+             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:convert="clr-namespace:PDF_Office.DataConvert"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <UserControl.Resources>
+    </UserControl.Resources>
+    <Grid  Margin="1,1,1,1" Background="White">
+        <Border x:Name="BorderExtend" Height="108"  Background="White">
+
+            <Grid>
+                <Grid Margin="10">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                        <ColumnDefinition Width="*"></ColumnDefinition>
+                    </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <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" />
+
+                    <TextBlock  Name="TxbTitle" Grid.Column="1" Text="{Binding Title}" 
+                                    FontSize="14" FontWeight="SemiBold" Foreground="Black"
+                                    VerticalAlignment="Top" Margin="0,15,0,0"></TextBlock>
+
+
+                    <StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1"  Margin="6,0,6,0">
+                        <Grid>
+                            <TextBlock Name="ToolInfoBlock" Text="{Binding TitleInfo}"
+                                       Foreground="#666666" LineHeight="16"  FontSize="12"  TextWrapping="Wrap" VerticalAlignment="Center" Margin="0,8,0,0"></TextBlock>
+                        </Grid>
+
+                    </StackPanel>
+                </Grid>
+            </Grid>
+        </Border>
+    </Grid>
+</UserControl>

+ 81 - 0
PDF Office/Views/HomePanel/PDFTools/PDFToolExpendItem.xaml.cs

@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.HomePanel.PDFTools
+{
+    /// <summary>
+    /// PDFToolExpendItem.xaml 的交互逻辑
+    /// </summary>
+
+    public partial class PDFToolExpendItem : UserControl
+    {
+        public PDFToolExpendItem()
+        {
+            InitializeComponent();
+            this.Loaded += usercontrol_Loaded;
+        }
+
+        private void usercontrol_Loaded(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void InitContent()
+        {
+           
+        }
+
+        public string IconPath
+        {
+            get
+            {
+                return (string)GetValue(IconPathProperty);
+            }
+            set
+            {
+                SetValue(IconPathProperty, value);
+            }
+        }
+
+        public static readonly DependencyProperty IconPathProperty = DependencyProperty.Register("IconPath", typeof(string), typeof(PDFToolExpendItem), new PropertyMetadata(string.Empty));
+
+        public string ToolTitile
+        {
+            get
+            {
+                return (string)GetValue(ToolTitileProperty);
+            }
+            set
+            {
+                SetValue(ToolTitileProperty, value);
+            }
+        }
+        public static readonly DependencyProperty ToolTitileProperty = DependencyProperty.Register("ToolTitile", typeof(string), typeof(PDFToolExpendItem), new PropertyMetadata(string.Empty));
+
+        public string ToolInfo
+        {
+            get
+            {
+                return (string)GetValue(ToolInfoProperty);
+            }
+            set
+            {
+                SetValue(ToolInfoProperty, value);
+            }
+        }
+        public static readonly DependencyProperty ToolInfoProperty = DependencyProperty.Register("ToolInfo", typeof(string), typeof(PDFToolExpendItem), new PropertyMetadata(string.Empty));
+
+    }
+}

+ 2 - 36
PDF Office/Views/HomePanel/PDFTools/PDFToolItem.xaml

@@ -8,45 +8,11 @@
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <UserControl.Resources>
-        <convert:BoolToVisible x:Key="boolToVisible"/>
-        <convert:InvertBoolToVisibleConvert x:Key="invertBoolToVisibleConvert"/>
     </UserControl.Resources>
     <Grid  Margin="1,1,1,1" Background="White">
-
-        <Border x:Name="BorderExtend" Height="108"  Background="White"
-                Visibility="{Binding IsShowConciseContent,Converter={StaticResource invertBoolToVisibleConvert},Mode=OneWay}">
-
-            <Grid   MouseEnter="Border_MouseEnter" MouseLeave="Border_MouseLeave">
-                <Grid Margin="10">
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="auto"></ColumnDefinition>
-                        <ColumnDefinition Width="*"></ColumnDefinition>
-                    </Grid.ColumnDefinitions>
-                    <Grid.RowDefinitions>
-                        <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" />
-
-                    <TextBlock  Name="TxbTitle" Grid.Column="1" Text="{Binding Title}" 
-                                    FontSize="14" FontWeight="SemiBold" Foreground="Black"
-                                    VerticalAlignment="Top" Margin="0,15,0,0"></TextBlock>
-
-
-                    <StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1"  Margin="6,0,6,0">
-                        <Grid>
-                            <TextBlock Name="ToolInfoBlock" Text="{Binding TitleInfo}"
-                                       Foreground="#666666" LineHeight="16"  FontSize="12"  TextWrapping="Wrap" VerticalAlignment="Center" Margin="0,8,0,0"></TextBlock>
-                        </Grid>
-
-                    </StackPanel>
-                </Grid>
-            </Grid>
-        </Border>
-
         <Border x:Name="BorderConcise" Height="64" 
-                Visibility="{Binding IsShowConciseContent,Converter={StaticResource boolToVisible},Mode=OneWay}">
-            <Grid Background="Transparent" MouseEnter="Border_MouseEnter" MouseLeave="Border_MouseLeave">
+                >
+            <Grid Background="Transparent">
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="auto"/>
                     <ColumnDefinition Width="*"/>

+ 1 - 140
PDF Office/Views/HomePanel/PDFTools/PDFToolItem.xaml.cs

@@ -20,111 +20,11 @@ namespace PDF_Office.Views.HomePanel.PDFTools
 
         private void usercontrol_Loaded(object sender, RoutedEventArgs e)
         {
-            try
-            {
-                Grid Control = sender as Grid;
-
-                if (Control != null)
-                {
-                    ShowisHover(false);
-                }
-                if (IconPath != string.Empty)
-                {
-                 //   BitmapImage ImageItem = new BitmapImage(new Uri(IconPath));
-                //    IconBrush.ImageSource = ImageItem;
-               //     IconConcise.ImageSource = ImageItem;
-                }
-                InitContent();
-            }
-            catch (Exception ex)
-            {
-
-            }
+         
         }
 
         private void InitContent()
         {
-            if(ToolTitile != string.Empty)
-            {
-              //  TitleBlock_Hov.Text = TitleBlock.Text =  App.HomePageLoader.GetString(ToolTitile);
-            }
-
-            if(ToolInfo != string.Empty)
-            {
-             //   ToolInfoBlock.Text = ToolInfoBlock_Hov.Text = App.HomePageLoader.GetString(ToolInfo);
-            }
-        }
-
-        private void Border_MouseEnter(object sender, MouseEventArgs e)
-        {
-            try
-            {
-                Grid Control = sender as Grid;
-                if (Control != null)
-                {
-                    ShowisHover(true);
-                }
-                if (IconHoverPath != string.Empty)
-                {
-               //     BitmapImage ImageItem = new BitmapImage(new Uri(IconHoverPath));
-               //     IconBrush.ImageSource = ImageItem;
-               //     IconConcise.ImageSource = ImageItem;
-                }
-               
-            }
-            catch (Exception ex)
-            {
-
-            }
-        }
-
-        private void Border_MouseLeave(object sender, MouseEventArgs e)
-        {
-            try
-            {
-                Grid Control = sender as Grid;
-
-                if (Control != null)
-                {
-                    ShowisHover(false);
-                }
-                if (IconPath != string.Empty)
-                {
-                  //  BitmapImage ImageItem = new BitmapImage(new Uri(IconPath));
-                 //   IconBrush.ImageSource = ImageItem;
-                  //  IconConcise.ImageSource = ImageItem;
-                }
-
-               
-            }
-            catch (Exception ex)
-            {
-
-            }
-        }
-
-        /// <summary>
-        /// 光标悬浮和离开区域时,各UI显示效果
-        /// </summary>
-        /// <param name="ishover">是否处于悬浮状态</param>
-        private void ShowisHover(bool ishover)
-        {
-            if(ishover)
-            {
-                BorderConcise.Background = BorderExtend.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#477EDE"));
-                BorderConcise.BorderThickness = BorderExtend.BorderThickness = new Thickness(2);
-                TxbTitleConcise.Foreground = TxbTitle.Foreground = new SolidColorBrush(Colors.White);
-                ToolInfoBlock.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF"));
-           
-            }
-            else
-            {
-                BorderConcise.Background = BorderExtend.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF"));
-                BorderConcise.BorderThickness = BorderExtend.BorderThickness = new Thickness(0);
-                TxbTitleConcise.Foreground = TxbTitle.Foreground = new SolidColorBrush(Colors.Black);
-                ToolInfoBlock.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#666666"));
-               
-            }
         }
 
         public string IconPath
@@ -140,44 +40,5 @@ namespace PDF_Office.Views.HomePanel.PDFTools
         }
 
         public static readonly DependencyProperty IconPathProperty = DependencyProperty.Register("IconPath", typeof(string), typeof(PDFToolItem), new PropertyMetadata(string.Empty));
-        public string IconHoverPath
-        {
-            get
-            {
-                return (string)GetValue(IconHoverPathProperty);
-            }
-            set
-            {
-                SetValue(IconHoverPathProperty, value);
-            }
-        }
-        public static readonly DependencyProperty IconHoverPathProperty = DependencyProperty.Register("IconHoverPath", typeof(string), typeof(PDFToolItem), new PropertyMetadata(string.Empty));
-
-        public string ToolTitile
-        {
-            get
-            {
-                return (string)GetValue(ToolTitileProperty);
-            }
-            set
-            {
-                SetValue(ToolTitileProperty, value);
-            }
-        }
-        public static readonly DependencyProperty ToolTitileProperty = DependencyProperty.Register("ToolTitile", typeof(string), typeof(PDFToolItem), new PropertyMetadata(string.Empty));
-
-        public string ToolInfo
-        {
-            get
-            {
-                return (string)GetValue(ToolInfoProperty);
-            }
-            set
-            {
-                SetValue(ToolInfoProperty, value);
-            }
-        }
-        public static readonly DependencyProperty ToolInfoProperty = DependencyProperty.Register("ToolInfo", typeof(string), typeof(PDFToolItem), new PropertyMetadata(string.Empty));
-
     }
 }

+ 59 - 11
PDF Office/Views/HomePanel/PDFTools/PDFToolsContent.xaml

@@ -6,6 +6,8 @@
       xmlns:local="clr-namespace:PDF_Office.Views.HomePanel.PDFTools"
       xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
       xmlns:converter="clr-namespace:PDF_Office.DataConvert"
+      xmlns:prism ="http://prismlibrary.com/"
+      prism:ViewModelLocator.AutoWireViewModel="True"
       Background="White"  MinWidth="540" MinHeight="460"
       mc:Ignorable="d"  Loaded="Page_Loaded"
       d:DesignHeight="450" d:DesignWidth="800"
@@ -17,7 +19,7 @@
                 <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml"/>
             </ResourceDictionary.MergedDictionaries>
             <converter:BoolToVisible x:Key="BoolToVisibilityConverter" />
-
+            <converter:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert"/>
             <Style x:Key="LabelSty"
                TargetType="{x:Type Label}">
                 <Setter Property="Padding"
@@ -32,6 +34,10 @@
                 <local:PDFToolItem x:Name="data"/>
             </DataTemplate>
 
+            <DataTemplate x:Key="ExpendDataTemplate">
+                <local:PDFToolExpendItem x:Name="Expendata"/>
+            </DataTemplate>
+
             <ItemsPanelTemplate x:Key="ListItemsPanelTemplate">
                 <WrapPanel AllowDrop="True"
                        Orientation="Horizontal" />
@@ -63,23 +69,27 @@
             Visibility="Visible">
 
                     <Button
-                x:Name="BtnTools"
+                x:Name="BtnCustom"
                 Width="68"
                 Height="28"
                 Margin="0,0,0,0"
                 Background="#FFFFFF"
-                Content="Tools"
+                Content="Custom"
                 Click="BtnTools_Click"
                >
 
                     </Button>
 
-                    <customControl:CustomIconToggleBtn x:Name="BtnExptend"  Click="BtnExptend_Click"
-                                                        Style="{StaticResource ToggleBtnViewModeStyle}"
-                                                       >
-                        <TextBlock Text="展开"/>
-                    </customControl:CustomIconToggleBtn>
-                    
+                    <Button
+                x:Name="BtnMore"
+                Width="28"
+                Height="28"
+                Margin="12,0,0,0"
+                 Background="#FFFFFF" BorderThickness="0" Content="..."
+                Command="{Binding OpenMenuCommand}" CommandParameter="{Binding ElementName=BtnMore}"
+               >
+                    </Button>
+
                 </StackPanel>
             </Grid>
            
@@ -107,7 +117,25 @@
                         ItemsPanel="{StaticResource ListItemsPanelTemplate}"
                         PreviewMouseMove="ListBoxShortCuts_PreviewMouseMove"
                         ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                        SelectionMode="Extended" />
+                        SelectionMode="Extended"
+                        Visibility="{Binding IsExpendTools,Converter={StaticResource InvertBoolToVisibleConvert}}"             
+                                 />
+
+        <customControl:ListBoxEx x:Name="ListShortCutsExpend" 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 ExpendDataTemplate}"
+                        ItemsPanel="{StaticResource ListItemsPanelTemplate}"
+                        PreviewMouseMove="ListBoxShortCuts_PreviewMouseMove"
+                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                        SelectionMode="Extended" 
+                         Visibility="{Binding IsExpendTools,Converter={StaticResource BoolToVisibilityConverter}}"         
+                                 />
         <StackPanel Grid.Row="2" Margin="0,16,0,16" AllowDrop="True"
                      DragOver="ListBoxShortCuts_DragOver"
                      Drop="ListBoxShortCuts_Drop"
@@ -134,7 +162,27 @@
                         ItemsPanel="{StaticResource ListItemsPanelTemplate}"
                         PreviewMouseMove="ListBoxMoreCuts_PreviewMouseMove"
                         ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                        SelectionMode="Extended" />
+                        SelectionMode="Extended"
+                        Visibility="{Binding IsExpendTools,Converter={StaticResource InvertBoolToVisibleConvert}}"    
+                                 />
+        
+        
+
+        <customControl:ListBoxEx x:Name="ListMoreCutsExpend" HorizontalAlignment="Stretch" MinWidth="540"
+                        Grid.Row="3"
+                        AllowDrop="True"
+                        BorderThickness="0"
+                        SizeChanged="ListBoxMoreCuts_SizeChanged" 
+                        DragOver="ListBoxShortCuts_DragOver"
+                        ItemContainerStyle="{StaticResource MoreListBoxItemStyle}"
+                        ItemTemplate="{StaticResource ExpendDataTemplate}"
+                        ItemsPanel="{StaticResource ListItemsPanelTemplate}"
+                        PreviewMouseMove="ListBoxMoreCuts_PreviewMouseMove"
+                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                        SelectionMode="Extended" 
+                        Visibility="{Binding IsExpendTools,Converter={StaticResource BoolToVisibilityConverter}}"                      
+                                 />
+        
         <Image x:Name="sourceImage" 
                Grid.RowSpan="4"
                Width="260"

+ 128 - 38
PDF Office/Views/HomePanel/PDFTools/PDFToolsContent.xaml.cs

@@ -2,6 +2,7 @@
 using PDF_Office.Helper;
 using PDF_Office.Model.PDFTool;
 using PDF_Office.ViewModels.HomePanel;
+using PDF_Office.ViewModels.HomePanel.PDFTools;
 using PDFSettings;
 using System;
 using System.Collections.Generic;
@@ -28,6 +29,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
     /// </summary>
     public partial class PDFToolsContent : UserControl
     {
+        private PDFToolsContentViewModel ViewModel => DataContext as PDFToolsContentViewModel;
         private ListItemQuickTool sourceListItem = null;
         private ListItemQuickTool targetListItem = null;
         private ListItemQuickTool quickSourceListItem = null;
@@ -74,32 +76,92 @@ namespace PDF_Office.Views.HomePanel.PDFTools
             quickTools = PDFtools.QuickTools;
             allTools = PDFtools.AllTools;
             moreTools = PDFtools.MoreTools;
-            ListShortCuts.ItemsSource = quickTools;
-            ListMoreCuts.ItemsSource = moreTools;
-           
+            ListShortCutsExpend.ItemsSource = ListShortCuts.ItemsSource = quickTools;
+            ListMoreCutsExpend.ItemsSource = ListMoreCuts.ItemsSource = moreTools;
+
         }
 
         private void Page_Loaded(object sender, RoutedEventArgs e)
         {
             UpdateExptend();
+            if (ViewModel != null)
+            {
+                ViewModel.ExpendToolsHanlder -= ViewModel_ExpendToolsHanlder;
+                ViewModel.ExpendToolsHanlder += ViewModel_ExpendToolsHanlder;
+            }
+        }
+
+        private void ViewModel_ExpendToolsHanlder(object sender, bool e)
+        {
+            if(e)
+            {
+                ListShortCutsExpend.Items.Refresh();
+                ListMoreCutsExpend.Items.Refresh();
+                ListBoxCutsWidthChanged(ListShortCutsExpend);
+                ListBoxCutsWidthChanged(ListMoreCutsExpend);
+            }
+            else
+            {
+                ListShortCuts.Items.Refresh();
+                ListMoreCuts.Items.Refresh();
+                ListBoxCutsWidthChanged(ListShortCuts);
+                ListBoxCutsWidthChanged(ListMoreCuts);
+            }
+        }
+
+        private ListBoxEx GetListShortControl()
+        {
+            ListBoxEx ShortEx = null;
+
+            if (ListShortCuts.Visibility == Visibility.Visible)
+            {
+                ShortEx = ListShortCuts;
+            }
+            else
+            {
+                ShortEx = ListShortCutsExpend;
+            }
+
+            return ShortEx;
+        }
+
+        private ListBoxEx GetListMoreControl()
+        {
+            ListBoxEx MoreEx = null;
+
+            if (ListMoreCuts.Visibility == Visibility.Visible)
+            {
+                MoreEx = ListMoreCuts;
+
+            }
+            else
+            {
+                MoreEx = ListMoreCutsExpend;
+            }
+
+            return MoreEx;
         }
 
         private void ListBoxMoreCuts_PreviewMouseMove(object sender, MouseEventArgs e)
         {
-            var pos = e.GetPosition(ListMoreCuts);
+            ListBoxEx MoreEx = GetListMoreControl();
+            if (MoreEx == null) return;
+
+
+            var pos = e.GetPosition(MoreEx);
 
             if (e.LeftButton == MouseButtonState.Pressed)
             {
-                ListMoreCuts.AllowDrop = true;
+                MoreEx.AllowDrop = true;
 
-                HitTestResult result = VisualTreeHelper.HitTest(ListMoreCuts, pos);
+                HitTestResult result = VisualTreeHelper.HitTest(MoreEx, pos);
                 if (result == null)
                 {
                     sourceImage.Visibility = Visibility.Hidden;
                     return;
                 }
                 sourceListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
-                if (sourceListItem == null || sourceListItem.Content != ListMoreCuts.SelectedItem)
+                if (sourceListItem == null || sourceListItem.Content != MoreEx.SelectedItem)
                 {
                     return;
                 }
@@ -122,7 +184,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                     ImageDecoding();
 
                     isMoreCuts = true;
-                    DragDrop.DoDragDrop(ListMoreCuts, dataObj, System.Windows.DragDropEffects.Move);
+                    DragDrop.DoDragDrop(MoreEx, dataObj, System.Windows.DragDropEffects.Move);
                 }
             }
             else
@@ -160,9 +222,12 @@ namespace PDF_Office.Views.HomePanel.PDFTools
 
         private void ListBoxShortCuts_Drop(object sender, DragEventArgs e)
         {
-            var pos = e.GetPosition(ListShortCuts);
+            ListBoxEx ShortEx = GetListShortControl();
+            if(ShortEx == null) return;
+
+            var pos = e.GetPosition(ShortEx);
 
-            var result = VisualTreeHelper.HitTest(ListShortCuts, pos);
+            var result = VisualTreeHelper.HitTest(ShortEx, pos);
             if (result == null)
             {
                 WorkingWithAnimation(pos);
@@ -208,12 +273,18 @@ namespace PDF_Office.Views.HomePanel.PDFTools
         {
             if (moreTools == null) return;
             ToolItem source = moreTools.Find(c => c.Title == sourceAToolModule.Title);
+            ListBoxEx MoreEx = GetListMoreControl();
+            if (MoreEx == null) return;
+
+            ListBoxEx ShortEx = GetListShortControl();
+            if (ShortEx == null) return;
+
 
             int targetIndex = quickTools.FindIndex(item => item.Title == targetAToolModule.Title);
             if (targetIndex < 0) return;
             if (!isMoreCuts)
             {
-                ListMoreCuts.AllowDrop = false;
+                MoreEx.AllowDrop = false;
                 sourceImage.Visibility = Visibility.Hidden;
                 source = quickTools.Find(c => c.Title == sourceAToolModule.Title);
                 if (source == null) return;
@@ -222,8 +293,8 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                 var temp = quickTools[sourceIndex];
                 quickTools[sourceIndex] = quickTools[targetIndex];
                 quickTools[targetIndex] = temp;
-                ListShortCuts.Items.Refresh();
-                ListBoxCutsWidthChanged(ListShortCuts);
+                ShortEx.Items.Refresh();
+                ListBoxCutsWidthChanged(ShortEx);
             }
             else
             {
@@ -235,13 +306,13 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                 quickTools.Remove(target);
                 quickTools.Insert(targetIndex, source);
 
-                ListMoreCuts.Items.Refresh();
-                ListShortCuts.Items.Refresh(); 
+                MoreEx.Items.Refresh();
+                ShortEx.Items.Refresh(); 
 
                 sourceImage.Visibility = Visibility.Hidden;
                 targetListItem.IsOverModular = false;
-                ListBoxCutsWidthChanged(ListShortCuts);
-                ListBoxCutsWidthChanged(ListMoreCuts);
+                ListBoxCutsWidthChanged(ShortEx);
+                ListBoxCutsWidthChanged(MoreEx);
             }
         }
 
@@ -341,7 +412,13 @@ namespace PDF_Office.Views.HomePanel.PDFTools
 
         private void ListBoxShortCuts_DragOver(object sender, DragEventArgs e)
         {
-            var pos = e.GetPosition(ListShortCuts);
+            ListBoxEx MoreEx = GetListMoreControl();
+            if (MoreEx == null) return;
+
+            ListBoxEx ShortEx = GetListShortControl();
+            if (ShortEx == null) return;
+
+            var pos = e.GetPosition(ShortEx);
             Console.WriteLine($"pos:{pos.X}  {pos.Y} this.Grid.ActualHeight1 {this.Grid.ActualHeight}");
             if (pos.Y < 0)
             {
@@ -378,12 +455,12 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                 if (sourceAToolModule == null) return;
                 int sourceIndex = quickTools.FindIndex(item => item.Title == sourceAToolModule.Title);
                 //根据index找listbox对应的item
-                sourceListItem = (ListItemQuickTool)(ListShortCuts.ItemContainerGenerator.ContainerFromIndex(sourceIndex) as FrameworkElement);
+                sourceListItem = (ListItemQuickTool)(ShortEx.ItemContainerGenerator.ContainerFromIndex(sourceIndex) as FrameworkElement);
                 if (sourceListItem == null)
                 {
                     return;
                 }
-                ListMoreCuts.AllowDrop = false;
+                MoreEx.AllowDrop = false;
                 sourceImage.Visibility = Visibility.Hidden;
             }
             else
@@ -392,7 +469,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                 if (sourceAToolModule == null) return;
                 int sourceIndex = moreTools.FindIndex(item => item.Title == sourceAToolModule.Title);
                 //根据index找listbox对应的item
-                sourceListItem = (ListItemQuickTool)(ListMoreCuts.ItemContainerGenerator.ContainerFromIndex(sourceIndex) as FrameworkElement);
+                sourceListItem = (ListItemQuickTool)(MoreEx.ItemContainerGenerator.ContainerFromIndex(sourceIndex) as FrameworkElement);
                 if (sourceListItem == null)
                 {
                     return;
@@ -401,7 +478,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                 //图片绑定
                 ImageBinding(pos);
             }
-            var result = VisualTreeHelper.HitTest(ListShortCuts, pos);
+            var result = VisualTreeHelper.HitTest(ShortEx, pos);
             if (result == null)
             {
                 return;
@@ -436,15 +513,22 @@ namespace PDF_Office.Views.HomePanel.PDFTools
         {
             if (e.LeftButton == MouseButtonState.Pressed)
             {
-                ListMoreCuts.AllowDrop = false;
-                var pos = e.GetPosition(ListShortCuts);
-                HitTestResult result = VisualTreeHelper.HitTest(ListShortCuts, pos);
+                ListBoxEx MoreEx = GetListMoreControl();
+                if (MoreEx == null) return;
+
+                ListBoxEx ShortEx = GetListShortControl();
+                if (ShortEx == null) return;
+
+
+                MoreEx.AllowDrop = false;
+                var pos = e.GetPosition(ShortEx);
+                HitTestResult result = VisualTreeHelper.HitTest(ShortEx, pos);
                 if (result == null)
                 {
                     return;
                 }
                 quickSourceListItem = (ListItemQuickTool)CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
-                if (quickSourceListItem == null || quickSourceListItem.Content != ListShortCuts.SelectedItem)
+                if (quickSourceListItem == null || quickSourceListItem.Content != ShortEx.SelectedItem)
                 {
                     return;
                 }
@@ -453,7 +537,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                 if (dataObj != null)
                 {
                     isMoreCuts = false;
-                    DragDrop.DoDragDrop(ListShortCuts, dataObj, System.Windows.DragDropEffects.Move);
+                    DragDrop.DoDragDrop(ShortEx, dataObj, System.Windows.DragDropEffects.Move);
                 }
             }
             else
@@ -497,12 +581,18 @@ namespace PDF_Office.Views.HomePanel.PDFTools
 
         private void ListBoxShortCuts_SizeChanged(object sender, SizeChangedEventArgs e)
         {
-            ListBoxCutsWidthChanged(ListShortCuts);
+            ListBoxEx ShortEx = GetListShortControl();
+            if (ShortEx == null) return;
+
+            ListBoxCutsWidthChanged(ShortEx);
         }
 
         private void ListBoxMoreCuts_SizeChanged(object sender, SizeChangedEventArgs e)
         {
-            ListBoxCutsWidthChanged(ListMoreCuts);
+            ListBoxEx MoreEx = GetListMoreControl();
+            if (MoreEx == null) return;
+
+            ListBoxCutsWidthChanged(MoreEx);
         }
 
         private void ListBoxCutsWidthChanged(ListBoxEx list)
@@ -546,15 +636,15 @@ namespace PDF_Office.Views.HomePanel.PDFTools
 
         private void UpdateExptend()
         {
-            foreach (var item in allTools)
-            {
-                item.IsShowConciseContent = !(bool)BtnExptend.IsChecked;
-            }
-
-            foreach (var item in quickTools)
-            {
-                item.IsShowConciseContent = !(bool)BtnExptend.IsChecked;
-            }
+            //foreach (var item in allTools)
+            //{
+            //    item.IsShowConciseContent = !(bool)BtnExptend.IsChecked;
+            //}
+
+            //foreach (var item in quickTools)
+            //{
+            //    item.IsShowConciseContent = !(bool)BtnExptend.IsChecked;
+            //}
         }
 
         //自适应流式布局,以防改需求备用

+ 26 - 12
PDF Office/Views/HomePanel/PDFTools/QuickToolsContent.xaml

@@ -8,6 +8,8 @@
     xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
     xmlns:converter="clr-namespace:PDF_Office.DataConvert"
     xmlns:pDFTools="clr-namespace:PDF_Office.Views.HomePanel.PDFTools"
+    xmlns:prism ="http://prismlibrary.com/"
+    prism:ViewModelLocator.AutoWireViewModel="True"
     d:DesignHeight="450"
     d:DesignWidth="800"
     Loaded="UserControl_Loaded"
@@ -18,6 +20,7 @@
                 <ResourceDictionary Source="../../../Styles/CustomListItemStyle.xaml"/>
             </ResourceDictionary.MergedDictionaries>
             <converter:BoolToVisible x:Key="BoolToVisibilityConverter" />
+            <converter:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert"/>
             <Style x:Key="LabelSty"
                TargetType="{x:Type Label}">
                 <Setter Property="Padding"
@@ -29,9 +32,13 @@
             </Style>
 
             <DataTemplate x:Key="DataTemplate">
-                <pDFTools:PDFToolItem x:Name="data"/>
+                <pDFTools:PDFToolItem x:Name="data" Cursor="Hand"/>
             </DataTemplate>
-            
+
+            <DataTemplate x:Key="ExpendDataTemplate">
+                <pDFTools:PDFToolExpendItem x:Name="Expenddata" Cursor="Hand"/>
+            </DataTemplate>
+
             <ItemsPanelTemplate x:Key="ListItemsPanelTemplate">
                 <WrapPanel AllowDrop="True"
                        Orientation="Horizontal" />
@@ -75,23 +82,17 @@
                 Height="28"
                 Margin="0,0,0,0"
                 Content="Tools"
-                Click="BtnTools_Click"
+                Command="{Binding ShowToolCommand}"
                >
 
             </Button>
-
-            <customControl:CustomIconToggleBtn x:Name="BtnExptend"  Click="BtnExptend_Click"
-                                                        Style="{StaticResource ToggleBtnViewModeStyle}"
-                                                       >
-                <TextBlock Text="展开"/>
-            </customControl:CustomIconToggleBtn>
             <Button
                 x:Name="BtnMore"
                 Width="28"
                 Height="28"
                 Margin="12,0,0,0"
                  Background="#FFFFFF" BorderThickness="0" Content="..."
-                Click="BtnMore_Click"
+                Command="{Binding OpenMenuCommand}" CommandParameter="{Binding ElementName=BtnMore}"
                >
             </Button>
 
@@ -102,16 +103,29 @@
                 Grid.Row="1" Height="270"
                 SizeChanged="GridAllTools_SizeChanged">
 
+            <customControl:ListBoxEx x:Name="ListBoxExpendToolBars" HorizontalAlignment="Stretch"  MinWidth="540" 
+                        Grid.Row="3"
+                        AllowDrop="True"
+                        BorderThickness="0" Background="Transparent"
+                        ItemContainerStyle="{StaticResource QuickToolsListBoxItemStyle}"
+                        ItemTemplate="{StaticResource ExpendDataTemplate}"
+                        ItemsPanel="{StaticResource ListItemsPanelTemplate}"
+                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                        SelectionMode="Single" 
+                        Visibility="{Binding IsExpendTools,Converter={StaticResource BoolToVisibilityConverter}}"
+                                     />
+
             <customControl:ListBoxEx x:Name="ListBoxToolBars" HorizontalAlignment="Stretch"  MinWidth="540" 
                         Grid.Row="3"
                         AllowDrop="True"
                         BorderThickness="0" Background="Transparent"
-                        SizeChanged="ListBoxShortCuts_SizeChanged"
                         ItemContainerStyle="{StaticResource QuickToolsListBoxItemStyle}"
                         ItemTemplate="{StaticResource DataTemplate}"
                         ItemsPanel="{StaticResource ListItemsPanelTemplate}"
                         ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                        SelectionMode="Single"  />
+                        SelectionMode="Single" 
+                         Visibility="{Binding IsExpendTools,Converter={StaticResource InvertBoolToVisibleConvert}}"             
+                                     />
 
         </Grid>
 

+ 65 - 34
PDF Office/Views/HomePanel/PDFTools/QuickToolsContent.xaml.cs

@@ -2,6 +2,7 @@
 using PDF_Office.Helper;
 using PDF_Office.Model.PDFTool;
 using PDF_Office.ViewModels.HomePanel;
+using PDF_Office.ViewModels.HomePanel.PDFTools;
 using PDF_Office.Views.HomePanel.PDFTools;
 using PDFSettings;
 using System.Collections.Generic;
@@ -18,26 +19,42 @@ namespace PDF_Office.Views.HomePanel.PDFTools
     public partial class QuickToolsContent : UserControl
     {
         PDFToolsHelper PDFtools;
+        private QuickToolsContentViewModel ViewModel => DataContext as QuickToolsContentViewModel;
         public QuickToolsContent()
         {
             InitializeComponent();
             PDFtools = PDFToolsHelper.GetInstance();
             ListBoxToolBars.ItemsSource = PDFtools.QuickTools;
+            ListBoxExpendToolBars.ItemsSource = PDFtools.QuickTools;
         }
-   
 
-        private void BtnMore_Click(object sender, RoutedEventArgs e)
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
         {
+            if (ViewModel != null)
+            {
+                ViewModel.ExpendToolsHanlder -= ViewModel_ExpendToolsHanlder;
+                ViewModel.ExpendToolsHanlder += ViewModel_ExpendToolsHanlder;
+            }
+            if (ListBoxToolBars.Items != null)
+            {
+                UpdateExptendUI(ViewModel.IsExpendTools);
+                ListBoxToolBars.Items.Refresh();
+                ListBoxToolBarsWidthChanged();
+                ListBoxExpendToolBarsWidthChanged();
+            }
+           
         }
 
-        private void BtnExptend_Click(object sender, RoutedEventArgs e)
+        private void ViewModel_ExpendToolsHanlder(object sender, bool e)
         {
-            UpdateExptendUI();
+            UpdateToolBarsWidth();
+            UpdateExptendUI(e);
+
         }
 
-        private void UpdateExptendUI()
+        private void UpdateExptendUI(bool e)
         {
-            if ((bool)BtnExptend.IsChecked)
+            if (e)
             {
                 GridAllTools.Height = 270;
             }
@@ -45,31 +62,25 @@ namespace PDF_Office.Views.HomePanel.PDFTools
             {
                 GridAllTools.Height = 174;
             }
-
-            foreach (var item in PDFtools.QuickTools)
-            {
-                item.IsShowConciseContent = !(bool)BtnExptend.IsChecked;
-            }
         }
 
 
-
-        /// <summary>
-        /// 编辑工具
-        /// </summary>
-        private void BtnTools_Click(object sender, RoutedEventArgs e)
+        private void GridAllTools_SizeChanged(object sender, SizeChangedEventArgs e)
         {
-           
+            UpdateToolBarsWidth();
         }
 
-        private void GridAllTools_SizeChanged(object sender, SizeChangedEventArgs e)
+        private void UpdateToolBarsWidth()
         {
             ListBoxToolBarsWidthChanged();
+            ListBoxExpendToolBarsWidthChanged();
         }
 
-
         private void ListBoxToolBarsWidthChanged()
         {
+            if (ListBoxToolBars.Visibility == Visibility.Collapsed)
+                return;
+
             double containerWidth = ListBoxToolBars.ActualWidth - 20;
             int widthItem = (int)containerWidth / 5;
             double margin = widthItem / 3;
@@ -78,7 +89,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
             foreach (var item in ListBoxToolBars.Items)
             {
                 i++;
-               var listBoxItem = ListBoxToolBars.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
+                var listBoxItem = ListBoxToolBars.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
                 if (listBoxItem != null)
                 {
                     if (i % 4 != 0)
@@ -91,35 +102,55 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                         listBoxItem.Margin = new Thickness(0, 0, 0, 0);
                     }
                     listBoxItem.Width = widthItem;
-                } 
+                }
             }
+
+
         }
 
-        private void ListBoxShortCuts_SizeChanged(object sender, SizeChangedEventArgs e)
+        private void ListBoxExpendToolBarsWidthChanged()
         {
-           
+            if (ListBoxExpendToolBars.Visibility == Visibility.Collapsed)
+                return;
+
+            double containerWidth = ListBoxExpendToolBars.ActualWidth - 20;
+            int widthItem = (int)containerWidth / 5;
+            double margin = widthItem / 3;
+
+            int i = 0;
+            foreach (var item in ListBoxExpendToolBars.Items)
+            {
+                i++;
+                var listBoxItem = ListBoxExpendToolBars.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
+                if (listBoxItem != null)
+                {
+                    if (i % 4 != 0)
+                    {
+                        listBoxItem.Margin = new Thickness(0, 0, margin, 0);
+
+                    }
+                    else
+                    {
+                        listBoxItem.Margin = new Thickness(0, 0, 0, 0);
+                    }
+                    listBoxItem.Width = widthItem;
+                }
+            }
+
+
         }
 
         private void QuickTools_Click(object sender, System.Windows.Input.MouseButtonEventArgs e)
         {
             var toolItem = (sender as FrameworkElement).DataContext as ToolItem;
-            var veiwModel = this.DataContext as HomeGuidContentViewModel;
+            var veiwModel = this.DataContext as QuickToolsContentViewModel;
             if (veiwModel != null && toolItem != null)
             {
                 veiwModel.QuickToolsCommand.Execute(toolItem);
             }
         }
 
-        private void UserControl_Loaded(object sender, RoutedEventArgs e)
-        {
-            if(ListBoxToolBars.Items != null)
-            {
-                UpdateExptendUI();
-                ListBoxToolBars.Items.Refresh();
-                ListBoxToolBarsWidthChanged();
-            }
-           
-        }
+       
     }
 
 }

+ 26 - 19
PDF Office/Views/PropertyPanel/TextEditProperty.xaml

@@ -315,11 +315,11 @@
                     <ColumnDefinition Width="*"/>
                 </Grid.ColumnDefinitions>
 
-                <RadioButton x:Name="BtnImgAlign"  Grid.Row="0" Grid.Column="0" Tag="Align" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                <RadioButton x:Name="BtnImgAlign"  Grid.Row="0" Grid.Column="0" Tag="Align" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                                       Style="{DynamicResource GreyBgRadioBtnStyle}" >
                     <RadioButton.Content>
                         <Path Margin="5,0,0,0" Data="M2.01367 15V1H3.51367V15H2.01367ZM5 4H11V7H5V4ZM14 9H5V12H14V9Z"
-                              Stroke="{Binding ElementName=BtnImgAlign,Path=Foreground}"/>
+                              Fill="{Binding ElementName=BtnImgAlign,Path=Foreground}"/>
                     </RadioButton.Content>
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="Checked">
@@ -328,11 +328,11 @@
                     </i:Interaction.Triggers>
                 </RadioButton>
 
-                <RadioButton x:Name="BtnImgAlign2"  Grid.Row="0" Grid.Column="1" Tag="Align" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                <RadioButton x:Name="BtnImgAlign2"  Grid.Row="0" Grid.Column="1" Tag="Align" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                                       Style="{DynamicResource GreyBgRadioBtnStyle}" >
                     <RadioButton.Content>
                         <Path Margin="5,0,0,0" Data="M8.75 7L8.75 9L12 9L12 12L8.75 12L8.75 15L7.25 15L7.25 12L4 12L4 9L7.25 9L7.25 7L2 7L2 4L7.25 4L7.25 0.999999L8.75 1L8.75 4L14 4L14 7L8.75 7Z" 
-                              Stroke="{Binding ElementName=BtnImgAlign2,Path=Foreground}"/>
+                            Fill="{Binding ElementName=BtnImgAlign2,Path=Foreground}"/>
                     </RadioButton.Content>
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="Checked">
@@ -341,11 +341,11 @@
                     </i:Interaction.Triggers>
                 </RadioButton>
 
-                <RadioButton x:Name="BtnImgAlign3"  Grid.Row="0" Grid.Column="2" Tag="Align" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                <RadioButton x:Name="BtnImgAlign3"  Grid.Row="0" Grid.Column="2" Tag="Align" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                                       Style="{DynamicResource GreyBgRadioBtnStyle}" >
                     <RadioButton.Content>
                         <Path Margin="5,0,0,0" Data="M14 1L14 15L12.5 15L12.5 1L14 1ZM11 12L2 12L2 9L11 9L11 12ZM4 7L11 7L11 4L4 4L4 7Z" 
-                              Stroke="{Binding ElementName=BtnImgAlign3,Path=Foreground}"/>
+                               Fill="{Binding ElementName=BtnImgAlign3,Path=Foreground}"/>
                     </RadioButton.Content>
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="Checked">
@@ -354,11 +354,11 @@
                     </i:Interaction.Triggers>
                 </RadioButton>
 
-                <RadioButton x:Name="BtnImgAlign4"  Grid.Row="0" Grid.Column="3" Tag="Align" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                <RadioButton x:Name="BtnImgAlign4"  Grid.Row="0" Grid.Column="3" Tag="Align" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                                       Style="{DynamicResource GreyBgRadioBtnStyle}" >
                     <RadioButton.Content>
                         <Path Margin="5,0,0,0" Data="M15 12.5L1 12.5L1 14L15 14L15 12.5ZM12 9.5L4 9.5L4 6.5L12 6.5L12 9.5ZM1 2L15 2L15 3.5L1 3.5L1 2Z" 
-                              Stroke="{Binding ElementName=BtnImgAlign4,Path=Foreground}"/>
+                              Fill="{Binding ElementName=BtnImgAlign4,Path=Foreground}"/>
                     </RadioButton.Content>
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="Checked">
@@ -367,11 +367,11 @@
                     </i:Interaction.Triggers>
                 </RadioButton>
 
-                <RadioButton x:Name="BtnImgAlign5"  Grid.Row="1" Grid.Column="0" Tag="Align" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                <RadioButton x:Name="BtnImgAlign5"  Grid.Row="1" Grid.Column="0" Tag="Align" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                                       Style="{DynamicResource GreyBgRadioBtnStyle}" >
                     <RadioButton.Content>
                         <Path Margin="5,0,0,0" Data="M15 2L1 2L1 3.5L15 3.5L15 2ZM12 5L12 11L9 11L9 5L12 5ZM7 5L7 14L4 14L4 5L7 5Z"
-                              Stroke="{Binding ElementName=BtnImgAlign5,Path=Foreground}"/>
+                              Fill="{Binding ElementName=BtnImgAlign5,Path=Foreground}"/>
                     </RadioButton.Content>
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="Checked">
@@ -380,11 +380,11 @@
                     </i:Interaction.Triggers>
                 </RadioButton>
 
-                <RadioButton x:Name="BtnImgAlign6"  Grid.Row="1" Grid.Column="1" Tag="Align" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                <RadioButton x:Name="BtnImgAlign6"  Grid.Row="1" Grid.Column="1" Tag="Align" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                                       Style="{DynamicResource GreyBgRadioBtnStyle}" >
                     <RadioButton.Content>
                         <Path Margin="5,0,0,0" Data="M7 7.25L9 7.25L9 4L12 4L12 7.25L15 7.25L15 8.75L12 8.75L12 12L9 12L9 8.75L7 8.75L7 14L4 14L4 8.75L1 8.75L1 7.25L4 7.25L4 2L7 2L7 7.25Z" 
-                              Stroke="{Binding ElementName=BtnImgAlign6,Path=Foreground}"/>
+                              Fill="{Binding ElementName=BtnImgAlign6,Path=Foreground}"/>
                     </RadioButton.Content>
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="Checked">
@@ -393,10 +393,11 @@
                     </i:Interaction.Triggers>
                 </RadioButton>
 
-                <RadioButton x:Name="BtnImgAlign7"  Grid.Row="1" Grid.Column="2" Tag="Align" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                <RadioButton x:Name="BtnImgAlign7"  Grid.Row="1" Grid.Column="2" Tag="Align" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                                       Style="{DynamicResource GreyBgRadioBtnStyle}" >
                     <RadioButton.Content>
-                        <Path Margin="5,0,0,0" Data="M9 2H12V11H9V2ZM4 5H7V11H4V5ZM1 14H15V12.5H1V14Z" Stroke="{Binding ElementName=BtnImgAlign7,Path=Foreground}"/>
+                        <Path Margin="5,0,0,0" Data="M9 2H12V11H9V2ZM4 5H7V11H4V5ZM1 14H15V12.5H1V14Z" 
+                              Fill="{Binding ElementName=BtnImgAlign7,Path=Foreground}"/>
                     </RadioButton.Content>
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="Checked">
@@ -405,10 +406,12 @@
                     </i:Interaction.Triggers>
                 </RadioButton>
 
-                <RadioButton x:Name="BtnImgAlign8"  Grid.Row="1" Grid.Column="3" Tag="Align" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"     
+                <RadioButton x:Name="BtnImgAlign8"  Grid.Row="1" Grid.Column="3" Tag="Align" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"     
                              Style="{DynamicResource GreyBgRadioBtnStyle}" >
                     <RadioButton.Content>
-                        <Path Margin="5,0,0,0" Data="M2 15V1H3.5V15H2ZM6.5 4H9.5V12H6.5V4ZM12.5 1V15H14V1H12.5Z" Stroke="{Binding ElementName=BtnImgAlign8,Path=Foreground}"/>
+                        <Path Margin="5,0,0,0" Data="M2 15V1H3.5V15H2ZM6.5 4H9.5V12H6.5V4ZM12.5 1V15H14V1H12.5Z"
+                              
+                              Fill="{Binding ElementName=BtnImgAlign8,Path=Foreground}"/>
                     </RadioButton.Content>
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="Checked">
@@ -436,11 +439,15 @@
                 </Grid>
             </Border>
             <StackPanel Orientation="Horizontal" Margin="0,18,0,0" HorizontalAlignment="Center">
-                <Button Margin="0,0,20,0" Content="逆转" Width="32" Height="32" Command="{Binding AntiClockwiseCommand}"/>
-                <Button  Content="顺转" Width="32" Height="32" Command="{Binding ClockwiseCommand}"/>
+                <Button Margin="0,0,20,0" Content="逆转" Width="32" Height="32"
+                         IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"
+                        Command="{Binding AntiClockwiseCommand}"/>
+                <Button  Content="顺转" Width="32" Height="32" 
+                          IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"
+                         Command="{Binding ClockwiseCommand}"/>
             </StackPanel>
 
-            <CompositeControl:SlidComboControl/>
+            <CompositeControl:SlidComboControl  IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"/>
             <StackPanel Width="228" HorizontalAlignment="Center"  Margin="0,20,0,0">
                 <Grid x:Name="GridCrop">
                     <cus:CustomIconToggleBtn x:Name="BtnCrop" Tag="Crop" BorderBrush="#DFE1E5" BorderThickness="1" Style="{StaticResource ToggleBtnViewModeStyle}"