Browse Source

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

ZhouJieSheng 2 years ago
parent
commit
bd2c70ba69
19 changed files with 491 additions and 201 deletions
  1. 9 2
      PDF Office/CustomControl/CompositeControl/ColorContent.xaml.cs
  2. 58 0
      PDF Office/Helper/PopControlHelper.cs
  3. 1 1
      PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs
  4. 1 1
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterDialogModel.cs
  5. 18 0
      PDF Office/Styles/ContextMenuStyle.xaml
  6. 22 2
      PDF Office/ViewModels/Form/FormsToolContentViewModel.cs
  7. 15 0
      PDF Office/ViewModels/PropertyPanel/FontSetModeVM.cs
  8. 138 84
      PDF Office/ViewModels/PropertyPanel/PDFEdit/ImageEditPropertyViewModel.cs
  9. 11 2
      PDF Office/ViewModels/PropertyPanel/PDFEdit/ImageTextEditPropertyViewModel.cs
  10. 44 43
      PDF Office/ViewModels/PropertyPanel/PDFEdit/TextEditPropertyViewModel.cs
  11. 136 39
      PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs
  12. 2 2
      PDF Office/Views/Dialog/ConverterDialogs/ConverterImgDialog.xaml
  13. 1 1
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterImg.xaml
  14. 6 6
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterImg.xaml.cs
  15. 5 11
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageSetPasswordDialog.xaml
  16. 1 1
      PDF Office/Views/Dialog/ToolsDialogs/SaftyDialogs/SetPasswordDialog.xaml
  17. 13 2
      PDF Office/Views/Form/FormsToolContent.xaml
  18. 8 2
      PDF Office/Views/PropertyPanel/PDFEdit/TextEditProperty.xaml
  19. 2 2
      PDF Office/Views/Tools/TextEditToolContent.xaml

+ 9 - 2
PDF Office/CustomControl/CompositeControl/ColorContent.xaml.cs

@@ -72,6 +72,7 @@ namespace PDF_Office.CustomControl.CompositeControl
     {
         private ObservableCollection<ColorItem> colors = new ObservableCollection<ColorItem>();
         public event EventHandler<Color> SelectedColorHandler;
+        public event RoutedEventHandler SelectedColorInvoke;
         private ColorItem ChangedColorItem;
 
         /// <summary>
@@ -114,6 +115,7 @@ namespace PDF_Office.CustomControl.CompositeControl
             SelectedColorHandler?.Invoke(this, e.Value);
             //ElcustomColor.Fill = new SolidColorBrush(e.Value);
             SelectedColor = e.Value;
+            SelectedColorInvoke?.Invoke(e.Value, null);
         }
 
         private void ListColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -122,6 +124,7 @@ namespace PDF_Office.CustomControl.CompositeControl
             {
                 var item = ListColor.SelectedItem as ColorItem;
                 SelectedColorHandler?.Invoke(this, (item.Color as SolidColorBrush).Color);
+                SelectedColorInvoke?.Invoke((item.Color as SolidColorBrush).Color, null);
             }
             
         }
@@ -130,7 +133,7 @@ namespace PDF_Office.CustomControl.CompositeControl
         {
             IsExistForContainer((ElcustomColor.Fill as SolidColorBrush).Color);
             SelectedColorHandler?.Invoke(this, (ElcustomColor.Fill as SolidColorBrush).Color);
-            
+            SelectedColorInvoke?.Invoke((ElcustomColor.Fill as SolidColorBrush).Color, null);
         }
 
         private void PnlColor_SelectedColorChanged(object sender, Color? e)
@@ -165,7 +168,11 @@ namespace PDF_Office.CustomControl.CompositeControl
             {
                 colorIem.RestoreColor();
                 if(colorIem == ListColor.SelectedItem as ColorItem)
-                SelectedColorHandler?.Invoke(this, (colorIem.Color as SolidColorBrush).Color);
+                {
+                    SelectedColorHandler?.Invoke(this, (colorIem.Color as SolidColorBrush).Color);
+                    SelectedColorInvoke?.Invoke((colorIem.Color as SolidColorBrush).Color, null);
+                }
+                
             }
                
         }

+ 58 - 0
PDF Office/Helper/PopControlHelper.cs

@@ -12,6 +12,7 @@ using static PDF_Office.CustomControl.ColorDropBox;
 
 namespace PDF_Office.Helper
 {
+    #region 悬浮窗口
     public class AdornerPresenter : Adorner
     {
         private VisualCollection VisualChildren;
@@ -212,4 +213,61 @@ namespace PDF_Office.Helper
         }
 
     }
+
+    #endregion
+
+    #region 自定义菜单
+    //自定义菜单:事件绑定、内容等
+
+    public class CustomPopMenu
+    {
+        public ContextMenu PopMenu { get; private set; }
+        public CustomPopMenu(ContextMenu popMenu)
+        {
+            PopMenu = popMenu;
+        }
+
+        private MenuItem ContainterOfIndex(int index)
+        {
+            if (PopMenu == null || PopMenu.Items.Count < index || index < 0)
+                return null;
+
+            MenuItem menuItem = PopMenu.Items[index] as MenuItem;
+            return menuItem;
+        }
+
+        public void SetVisibilityProperty(int index, bool isVisual)
+        {
+            var menuItem = ContainterOfIndex(index);
+            if (menuItem != null)
+            {
+                menuItem.Visibility = (isVisual?Visibility.Visible:Visibility.Collapsed);
+            }
+        }
+        public void SetHeaderProperty(int index, string header)
+        {
+            var menuItem = ContainterOfIndex(index);
+
+            if (menuItem != null)
+            {
+                menuItem.Header = header;
+            }
+        }
+
+        public void SetMenuBinding(int index, object commandTarget, ICommand command)
+        {
+            var menuItem = ContainterOfIndex(index);
+
+            if (menuItem != null)
+            {
+                menuItem.CommandTarget = (UIElement)commandTarget;
+                menuItem.Command = command;
+            }
+
+        }
+
+    }
+
+    #endregion
+
 }

+ 1 - 1
PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs

@@ -20,7 +20,7 @@ namespace PDF_Office.Model.Dialog.ConverterDialogs
         public WorksheetOptions WorksheetOpts = WorksheetOptions.ForEachPage;
         public PageAndNavigationPaneOptions PageAndNavigationPaneOpts = PageAndNavigationPaneOptions.SinglePageNavigationByBookmarks;
         public ImgType ImageType = ImgType.PNG;
-        public uint ImageDpi = 50;
+        public uint ImageDpi = 150;
         public bool IsMergeCsv = false;
     }
 

+ 1 - 1
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterDialogModel.cs

@@ -20,7 +20,7 @@ namespace PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.H
         public WorksheetOptions WorksheetOpts = WorksheetOptions.ForEachPage;
         public PageAndNavigationPaneOptions PageAndNavigationPaneOpts = PageAndNavigationPaneOptions.SinglePageNavigationByBookmarks;
         public ImgType ImageType = ImgType.PNG;
-        public uint ImageDpi = 200;
+        public uint ImageDpi = 150;
         public bool IsMergeCsv = false;
     }
 

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

@@ -20,6 +20,24 @@
             </MenuItem.Icon>
         </MenuItem>
     </ContextMenu>
+    
+    <ContextMenu x:Key="CustomFontStyleFlyoutMenu" 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="ChangeStyleMenuItem"
+                    Header="用所选部分重新定义"
+                    IsEnabled="True" />
+        <MenuItem
+                    Name="BackStyleMenuItem"
+                    Header="恢复默认预设样式"
+                    IsEnabled="True" />
+    </ContextMenu>
+
 
     <ContextMenu x:Key="SelectAnnotContextMenu" FontSize="14">
         <ContextMenu.ItemContainerStyle>

+ 22 - 2
PDF Office/ViewModels/Form/FormsToolContentViewModel.cs

@@ -39,6 +39,12 @@ namespace PDF_Office.ViewModels.Form
         private bool _isLayoutAlign = false;
         public bool IsLayoutAlign { get { return _isLayoutAlign; } set { SetProperty(ref _isLayoutAlign, value); } }
 
+        private bool _isMoreCheckedBtn = false;
+        public bool IsMoreCheckedBtn { get { return _isMoreCheckedBtn; } set { SetProperty(ref _isMoreCheckedBtn, value); } }
+
+        private bool _isAlignmentCheckedBtn = false;
+        public bool IsAlignmentCheckedBtn { get { return _isAlignmentCheckedBtn; } set { SetProperty(ref _isAlignmentCheckedBtn, value); } }
+
         #endregion
 
         #region 变量
@@ -62,10 +68,10 @@ namespace PDF_Office.ViewModels.Form
         public DelegateCommand CancleCheckedCommand { get; set; }
         public DelegateCommand<string> ClickCommand { get; set; }
         public DelegateCommand<object> AlignmentCheckedCommand { get; set; }
-        
+        public DelegateCommand AlignmentClosedMenuCommand { get; set; }
+        public DelegateCommand ClosedMenuCommand { get; set; }
 
         public event EventHandler<string> UncheckedToolsBtnEvent;
-        
         #endregion
 
         #region 初始化
@@ -78,6 +84,8 @@ namespace PDF_Office.ViewModels.Form
             CancleCheckedCommand = new DelegateCommand(CancleChecked);
             ClickCommand = new DelegateCommand<string>(ClickEvent);
             AlignmentCheckedCommand = new DelegateCommand<object>(AlignmentChecked);
+            ClosedMenuCommand = new DelegateCommand(ClosedMenu);
+            AlignmentClosedMenuCommand = new DelegateCommand(AlignmentClosedMenu);
             InitBtnToProperty();
         }
 
@@ -162,6 +170,18 @@ namespace PDF_Office.ViewModels.Form
             }
         }
 
+        private void ClosedMenu()
+        {
+            IsMoreCheckedBtn = false;
+        }
+
+        private void AlignmentClosedMenu()
+        {
+            IsAlignmentCheckedBtn = false;
+        }
+
+        
+
         private void AddToPropertyPanel(string type, WidgetArgs widget = null, UpdateAttributeHelper e = null)
         {
             if (btnToProperty.ContainsKey(type))

+ 15 - 0
PDF Office/ViewModels/PropertyPanel/FontSetModeVM.cs

@@ -202,9 +202,24 @@ namespace PDF_Office.ViewModels.PropertyPanel
             {
                 SetProperty(ref selectColor, value);
                 if (IsCanSave)
+                {
                     ChangedValue?.Invoke((selectColor as SolidColorBrush).Color, FontSetModeType.FontColor);
+                    CurrentColor = (selectColor as SolidColorBrush).Color;
+                }
+                    
+            }
+        }
+
+        private Color currentColor = Colors.Black;
+        public Color CurrentColor
+        {
+            get { return currentColor; }
+            set
+            {
+                SetProperty(ref currentColor, value);
             }
         }
+
         private bool IsEqualComboData(ComboDataItem oldValue, ComboDataItem newValue)
         {
             if (newValue == null  || IsCanSave == false)

+ 138 - 84
PDF Office/ViewModels/PropertyPanel/PDFEdit/ImageEditPropertyViewModel.cs

@@ -1,6 +1,7 @@
 using ComPDFKitViewer;
 using ComPDFKitViewer.PdfViewer;
 using Microsoft.Win32;
+using PDF_Office.Helper;
 using PDF_Office.Model;
 using Prism.Commands;
 using Prism.Mvvm;
@@ -18,46 +19,84 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
 {
     public class ImageEditPropertyViewModel : PDFEditVM, INavigationAware
     {
+        #region 变量
+        //防止自动保存属性值
+        private bool isCanSave = false;
+        public event EventHandler ClearCheckedAglin;
+        #endregion
+
+        #region 属性
 
+        #region 是否为多选内容
+        private bool _isMultiSelectImage = false;
+        public bool IsMultiSelectImage { get { return _isMultiSelectImage; } set { SetProperty(ref _isMultiSelectImage, value); } }
+        #endregion
 
-        #region 图像属性
-        private double _transpent ;
-        public double Transpent { get { return _transpent; } set { SetProperty(ref _transpent, value);
-                if (TextEditEvent != null)
+        #region 不透明度
+        private double _transpent;
+        public double Transpent
+        {
+            get { return _transpent; }
+            set
+            {
+                SetProperty(ref _transpent, value);
+                if (TextEditEvent != null && isCanSave)
                 {
+                    if (IsMultiSelectImage)
+                    {
+                        foreach (var item in TextEditEventList)
+                        {
+                            item.Transparent = (int)(_transpent * 2.55);
+                            item.UpdatePDFEditByEventArgs();
+                        }
+                    }
+                    else
+                    {
+                        TextEditEvent.Transparent = (int)(_transpent * 2.55);
+                        TextEditEvent.UpdatePDFEditByEventArgs();
+                    }
 
-                    TextEditEvent.Transparent = (int)(_transpent*2.55);
-                    TextEditEvent.UpdatePDFEditByEventArgs();
                 }
-            } }
+            }
+        }
+        #endregion
+
+        #region 是否为图片裁剪状态
         private bool _isCrop = false;
-        public bool IsCrop{get { return _isCrop; } set{SetProperty(ref _isCrop, value); }}
+        public bool IsCrop { get { return _isCrop; } set { SetProperty(ref _isCrop, value); } }
+        #endregion
+
+        #region 当前显示图像
         //选中的图像
         private System.Windows.Media.Imaging.BitmapSource _currentImg;
-        public System.Windows.Media.Imaging.BitmapSource CurrentImg {get { return _currentImg; } set{   SetProperty(ref _currentImg, value); }}
+        public System.Windows.Media.Imaging.BitmapSource CurrentImg { get { return _currentImg; } set { SetProperty(ref _currentImg, value); } }
+
+        #endregion
 
-        private bool _isMultiSelectImage = false;
-        public bool IsMultiSelectImage { get { return _isMultiSelectImage; } set { SetProperty(ref _isMultiSelectImage, value); }}
         #endregion
 
-        #region 图像Command
+        #region Command
+        //替换
         public DelegateCommand ReplaceImgCommand { get; set; }
+        //导出
         public DelegateCommand ExportImgCommand { get; set; }
+        //裁剪
         public DelegateCommand CropImgCommand { get; set; }
+        //对齐
         public DelegateCommand<object> ImgAlignCheckedCommand { get; set; }
 
-
-        /// <summary>
-        /// 逆时针旋转
-        /// </summary>
+        //逆时针旋转
         public DelegateCommand AntiClockwiseCommand { get; set; }
-        /// <summary>
-        /// 顺时针旋转
-        /// </summary>
+
+        //顺时针旋转
         public DelegateCommand ClockwiseCommand { get; set; }
+        //裁剪状态
         public DelegateCommand CropModeCommand { get; set; }
+        //取消裁剪状态
         public DelegateCommand CancelCropCommand { get; set; }
+        //添加文本
         public DelegateCommand AddTextCommand { get; set; }
+        //添加图片
         public DelegateCommand AddImgCommand { get; set; }
         #endregion
 
@@ -82,13 +121,14 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
             CropModeCommand = new DelegateCommand(CropMode);
             CancelCropCommand = new DelegateCommand(CancelCropImg);
         }
+
+        #region Command实现
+
         private void AddText()
         {
             PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditText);
         }
 
-        #region 图像处理
-
         private void CancelCropImg()
         {
             if (TextEditEvent != null)
@@ -135,8 +175,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
                     }
                 }
 
-
-
+                var strFilePath = folder.SelectedPath + "\\0.png";
+                CommonHelper.ShowFileBrowser(strFilePath);
             }
         }
 
@@ -183,16 +223,30 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
 
         private void Clockwise()
         {
-            TextEditEvent.Rotate = TextEditEvent.Rotate + 90;
-            TextEditEvent.UpdatePDFEditByEventArgs();
-            GetImagePreView();
+            ImgRoateAngle(90);
         }
 
         private void AntiClockwise()
         {
-            TextEditEvent.Rotate = TextEditEvent.Rotate - 90;
-            TextEditEvent?.UpdatePDFEditByEventArgs();
-            GetImagePreView();
+            ImgRoateAngle(-90);
+        }
+
+        private void ImgRoateAngle(int angle)
+        {
+            if (IsMultiSelectImage)
+            {
+                foreach (var item in TextEditEventList)
+                {
+                    item.Rotate = item.Rotate + angle;
+                    item.UpdatePDFEditByEventArgs();
+                }
+            }
+            else
+            {
+                TextEditEvent.Rotate = TextEditEvent.Rotate + angle;
+                TextEditEvent.UpdatePDFEditByEventArgs();
+                GetImagePreView();
+            }
         }
 
         #endregion
@@ -256,37 +310,41 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
             {
                 PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
                 PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
-                if (TextEditEventList != null && TextEditEventList.Count > 0)
+                LoadedPDFEdit();
+                isCanSave = true;
+            }
+        }
+
+        private void LoadedPDFEdit()
+        {
+            if (TextEditEventList != null && TextEditEventList.Count > 0)
+            {
+                TextEditEvent = TextEditEventList[0];
+                if (TextEditEventList.Count > 1)
                 {
-                    TextEditEvent = TextEditEventList[0];
-                    if(TextEditEventList.Count >1)
-                    {
-                       IsMultiSelectImage = true;
-                    }
-                    else
-                    {
-                        GetImagePreView();
-                    }
-                    if (TextEditEventList.Count == 2)
-                    {
-                        IsLayoutAlign = true;
-                        IsLayoutAvgAlign = false;
-                    }
-                    else if (TextEditEventList.Count > 2)
-                    {
-                        IsLayoutAlign = true;
-                        IsLayoutAvgAlign = true;
-                    }
-                    else
-                    {
-                        IsLayoutAlign = false;
-                        IsLayoutAvgAlign = false;
-                    }
-                    GetPDFEdit();
+                    IsMultiSelectImage = true;
+                }
+                else
+                {
+                    GetImagePreView();
+                }
+                if (TextEditEventList.Count == 2)
+                {
+                    IsLayoutAlign = true;
+                    IsLayoutAvgAlign = false;
+                }
+                else if (TextEditEventList.Count > 2)
+                {
+                    IsLayoutAlign = true;
+                    IsLayoutAvgAlign = true;
+                }
+                else
+                {
+                    IsLayoutAlign = false;
+                    IsLayoutAvgAlign = false;
                 }
+                GetPDFEdit();
             }
-
-          
         }
         private void GetPDFEdit()
         {
@@ -300,15 +358,13 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
         private ContextMenu EmptyStateMenu(object sender)
         {
             var popMenu = App.Current.FindResource("NoneMenu") as ContextMenu;
-            if (popMenu != null && popMenu.Items.Count == 3)
-            {
-                //粘贴
-                SetPopMenuItem(popMenu.Items[0] as MenuItem, sender, ApplicationCommands.Paste);
-                //添加文本
-                SetPopMenuItem(popMenu.Items[1] as MenuItem, sender, AddTextCommand);
-                //添加图像
-                SetPopMenuItem(popMenu.Items[2] as MenuItem, sender, AddImgCommand);
-            }
+            CustomPopMenu customMenu = new CustomPopMenu(popMenu);
+            //粘贴
+            customMenu.SetMenuBinding(0, sender, ApplicationCommands.Paste);
+            //添加文本
+            customMenu.SetMenuBinding(1, sender, AddTextCommand);
+            //添加图像
+            customMenu.SetMenuBinding(2, sender, AddImgCommand);
 
             return popMenu;
         }
@@ -316,23 +372,21 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
         private ContextMenu SelectImgPDFEdit(object sender)
         {
             var popMenu = App.Current.FindResource("SelectImgMenu") as ContextMenu;
-            if (popMenu != null && popMenu.Items.Count == 7)
-            {
-                //复制
-                SetPopMenuItem(popMenu.Items[0] as MenuItem, sender, ApplicationCommands.Copy);
-                //剪切
-                SetPopMenuItem(popMenu.Items[1] as MenuItem, sender, ApplicationCommands.Cut);
-                //粘贴
-                SetPopMenuItem(popMenu.Items[2] as MenuItem, sender, ApplicationCommands.Paste);
-                //删除
-                SetPopMenuItem(popMenu.Items[3] as MenuItem, sender, ApplicationCommands.Delete);
-                //裁剪
-                SetPopMenuItem(popMenu.Items[4] as MenuItem, sender, CropModeCommand);
-                //替换
-                SetPopMenuItem(popMenu.Items[5] as MenuItem, sender, ReplaceImgCommand);
-                //导出
-                SetPopMenuItem(popMenu.Items[6] as MenuItem, sender, ExportImgCommand);
-            }
+            CustomPopMenu customMenu = new CustomPopMenu(popMenu);
+            //复制
+            customMenu.SetMenuBinding(0, sender, ApplicationCommands.Copy);
+            //剪切
+            customMenu.SetMenuBinding(1, sender, ApplicationCommands.Cut);
+            //粘贴
+            customMenu.SetMenuBinding(2, sender, ApplicationCommands.Paste);
+            //删除
+            customMenu.SetMenuBinding(3, sender, ApplicationCommands.Delete);
+            //裁剪
+            customMenu.SetMenuBinding(4, sender, CropModeCommand);
+            //替换
+            customMenu.SetMenuBinding(5, sender, ReplaceImgCommand);
+            //导出
+            customMenu.SetMenuBinding(6, sender, ExportImgCommand);
             return popMenu;
         }
 
@@ -403,13 +457,13 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
         }
         #region 全局
 
-        public event EventHandler ClearCheckedAglin;
         #endregion
         public bool IsNavigationTarget(NavigationContext navigationContext) { return true; }
 
 
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
+            isCanSave = false;
             IsMultiSelectImage = false;
             TextEditEvent = null;
             ClearCheckedAglin?.Invoke(null, null);

+ 11 - 2
PDF Office/ViewModels/PropertyPanel/PDFEdit/ImageTextEditPropertyViewModel.cs

@@ -14,13 +14,22 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
 {
     public class ImageTextEditPropertyViewModel : PDFEditVM, INavigationAware
     {
+        #region 变量
+        protected List<ComPDFKitViewer.PDFEditEvent> TextEditEventList;
+        public event EventHandler ClearCheckedAglin;
+        #endregion
+
+        #region Command
         public DelegateCommand<object> ImgAlignCheckedCommand { get; set; }
+        #endregion
+
         public ImageTextEditPropertyViewModel()
         {
             ImgAlignCheckedCommand = new DelegateCommand<object>(ImgAlignChecked);
 
         }
 
+        #region Command实现
         private void ImgAlignChecked(object obj)
         {
             if (obj != null)
@@ -55,8 +64,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
 
             }
         }
+        #endregion
 
-        protected List<ComPDFKitViewer.PDFEditEvent> TextEditEventList;
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
@@ -90,7 +99,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
 
         public bool IsNavigationTarget(NavigationContext navigationContext) { return true; }
 
-        public event EventHandler ClearCheckedAglin;
+        
         public void OnNavigatedFrom(NavigationContext navigationContext) 
         { 
            

+ 44 - 43
PDF Office/ViewModels/PropertyPanel/PDFEdit/TextEditPropertyViewModel.cs

@@ -2,6 +2,7 @@
 using ComPDFKitViewer.PdfViewer;
 using Microsoft.Win32;
 using PDF_Office.CustomControl.CompositeControl;
+using PDF_Office.Helper;
 using PDF_Office.Model;
 using PDF_Office.Model.PropertyPanel.AnnotPanel;
 using Prism.Commands;
@@ -68,7 +69,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
         private void InitCommand()
         {
             AddTextCommand = new DelegateCommand(AddText);
-
+            AddImgCommand = new DelegateCommand(AddImg);
             SelectedColorCommand = new DelegateCommand<object>(SelectedColor);
             SelectedFontStyleCommand = new DelegateCommand<object>(SelectedFontStyle);
             FontSizeChangedCommand = new DelegateCommand<object>(FontSizeChanged);
@@ -89,6 +90,11 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
             PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditText);
         }
 
+        private void AddImg()
+        {
+            PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
+        }
+        
         private void EditTextMode()
         {
 
@@ -187,7 +193,6 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
                 var colorValue = (Color)obj;
                 if (colorValue != null)
                 {
-
                     SelectColor = new SolidColorBrush(colorValue);
                 }
             }
@@ -277,15 +282,13 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
         private ContextMenu EmptyStateMenu(object sender)
         {
             var popMenu = App.Current.FindResource("NoneMenu") as ContextMenu;
-            if (popMenu != null && popMenu.Items.Count == 3)
-            {
-                //粘贴
-                SetPopMenuItem(popMenu.Items[0] as MenuItem, sender, ApplicationCommands.Paste);
-                //添加文本
-                SetPopMenuItem(popMenu.Items[1] as MenuItem, sender, AddTextCommand);
-                //添加图像
-                SetPopMenuItem(popMenu.Items[2] as MenuItem, sender, AddImgCommand);
-            }
+            CustomPopMenu customMenu = new CustomPopMenu(popMenu);
+            //粘贴
+            customMenu.SetMenuBinding(0, sender, ApplicationCommands.Paste);
+            //添加文本
+            customMenu.SetMenuBinding(1, sender, AddTextCommand);
+            //添加图像
+            customMenu.SetMenuBinding(2, sender, AddImgCommand);
 
             return popMenu;
         }
@@ -294,43 +297,40 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
         private ContextMenu SelectTextBorder(object sender)
         {
             var popMenu = App.Current.FindResource("SelectTextMenu") as ContextMenu;
-            if (popMenu != null && popMenu.Items.Count == 5)
-            {
-                //编辑
-                SetPopMenuItem(popMenu.Items[0] as MenuItem, sender, EditTextModeCommand);
-                //复制
-                SetPopMenuItem(popMenu.Items[1] as MenuItem, sender, ApplicationCommands.Copy);
-                //剪切
-                SetPopMenuItem(popMenu.Items[2] as MenuItem, sender, ApplicationCommands.Cut);
-                //粘贴
-                SetPopMenuItem(popMenu.Items[3] as MenuItem, sender, ApplicationCommands.Paste);
-                //删除
-                SetPopMenuItem(popMenu.Items[4] as MenuItem, sender, ApplicationCommands.Delete);
+            CustomPopMenu customMenu = new CustomPopMenu(popMenu);
+            //编辑
+            customMenu.SetMenuBinding(0, sender, EditTextModeCommand);
+            //复制
+            customMenu.SetMenuBinding(1, sender, ApplicationCommands.Copy);
+            //剪切
+            customMenu.SetMenuBinding(2, sender, ApplicationCommands.Cut);
+            //粘贴
+            customMenu.SetMenuBinding(3, sender, ApplicationCommands.Paste);
+            //删除
+            customMenu.SetMenuBinding(4, sender, ApplicationCommands.Delete);
+         
+            customMenu.SetVisibilityProperty(6, false);
 
-            }
             return popMenu;
         }
-
+       
         //选中文字内容
         private ContextMenu SelectTextContent(object sender)
         {
             var popMenu = App.Current.FindResource("SelectContentMenu") as ContextMenu;
-            if (popMenu != null && popMenu.Items.Count == 6)
-            {
-                //复制
-                SetPopMenuItem(popMenu.Items[0] as MenuItem, sender, ApplicationCommands.Copy);
-                //剪切
-                SetPopMenuItem(popMenu.Items[1] as MenuItem, sender, ApplicationCommands.Cut);
-                //粘贴
-                SetPopMenuItem(popMenu.Items[2] as MenuItem, sender, ApplicationCommands.Paste);
-                //粘贴并匹配样式
-                SetPopMenuItem(popMenu.Items[3] as MenuItem, sender, ApplicationCommands.Paste);
-                //删除
-                SetPopMenuItem(popMenu.Items[4] as MenuItem, sender, ApplicationCommands.Delete);
-                ////全部选定
-                SetPopMenuItem(popMenu.Items[5] as MenuItem, sender, ApplicationCommands.SelectAll);
-
-            }
+            CustomPopMenu customMenu = new CustomPopMenu(popMenu);
+            //复制
+            customMenu.SetMenuBinding(0, sender, ApplicationCommands.Copy);
+            //剪切
+            customMenu.SetMenuBinding(1, sender, ApplicationCommands.Cut);
+            //粘贴
+            customMenu.SetMenuBinding(2, sender, ApplicationCommands.Paste);
+            //粘贴并匹配样式
+            customMenu.SetVisibilityProperty(3, false);
+            //删除
+            customMenu.SetMenuBinding(4, sender, ApplicationCommands.Delete);
+            //全部选定
+            customMenu.SetMenuBinding(5, sender, ApplicationCommands.SelectAll);
 
             return popMenu;
         }
@@ -497,7 +497,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
 
                             if(isok)
                             {
-                                TextEditEvent.FontColor = eventColor;
+                                TextEditEvent.FontColor = setColor;
                                 TextEditEvent.UpdatePDFEditByEventArgs();
                             }
                         }
@@ -521,7 +521,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
                
                 SelectedFontWeights_Style(TextEditEvent.FontStyle, TextEditEvent.FontWeight);
                 TextAlign = TextEditEvent.TextAlign;
-                SelectColor = new SolidColorBrush(TextEditEvent.FontColor);
+
+
             }
         }
 

+ 136 - 39
PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs

@@ -15,23 +15,57 @@ using PDF_Office.Model;
 using Microsoft.Win32;
 using PDF_Office.CustomControl;
 using ComPDFKitViewer;
+using System.Windows.Input;
+using PDF_Office.Helper;
 
 namespace PDF_Office.ViewModels.Tools
 {
     public class TextEditToolContentViewModel: BindableBase, INavigationAware
     {
+        #region 变量
+        public ViewContentViewModel viewContentViewModel;
+        private CPDFViewer PDFViewer;
+        private IRegionManager regions;
+        private Dictionary<string, string> btnToProperty = new Dictionary<string, string>();
+        #endregion
+
+        #region 属性
+        private bool _isTextEdit = false;
+        public bool IsTextEdit
+        {
+            get { return _isTextEdit; }
+            set { SetProperty(ref _isTextEdit, value); }
+        }
+        private bool _isImgEdit = false;
+        public bool IsImgEdit
+        {
+            get { return _isImgEdit; }
+            set { SetProperty(ref _isImgEdit, value); }
+        }
+        #endregion
+
         #region Command
+        // 添加文本、图像
         public DelegateCommand<object> AddContentCommand { get; set; }
-
+        public DelegateCommand AddTextCommand { get; set; }
+        public DelegateCommand AddImgCommand { get; set; }
         #endregion
-        private IRegionManager regions;
-        private Dictionary<string, string> btnToProperty = new Dictionary<string, string>();
+
+        #region 初始化
         public TextEditToolContentViewModel(IRegionManager regionManager)
         {
             regions = regionManager;
             InitCommand();
             InitBtnToProperty();
         }
+        private void InitCommand()
+        {
+            AddContentCommand = new DelegateCommand<object>(AddContent);
+            AddTextCommand = new DelegateCommand(AddText);
+            AddImgCommand = new DelegateCommand(AddImg);
+
+        }
+
         private void InitBtnToProperty()
         {
             btnToProperty.Add("Text", "TextEditProperty");
@@ -40,74 +74,77 @@ namespace PDF_Office.ViewModels.Tools
             btnToProperty.Add("PropertyPanelContent", "PropertyPanelContent");
         }
 
-        private void AddToPropertyPanel(string type,  List<PDFEditEvent> e)
-        {
-            if (btnToProperty.ContainsKey(type))
-            {
-                NavigationParameters parameters = new NavigationParameters();
-                parameters.Add(ParameterNames.PDFViewer, PDFViewer);
-                parameters.Add(ParameterNames.AnnotEvent, e);
-                System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
-                {
-                    regions.RequestNavigate(RegionNames.PropertyRegionName, btnToProperty[type], parameters);
-                }));
-
-                ShowPropertyPanel(true);
-            }
-        }
-        private void ShowPropertyPanel(bool show = true)
-        {
-            viewContentViewModel.IsPropertyOpen = show;
-        }
-
-        private void InitCommand()
-        {
-            AddContentCommand = new DelegateCommand<object>(AddContent);
-        }
-
+        #endregion
         public void AddContent(object obj)
         {
             if (PDFViewer == null || obj == null || obj as CustomIconToggleBtn == null) return;
 
             var btn = obj as CustomIconToggleBtn;
+            EnterEditMode((bool)btn.IsChecked, btn.Tag.ToString());
+        }
 
-            if(btn.IsChecked == true)
+        private void EnterEditMode(bool isCheckMode,string modeType)
+        {
+            if (isCheckMode)
             {
-                if (btn.Tag.ToString() == "Text")
+                if (modeType == "Text")
                 {
+                    IsImgEdit = false;
+                    IsTextEdit = true;
                     PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditText);
                 }
                 else
                 {
+                    IsImgEdit = true;
+                    IsTextEdit = false;
                     PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
                 }
             }
             else
             {
+                IsImgEdit = false;
+                IsTextEdit = false;
                 PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.None);
                 PDFViewer.SetMouseMode(MouseModes.PDFEdit);
             }
+        }
 
+        #region Command功能
 
+        private void AddText()
+        {
+            EnterEditMode(true, "Text");
         }
-        public ViewContentViewModel viewContentViewModel;
-        private CPDFViewer PDFViewer;
-        public void OnNavigatedTo(NavigationContext navigationContext)
+
+        private void AddImg()
         {
-            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
-            navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
+            EnterEditMode(true, "Image");
+        }
 
-            if (PDFViewer != null)
+        #endregion
+        private void AddToPropertyPanel(string type,  List<PDFEditEvent> e)
+        {
+            if (btnToProperty.ContainsKey(type))
             {
-                PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
-                PDFViewer.PDFEditActiveHandler += PDFViewer_PDFEditActiveHandler;
+                NavigationParameters parameters = new NavigationParameters();
+                parameters.Add(ParameterNames.PDFViewer, PDFViewer);
+                parameters.Add(ParameterNames.AnnotEvent, e);
+                System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+                {
+                    regions.RequestNavigate(RegionNames.PropertyRegionName, btnToProperty[type], parameters);
+                }));
 
+                ShowPropertyPanel(true);
             }
         }
+        private void ShowPropertyPanel(bool show = true)
+        {
+            viewContentViewModel.IsPropertyOpen = show;
+        }
 
         private void PDFViewer_PDFEditActiveHandler(object sender, List<PDFEditEvent> e)
         {
-  
+
             if (e != null && e.Count > 0)
             {
                 bool isText = false;
@@ -148,6 +185,63 @@ namespace PDF_Office.ViewModels.Tools
 
         }
 
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
+
+            if (PDFViewer != null)
+            {
+                PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
+                PDFViewer.PDFEditActiveHandler += PDFViewer_PDFEditActiveHandler;
+
+                PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
+                PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
+            }
+        }
+
+        private void PDFViewer_PDFEditCommandHandler(object sender, PDFEditCommand e)
+        {
+            if (e == null)
+                return;
+
+            switch (e.CommandType)
+            {
+                case CommandType.Context:
+
+                    if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.None)//点击空白区域
+                    {
+                        e.PopupMenu = EmptyStateMenu(sender);
+
+                    }
+                    break;
+                default:
+                    e.DoCommand();
+                    break;
+
+            }
+            if (e.PopupMenu != null)
+            {
+                e.Handle = true;
+            }
+        }
+
+        //点击空白处时
+        private ContextMenu EmptyStateMenu(object sender)
+        {
+            var popMenu = App.Current.FindResource("NoneMenu") as ContextMenu;
+            CustomPopMenu customMenu = new CustomPopMenu(popMenu);
+
+            //粘贴
+            customMenu.SetMenuBinding(0, sender, ApplicationCommands.Paste);
+            //添加文本
+            customMenu.SetMenuBinding(1, sender, AddTextCommand);
+            //添加图像
+            customMenu.SetMenuBinding(2, sender, AddImgCommand);
+
+            return popMenu;
+        }
+
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
             return true;
@@ -156,7 +250,10 @@ namespace PDF_Office.ViewModels.Tools
       
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
+            IsImgEdit = false;
+            IsTextEdit = false;
             PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
+            PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
             ShowPropertyPanel(false);
         }
 

+ 2 - 2
PDF Office/Views/Dialog/ConverterDialogs/ConverterImgDialog.xaml

@@ -45,7 +45,7 @@
                                 ItemsSource="{Binding ImageTypeFamily}"
                                 SelectedIndex="{Binding ImageTypeSelectedIndex, Mode=TwoWay}"
                                 />
-                            <ComboBox
+                            <!--<ComboBox
                                 Name="ImageDPIComboBox"
                                 Width="228"
                                 Height="32"
@@ -53,7 +53,7 @@
                                 HorizontalAlignment="Left"
                                 ItemsSource="{Binding ImageDPIFamily}"
                                 SelectedIndex="{Binding ImageDPISelectedIndex, Mode=TwoWay}"
-                                />
+                                />-->
                         </StackPanel>
                         <StackPanel Margin="0,16,0,0">
                             <TextBlock

+ 1 - 1
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterImg.xaml

@@ -7,7 +7,7 @@
         <StackPanel Width="245">
             <TextBlock Text="文件类型" Height="20" Width="48" HorizontalAlignment="Left" />
             <ComboBox Name="ImageTypeComboBox" Height="32" Width="228" HorizontalAlignment="Left" Margin="0,8,0,0" ItemsSource="{Binding ImageTypeFamily}" SelectedIndex="0" SelectionChanged="ImageTypeComboBox_SelectionChanged"></ComboBox>
-            <ComboBox Name="ImageDPIComboBox" Height="32" Width="228" HorizontalAlignment="Left" Margin="0,8,0,0" ItemsSource="{Binding ImageDPIFamily}" SelectedIndex="0" SelectionChanged="ImageDPIComboBox_SelectionChanged"></ComboBox>
+            <!--<ComboBox Name="ImageDPIComboBox" Height="32" Width="228" HorizontalAlignment="Left" Margin="0,8,0,0" ItemsSource="{Binding ImageDPIFamily}" SelectedIndex="0" SelectionChanged="ImageDPIComboBox_SelectionChanged"></ComboBox>-->
         </StackPanel>
     </Grid>
 </UserControl>

+ 6 - 6
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageConverter/HomePageConverterImg.xaml.cs

@@ -25,14 +25,14 @@ namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.H
 
 
        
-        private void ImageDPIComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            if (((HomePageConverterImgViewModel)this.DataContext).homePageConverterDialogViewModel == null)
-                return;
+        //private void ImageDPIComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        //{
+        //    if (((HomePageConverterImgViewModel)this.DataContext).homePageConverterDialogViewModel == null)
+        //        return;
 
-            ((HomePageConverterImgViewModel)this.DataContext).UpdateImageDpi(ImageDPIComboBox.SelectedIndex);
+        //    ((HomePageConverterImgViewModel)this.DataContext).UpdateImageDpi(ImageDPIComboBox.SelectedIndex);
             
             
-        }
+        //}
     }
 }

File diff suppressed because it is too large
+ 5 - 11
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageBatchProcessing/HomePageSetPasswordDialog.xaml


+ 1 - 1
PDF Office/Views/Dialog/ToolsDialogs/SaftyDialogs/SetPasswordDialog.xaml

@@ -245,7 +245,7 @@
                         <PasswordBox Style="{StaticResource OpenPasswordBoxStyle}" help:PasswordBoxHelper.Password="{Binding OpenPassword, Mode=TwoWay , UpdateSourceTrigger=PropertyChanged}" help:PasswordBoxHelper.DisplayText="{Binding OpenPasswordMsg, Mode=TwoWay}" Grid.ColumnSpan="2">
                         </PasswordBox>
                         <TextBox Style="{StaticResource OpenPasswordTextBoxStyle}" Text="{Binding OpenPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"  Grid.ColumnSpan="2"  Visibility="{Binding OpenTextVisibility, Mode=TwoWay}" help:PasswordBoxHelper.DisplayText="{Binding OpenPasswordMsg, Mode=TwoWay}" ></TextBox>
-                        <CheckBox IsChecked="{Binding IsOpenPasswordDisplayed,Mode=TwoWay}" x:Name="DisplayOpenPasswordChk" Style="{StaticResource EyeCheckbox}" Height="16" Grid.Column="1" HorizontalAlignment="Left" Panel.ZIndex="1" Command="{Binding DisplayPasswordCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}"></CheckBox>
+                        <CheckBox IsChecked="{Binding IsOpenPasswordDisplayed,Mode=TwoWay}" x:Name="DisplayOpenPasswordChk" Style="{StaticResource EyeCheckbox}" Height="16" Grid.Column="1" HorizontalAlignment="Left" Panel.ZIndex="1" Command="{Binding DisplayPasswordCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}" Cursor="Hand"></CheckBox>
                     </Grid>
 
                     <CheckBox Grid.Column="1" Height="56" VerticalAlignment="Bottom"></CheckBox>

+ 13 - 2
PDF Office/Views/Form/FormsToolContent.xaml

@@ -156,7 +156,7 @@
                 Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
             <RadioButton
                 Name="BtnAlignment"
-                Width="44"
+                Width="44" IsChecked="{Binding IsAlignmentCheckedBtn}"
                 Click="BtnAlignment_Click"
                 Initialized="BtnAlignment_Initialized">
                 <StackPanel Orientation="Horizontal">
@@ -233,11 +233,17 @@
                                 </i:EventTrigger>
                             </i:Interaction.Triggers>
                         </cus:MenuItemWithPath>
+
+                        <i:Interaction.Triggers>
+                            <i:EventTrigger EventName="Closed">
+                                <i:InvokeCommandAction Command="{Binding AlignmentClosedMenuCommand}"/>
+                            </i:EventTrigger>
+                        </i:Interaction.Triggers>
                     </ContextMenu>
                    
                 </RadioButton.ContextMenu>
             </RadioButton>
-            <RadioButton Name="BtnMore" Width="44" Click="BtnMore_Click" Initialized="BtnMore_Initialized">
+            <RadioButton Name="BtnMore" IsChecked="{Binding IsMoreCheckedBtn}" Width="44" Click="BtnMore_Click" Initialized="BtnMore_Initialized">
                 <StackPanel Orientation="Horizontal">
                     <Grid>
                         <Path
@@ -262,6 +268,11 @@
                         <MenuItem Header="Importing data" />
                         <MenuItem Header="Exporting data" />
                         <MenuItem Header="Automatic form recognition" />
+                        <i:Interaction.Triggers>
+                            <i:EventTrigger EventName="Closed">
+                                <i:InvokeCommandAction Command="{Binding ClosedMenuCommand}"/>
+                            </i:EventTrigger>
+                        </i:Interaction.Triggers>
                     </ContextMenu>
                 </RadioButton.ContextMenu>
             </RadioButton>

+ 8 - 2
PDF Office/Views/PropertyPanel/PDFEdit/TextEditProperty.xaml

@@ -376,8 +376,14 @@
                             <cusColor:ColorContent
                                 x:Name="FontColorBox"
                                 Width="56"
-                                HorizontalAlignment="Right" SelectedColor="{Binding SelectColor}"
-                                ShowColorList="Collapsed" />
+                                HorizontalAlignment="Right" SelectedColor="{Binding CurrentColor}"
+                                ShowColorList="Collapsed" >
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="SelectedColorInvoke">
+                                        <i:InvokeCommandAction Command="{Binding SelectedColorCommand}" CommandParameter="{Binding ElementName=FontColorBox, Path=SelectedColor}" />
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </cusColor:ColorContent>
                         </Grid>
                     </StackPanel>
                 </StackPanel>

+ 2 - 2
PDF Office/Views/Tools/TextEditToolContent.xaml

@@ -15,7 +15,7 @@
     <Grid>
         <Border BorderBrush="{StaticResource color.sys.layout.divider}" BorderThickness="0,1,0,1">
             <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
-                <customControl:CustomIconToggleBtn
+                <customControl:CustomIconToggleBtn IsChecked="{Binding IsTextEdit}"
                     x:Name="BtnAddText"
                     Height="28"
                     Padding="4,0"
@@ -40,7 +40,7 @@
                             Text="Add Text" />
                     </StackPanel>
                 </customControl:CustomIconToggleBtn>
-                <customControl:CustomIconToggleBtn
+                <customControl:CustomIconToggleBtn IsChecked="{Binding IsImgEdit}"
                     x:Name="BtnAddImage"
                     Height="28"
                     Margin="8,0"