Browse Source

综合-注释

OYXH\oyxh 2 years ago
parent
commit
617c0ebc0f

+ 20 - 0
PDF Office/EventAggregators/RefreshAnnotEvent.cs

@@ -0,0 +1,20 @@
+using PDF_Office.Model.BOTA;
+using Prism.Events;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.EventAggregators
+{
+    internal class RefreshAnnotEvent : PubSubEvent<RefreshAnnotArgs>
+    {
+    }
+
+    public class RefreshAnnotArgs
+    {
+        public string Unicode { get; set; }
+        public AnnotationHandlerEventArgs Annotation { get; set; }
+    }
+}

+ 1 - 0
PDF Office/PDF Office.csproj

@@ -365,6 +365,7 @@
     <Compile Include="EventAggregators\PageEditNotifyEvent.cs" />
     <Compile Include="EventAggregators\PageEditRefreshEvent.cs" />
     <Compile Include="EventAggregators\RedactionCommandEvent.cs" />
+    <Compile Include="EventAggregators\RefreshAnnotEvent.cs" />
     <Compile Include="EventAggregators\ScanEvent.cs" />
     <Compile Include="EventAggregators\SendPrintInfoEvent.cs" />
     <Compile Include="EventAggregators\ShowTipEvent.cs" />

+ 17 - 1
PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs

@@ -11,6 +11,7 @@ using Microsoft.Office.Interop.PowerPoint;
 using Microsoft.Office.Interop.Word;
 using PDF_Office.CustomControl;
 using PDF_Office.DataConvert;
+using PDF_Office.EventAggregators;
 using PDF_Office.Helper;
 using PDF_Office.Model;
 using PDF_Office.Model.BOTA;
@@ -18,6 +19,7 @@ using PDF_Office.Views.BOTA;
 using PDF_Office.Views.PropertyPanel.AnnotPanel;
 using PDF_Office.Views.Scan;
 using Prism.Commands;
+using Prism.Events;
 using Prism.Mvvm;
 using Prism.Regions;
 using Prism.Services.Dialogs;
@@ -30,6 +32,7 @@ using System.Configuration;
 using System.Drawing;
 using System.IO;
 using System.Linq;
+using System.Management.Instrumentation;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
@@ -156,6 +159,7 @@ namespace PDF_Office.ViewModels.BOTA
         private ListBox listBox;
         private IRegionManager region;
         private IDialogService dialogs;
+        private IEventAggregator events;
         private Visibility isEmptyPanelVisibility = Visibility.Visible;
 
         public ViewContentViewModel ViewContentViewModel { get; set; }
@@ -221,11 +225,13 @@ namespace PDF_Office.ViewModels.BOTA
 
         public DelegateCommand TimeAscendingCommand { get; set; }
         public DelegateCommand TimeDescendingCommand { get; set; }
+        public string Unicode { get; private set; }
 
-        public AnnotationContentViewModel(IRegionManager regionManager, IDialogService dialogService)
+        public AnnotationContentViewModel(IRegionManager regionManager, IDialogService dialogService, IEventAggregator eventAggregator)
         {
             region = regionManager;
             dialogs = dialogService;
+            events = eventAggregator;
             LoadedCommand = new DelegateCommand<object>(Loaded);
             ListBoxItemPreviewMouseLeftButtonDown = new DelegateCommand<object>(ListBoxItem_PreviewMouseLeftButtonDown);
             AddNotesCommand = new DelegateCommand<object>(AddNotesEvent);
@@ -1139,6 +1145,16 @@ namespace PDF_Office.ViewModels.BOTA
 
             KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
             KeyEventsHelper.KeyDown += ShortCut_KeyDown;
+            Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
+            events.GetEvent<RefreshAnnotEvent>().Subscribe(RefreshData, e => e.Unicode == Unicode);
+        }
+
+        private void RefreshData(RefreshAnnotArgs obj)
+        {
+            if (obj.Annotation != null)
+            {
+                RefreshOneListItem(obj.Annotation.AnnotHandlerEventArgs);
+            }
         }
 
         private void ShortCut_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)

+ 24 - 15
PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreehandAnnotPropertyViewModel.cs

@@ -152,7 +152,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             EraserSizeItems.Add(item);
             item = new ComboDataItem(20, "pt");
             EraserSizeItems.Add(item);
-          
+
         }
 
         private void InitColorItems()
@@ -185,10 +185,19 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         //设置线条大小
         private void SelectPenThickChanged(object obj)
         {
-            if (obj != null && obj is double)
+            //if (obj != null && obj is double)
+            //{
+            //    var thick = (double)obj;
+            //    PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, thick);
+            //}
+            if (obj is double)
             {
-                var thick = (double)obj;
-                PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, thick);
+                var tran = (double)obj;
+                BasicVm.AnnotThickness = tran;
+                PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, tran);
+
+                if (BasicVm.IsMultiSelected == false)
+                    PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
             }
         }
 
@@ -227,7 +236,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                         break;
 
                 }
-                
+
             }
         }
 
@@ -244,11 +253,11 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
-       //选择橡皮擦
+        //选择橡皮擦
         private void Erase_Command(object obj)
         {
             var btn = obj as ToggleButton;
-            if(btn.IsChecked == true)
+            if (btn.IsChecked == true)
             {
                 //属性面板,切换橡皮擦后,再回到画笔时,需要恢复最近画笔的属性值
                 CurrenFreeHandAnnot = PropertyPanel.annot as FreehandAnnotArgs;
@@ -265,7 +274,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             if (btn.IsChecked == true)
             {
                 PropertyPanel.InvokeToMyTools(AnnotArgsType.AnnotFreehand, CurrenFreeHandAnnot);
-                IsPen = true;;
+                IsPen = true; ;
                 if (CurrenFreeHandAnnot is FreehandAnnotArgs)
                 {
                     BasicVm.AnnotTypeTitle = "画笔";
@@ -299,7 +308,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                 AnnotEvent = PropertyPanel.AnnotEvent;
                 Annot = PropertyPanel.annot;
                 BasicVm.IsMultiSelected = PropertyPanel.IsMultiSelected;
-                if(Annot is FreehandAnnotArgs)
+                if (Annot is FreehandAnnotArgs)
                 {
                     BasicVm.AnnotTypeTitle = "画笔";
                 }
@@ -316,7 +325,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                 {
                     GetAnnotProperty();
                 }
-                   
+
             }
         }
 
@@ -378,7 +387,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     }
 
 
-                    if(isNoEqualsDir["ThickSolidDashStyle"] == false)
+                    if (isNoEqualsDir["ThickSolidDashStyle"] == false)
                     {
                         if (AnnotTransfer.IsSolidStyle(temp.LineDash) != AnnotTransfer.IsSolidStyle(item.LineDash))
                         {
@@ -398,10 +407,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     BasicVm.AnnotThickness = temp.LineWidth;
                 }
 
-                if(isNoEqualsDir["ThickSolidDashStyle"] == true)
+                if (isNoEqualsDir["ThickSolidDashStyle"] == true)
                 {
                     BasicVm.IsSolidLine = BasicVm.IsDashLine = false;
-                   
+
                 }
                 else
                 {
@@ -416,7 +425,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         {
             if (Annot is FreehandAnnotArgs)
             {
-                var annot  = Annot as FreehandAnnotArgs;
+                var annot = Annot as FreehandAnnotArgs;
                 if (annot != null)
                 {
                     BasicVm.FillOpacity = annot.Transparency;
@@ -426,7 +435,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     var isSolid = AnnotTransfer.IsSolidStyle(annot.LineDash);
                     BasicVm.IsSolidLine = isSolid;
                     BasicVm.IsDashLine = !isSolid;
- 
+
                     IsPen = true;
                     StrokeDashArray = new DoubleCollection();
                     if (isSolid == false)

+ 1 - 1
PDF Office/ViewModels/Tools/AnnotManager/AnnotTransfer.cs

@@ -187,7 +187,7 @@ namespace PDF_Office.ViewModels.Tools.AnnotManager
             {
                 AnnotEvent?.UpdateAttrib(annotAttrib, obj);
                 AnnotEvent?.UpdateAnnot();
-                this.annot = AnnotEvent.AnnotItemsList[0];
+                //this.annot = AnnotEvent.AnnotItemsList[0];
             }
         }
 

+ 69 - 31
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -27,13 +27,14 @@ using PDF_Office.Model.AnnotPanel;
 using System.Windows.Input;
 using PDF_Office.ViewModels.Tools.AnnotManager;
 using ComPDFKit.Import;
+using System.Windows.Markup;
 
 namespace PDF_Office.ViewModels.Tools
 {
     public sealed partial class AnnotToolContentViewModel : BindableBase, INavigationAware
     {
-
         #region 事件绑定和解绑
+
         private void BindingEvent()
         {
             //属性面板与注释工具栏绑定:属性面板的属性变化,会同步注释工具栏的属性值
@@ -104,6 +105,25 @@ namespace PDF_Office.ViewModels.Tools
         //鼠标左键双击注释
         private void PDFViewer_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
+            if (e.ClickCount == 1)
+            {
+                //if (sender is CPDFViewer pDFViewer)
+                //{
+                //    if (pDFViewer.ToolManager.CurrentAnnotArgs != null)
+                //    {
+                //        if (pDFViewer.ToolManager.CurrentAnnotArgs is FreehandAnnotArgs freehand)
+                //        {
+                //            PDFViewer.SelectAnnotation(freehand.PageIndex, freehand.AnnotIndex);
+                //        }
+                //    }
+                //}
+                bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemBookMark");
+
+                if (viewContentViewModel.OpenBOTA == true && isTabItemAnnotation == true && bOTAContent.TabItemBookMark.IsSelected == true)
+                {
+                    this.events.GetEvent<CleanSelectAllEvent>().Publish(new CleanSelectAllArgs() { Unicode = App.mainWindowViewModel.SelectedItem.Unicode, IsCleanSelectAll = true });
+                }
+            }
             if (e.ClickCount == 2)
             {
                 if (CurrentSelectedAnnot != null)
@@ -112,27 +132,38 @@ namespace PDF_Office.ViewModels.Tools
                     if (type != AnnotArgsType.AnnotSticky && type != AnnotArgsType.AnnotFreeText &&
                         type != AnnotArgsType.AnnotHighlight && type != AnnotArgsType.AnnotUnderline && type != AnnotArgsType.AnnotStrikeout)
                     {
+                        int dpi = DpiHelpers.Dpi;
                         var rect = CurrentSelectedAnnot.ClientRect;
+                        //rect = new Rect(
+                        //    rect.Left / 72D * dpi,
+                        //    rect.Top / 72D * dpi,
+                        //    rect.Width / 72D * dpi,
+                        //    rect.Height / 72D * dpi);
                         var ui = PDFViewer.Parent as ContentControl;
                         if (ui != null)
                         {
                             var point = e.GetPosition(ui);
-                            if (rect.Left < point.X && rect.Top < point.Y && (rect.Width + rect.X) >= point.X && (rect.Height + rect.Y) >= point.Y)
-                            {
-                                PopAnnotNoteText(CurrentSelectedAnnot);
-                            }
 
+                            double x = point.X / 72D * dpi;
+                            double y = point.Y / 72D * dpi;
+                            point = new Point(x, y);
+                            //if (rect.Contains(point))
+                            //{
+                            PopAnnotNoteText(CurrentSelectedAnnot);
+                            //}
+                            //if (rect.Left <= x && rect.Right >= x && rect.Top <= y && rect.Bottom >= y)
+                            ////if (rect.Left < x && rect.Top > y && (rect.Width + rect.X) >= x && (rect.Height + rect.Y) >= y)
+                            //{
+                            //    PopAnnotNoteText(CurrentSelectedAnnot);
+                            //}
                         }
-
                     }
 
-                    if(type == AnnotArgsType.AnnotSticky)
+                    if (type == AnnotArgsType.AnnotSticky)
                     {
                         (CurrentSelectedAnnot as StickyAnnotArgs).PopupEditWnd();
                     }
-                       
                 }
-                   
             }
         }
 
@@ -175,6 +206,7 @@ namespace PDF_Office.ViewModels.Tools
                     break;
             }
         }
+
         private void GetSelectedAnnots(AnnotAttribEvent e)
         {
             var annot = e.AnnotItemsList[0];
@@ -271,7 +303,6 @@ namespace PDF_Office.ViewModels.Tools
             if (annot.PageIndex < 0 || annot.AnnotIndex < 0)
                 return;
 
-
             var signAnnot = viewContentViewModel.AnnotSignatures.FirstOrDefault(temp => temp.Item1 == annot.PageIndex && temp.Item2 == annot.AnnotIndex);
             if (signAnnot == null)
             {
@@ -279,17 +310,16 @@ namespace PDF_Office.ViewModels.Tools
                 {
                     StrAnnotToolChecked = "Stamp";
                 }
-                else
-                {
-                    StrAnnotToolChecked = "";
-                }
+                //else
+                //{
+                //    StrAnnotToolChecked = "";
+                //}
             }
             else
             {
                 GetSignature();
                 StrAnnotToolChecked = "Signature";
             }
-
         }
 
         private void AddAnnotSignature(AnnotHandlerEventArgs annot)
@@ -313,12 +343,15 @@ namespace PDF_Office.ViewModels.Tools
         #endregion 与触发事件调用相关的函数
 
         #region PDFViewer事件
+
         private AnnotHandlerEventArgs CurrentSelectedAnnot = null;
+
         //选中和非选中注释
         private void PDFViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e)
         {
             if (e != null)
             {
+                CurrentSelectedAnnot = null;
                 var annot = e.AnnotItemsList[0];
                 if (annot != null)
                 {
@@ -350,7 +383,8 @@ namespace PDF_Office.ViewModels.Tools
                                     break;
                             }
 
-                            //TODO: 修改注释后,会作用到之后添加的注释中。因此先把此逻辑“创建注释后,会自动回到默认值”注释掉
+                            #region //TODO: 修改注释后,会作用到之后添加的注释中。因此先把此逻辑“创建注释后,会自动回到默认值”注释掉
+
                             //注释代码原因:设计已经重新调整逻辑:所有注释创建后,编辑属性,所有属性会作用于下次创建的注释中。
                             //if (annot.EventType != AnnotArgsType.AnnotStrikeout &&
                             //annot.EventType != AnnotArgsType.AnnotUnderline &&
@@ -402,8 +436,6 @@ namespace PDF_Office.ViewModels.Tools
                             //    }
                             //}
 
-                            #region TO DO
-
                             //设计重新调整,阅读页空白处,右键菜单,添加链接需要显示,其他和pro mac一样的效果,不显示属性栏
                             //if (isRightMenuAddAnnot && annot.EventType!=AnnotArgsType.AnnotLink)
                             //{
@@ -414,7 +446,7 @@ namespace PDF_Office.ViewModels.Tools
                             //    ShowPropertyPanel();
                             //}
 
-                            #endregion TO DO
+                            #endregion //TODO: 修改注释后,会作用到之后添加的注释中。因此先把此逻辑“创建注释后,会自动回到默认值”注释掉
                         }
                     }
                     else
@@ -730,7 +762,6 @@ namespace PDF_Office.ViewModels.Tools
                     menuItem = popMenu.Items[4] as MenuItem;
                     menuItem.CommandTarget = PDFViewer;
                     menuItem.Command = SnapshotEditMenuViewModel.PrintCommand;
-
                 }
             }
         }
@@ -818,8 +849,8 @@ namespace PDF_Office.ViewModels.Tools
                             {
                                 AddAnnotSignature(editEvent.EditAnnotArgs);
                             }
-                            
-                            if(editEvent.EditAnnotArgs.EventType == AnnotArgsType.AnnotFreeText)
+
+                            if (editEvent.EditAnnotArgs.EventType == AnnotArgsType.AnnotFreeText)
                             {
                                 (editEvent.EditAnnotArgs as FreeTextAnnotArgs).LineWidth = 0;
                             }
@@ -877,10 +908,10 @@ namespace PDF_Office.ViewModels.Tools
         {
             bool isAdd = false;
             Dictionary<int, List<int>> selectAnnotDicts = new Dictionary<int, List<int>>();
-           
+
             foreach (var item in e)
             {
-                if (item.EditAction == ActionType.Add)
+                if (item.EditAction == ActionType.Add || item.EditAction == ActionType.Modify)
                 {
                     var annot = item.EditAnnotArgs;
                     if (annot.EventType == AnnotArgsType.AnnotSquare || annot.EventType == AnnotArgsType.AnnotCircle ||
@@ -897,11 +928,8 @@ namespace PDF_Office.ViewModels.Tools
                         }
 
                         isAdd = true;
-
                     }
-
                 }
-
             }
 
             if (isAdd)
@@ -909,7 +937,6 @@ namespace PDF_Office.ViewModels.Tools
                 PDFViewer.ClearSelectAnnots();
                 PDFViewer.SelectAnnotation(selectAnnotDicts);
             }
-
         }
 
         //阅读页悬浮相应
@@ -953,6 +980,7 @@ namespace PDF_Office.ViewModels.Tools
         }
 
         private Rect oldRect = new Rect(0, 0, 0, 0);
+
         private void PopAnnotToolTip(CRect placementRect, Rect hoverRect, string content)
         {
             //便签,显示ToolTip内容
@@ -1002,8 +1030,15 @@ namespace PDF_Office.ViewModels.Tools
             if (e != null)
             {
                 AnnotHandlerEventArgs annotArgs = null;
+                propertyPanel.SaveLastAnnot();
+
                 foreach (AnnotArgsType argsType in e.Keys)
                 {
+                    if (propertyPanel.annot.EventType != argsType)
+                    {
+                        PDFViewer.SetMouseMode(MouseModes.PanTool);
+                    }
+
                     switch (argsType)
                     {
                         case AnnotArgsType.AnnotSquare:
@@ -1019,15 +1054,18 @@ namespace PDF_Office.ViewModels.Tools
                             annotArgs = GetArrowLine(LineTag);
                             break;
                     }
+                    ShowPropertyPanel();
+                    if (string.IsNullOrEmpty(StrAnnotToolChecked) || StrAnnotToolChecked != "Rect")
+                    {
+                        PDFViewer.SetMouseMode(MouseModes.PanTool);
+                        return;
+                    }
                     if (annotArgs != null)
                     {
                         annotArgs.Author = Settings.Default.AppProperties.Description.Author;
                         PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
                         PDFViewer.SetToolParam(annotArgs);
                     }
-
-                    propertyPanel.SaveLastAnnot();
-                    ShowPropertyPanel();
                 }
             }
         }

File diff suppressed because it is too large
+ 34 - 913
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs


+ 877 - 10
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -3,17 +3,17 @@ using ComPDFKit.PDFDocument;
 using ComPDFKitViewer;
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
-using Microsoft.Office.Interop.Excel;
-using Microsoft.Office.Interop.Word;
 using Microsoft.Win32;
 using PDF_Office.CustomControl;
 using PDF_Office.EventAggregators;
 using PDF_Office.Helper;
 using PDF_Office.Model;
+using PDF_Office.Model.BOTA;
 using PDF_Office.Properties;
 using PDF_Office.ViewModels.BOTA;
 using PDF_Office.ViewModels.PropertyPanel;
 using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
+using PDF_Office.ViewModels.Tools.AnnotManager;
 using PDF_Office.Views.BOTA;
 using PDF_Office.Views.PropertyPanel.AnnotPanel;
 using PDFSettings;
@@ -25,16 +25,19 @@ using Prism.Regions;
 using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
+using System.Windows.Annotations;
 using System.Windows.Controls;
 using System.Windows.Controls.Primitives;
 using System.Windows.Forms;
 using System.Windows.Input;
 using System.Windows.Media;
+using System.Windows.Media.Imaging;
 using ContextMenu = System.Windows.Controls.ContextMenu;
 using KeyEventArgs = System.Windows.Input.KeyEventArgs;
 using MenuItem = System.Windows.Controls.MenuItem;
@@ -44,6 +47,7 @@ namespace PDF_Office.ViewModels.Tools
     public sealed partial class AnnotToolContentViewModel : BindableBase, INavigationAware
     {
         #region 初始化
+
         public AnnotToolContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IDialogService dialogService)
         {
             region = regionManager;
@@ -164,7 +168,6 @@ namespace PDF_Office.ViewModels.Tools
             AnnotHandlerEventArgs annotArgs = null;
             var tag = annotBtn.Tag.ToString();
 
-
             if (annotBtn.Name == "BtnShowAnnot")
             {
                 //显示/隐藏注释
@@ -184,13 +187,13 @@ namespace PDF_Office.ViewModels.Tools
                     annotArgs.Author = Settings.Default.AppProperties.Description.Author;
                     PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
                     PDFViewer.SetToolParam(annotArgs);
+
                     #region 设计重新调整,阅读页空白处,右键菜单,添加链接需要显示,其他和pro mac一样的效果,不显示属性栏
 
                     //isRightMenuAddAnnot = false;
 
                     #endregion 设计重新调整,阅读页空白处,右键菜单,添加链接需要显示,其他和pro mac一样的效果,不显示属性栏
                 }
-
             }
             else
             {
@@ -200,7 +203,6 @@ namespace PDF_Office.ViewModels.Tools
                 PDFViewer.ToolManager.EnableClickCreate = false;
             }
 
-
             if (dictVar["isTemplateAnnot"] == false && annotArgs == null)
             {
                 //当不是注释模板,且无创建注释时,属性面板显示为空内容
@@ -245,7 +247,6 @@ namespace PDF_Office.ViewModels.Tools
             else
                 StrAnnotToolChecked = "Link";
 
-
             if (tag == "Rect" || tag == "Circle" || tag == "Arrow" || tag == "Line")
             {
                 //新建形状注释,设置默认大小
@@ -257,10 +258,8 @@ namespace PDF_Office.ViewModels.Tools
             {
                 PDFViewer.ToolManager.EnableClickCreate = false;
             }
-
         }
 
-
         #endregion 注释工具栏 -》Command实现
 
         #region BOTA
@@ -334,6 +333,263 @@ namespace PDF_Office.ViewModels.Tools
 
         #region 阅读页右键菜单
 
+        /// <summary>
+        /// 空白处-右键菜单-添加注释
+        /// </summary>
+        /// <param name="sender"></param>
+        private void AddAnnotation_Click(object sender)
+        {
+            if (sender is MenuItem menuItem)
+            {
+                AnnotHandlerEventArgs annotHandler = null;
+                string str = menuItem.Tag.ToString();
+                viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                propertyPanel.IsAddLink = false;
+                propertyPanel.IsLocationLink = false;
+                if (str == AddAnnotType.AnnotFreehand.ToString())
+                {
+                    annotHandler = GetFreehand();
+                }
+                if (str == AddAnnotType.AnnotFreeText.ToString())
+                {
+                    annotHandler = GetFreetext();
+                }
+                if (str == AddAnnotType.AnnotSticky.ToString())
+                {
+                    annotHandler = GetStickyNote();
+                }
+                if (str == AddAnnotType.AnnotSquare.ToString())
+                {
+                    annotHandler = GetRect();
+                }
+                if (str == AddAnnotType.AnnotCircle.ToString())
+                {
+                    annotHandler = GetCircle();
+                }
+                if (str == AddAnnotType.AnnotArrow.ToString())
+                {
+                    annotHandler = GetArrowLine("Arrow");
+                }
+                if (str == AddAnnotType.AnnotLine.ToString())
+                {
+                    annotHandler = GetArrowLine("Line");
+                }
+                if (str == AddAnnotType.AnnotLink.ToString())
+                {
+                    propertyPanel.IsAddLink = true;
+
+                    annotHandler = GetLink();
+                }
+                if (str == AddAnnotType.AnnotStamp.ToString())
+                {
+                    annotHandler = GetStamp();
+                }
+                if (str == AddAnnotType.AnnotAutograph.ToString())
+                {
+                    annotHandler = GetSignature();
+                }
+                if (annotHandler != null)
+                {
+                    annotHandler.Author = Settings.Default.AppProperties.Description.Author;
+                    PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                    PDFViewer.SetToolParam(annotHandler);
+                    //是否展开右侧面板 =>否(链接、图章、签名除外)
+                    ShowPropertyPanel(false);
+                    if (str == AddAnnotType.AnnotLink.ToString()
+                    || str == AddAnnotType.AnnotStamp.ToString()
+                    || str == AddAnnotType.AnnotAutograph.ToString()
+                    )
+                    {
+                        ShowPropertyPanel(true);
+                    }
+                    IsNoSelectMenu = true;
+                }
+            }
+        }
+
+        /// <summary>
+        /// 选择文本、图片,右键菜单
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void AnnotToolMenu_Click(object sender, RoutedEventArgs e)
+        {
+            if (sender is MenuItem clickMenu && clickMenu.CommandParameter is AnnotCommandArgs)
+            {
+                AnnotCommandArgs annotCommand = clickMenu.CommandParameter as AnnotCommandArgs;
+
+                switch (clickMenu.Tag.ToString())
+                {
+                    case "HighLight"://字体高亮
+                        TextHighlightAnnotArgs highlightArgs = (TextHighlightAnnotArgs)GetHighLight();
+                        highlightArgs.ClientRect = annotCommand.TextRect;
+                        highlightArgs.Content = annotCommand.Text;
+                        highlightArgs.Author = Settings.Default.AppProperties.Description.Author;
+                        PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                        PDFViewer.SetToolParam(highlightArgs);
+                        PDFViewer.SetMouseMode(MouseModes.PanTool);
+                        break;
+
+                    case "UnderLine"://下划线
+                        TextUnderlineAnnotArgs underlineArgs = (TextUnderlineAnnotArgs)GetUnderLine();
+                        underlineArgs.ClientRect = annotCommand.TextRect;
+                        underlineArgs.Content = annotCommand.Text;
+                        underlineArgs.Author = Settings.Default.AppProperties.Description.Author;
+                        PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                        PDFViewer.SetToolParam(underlineArgs);
+                        PDFViewer.SetMouseMode(MouseModes.PanTool);
+                        break;
+
+                    case "Strikeout"://删除线
+                        TextStrikeoutAnnotArgs strikeoutArgs = (TextStrikeoutAnnotArgs)GetStrikeout();
+                        strikeoutArgs.ClientRect = annotCommand.TextRect;
+                        strikeoutArgs.Content = annotCommand.Text;
+                        strikeoutArgs.Author = Settings.Default.AppProperties.Description.Author;
+                        PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                        PDFViewer.SetToolParam(strikeoutArgs);
+                        PDFViewer.SetMouseMode(MouseModes.PanTool);
+                        break;
+
+                    case "Freetext"://文本
+                        FreeTextAnnotArgs textArgs = (FreeTextAnnotArgs)GetFreetext();
+                        textArgs.ClientRect = annotCommand.TextRect;
+                        //textArgs.Transparency = 1;
+                        //textArgs.BgColor = Colors.Transparent;
+                        //textArgs.LineColor = Colors.Red;
+                        //textArgs.LineWidth = 2;
+                        textArgs.TextContent = annotCommand.Text;
+
+                        PDFViewer.CreatePageAnnot(annotCommand.PageIndex, textArgs);
+                        break;
+
+                    case "StickyNote"://便签
+
+                        StickyAnnotArgs stickyAnnotArgs = (StickyAnnotArgs)GetStickyNote();
+                        //stickyAnnotArgs.ClientRect = annotCommand.TextRect;
+                        List<TextSelectNode> textSelectNodes = PDFViewer.GetSelectTextInfo();
+
+                        //stickyAnnotArgs.ClientRect = new Rect(textSelectNodes[0].StartPoint.X, annotCommand.TextRect.Y - annotCommand.TextRect.Height, annotCommand.TextRect.Width, annotCommand.TextRect.Height);
+                        Rect rect = annotCommand.TextRectList[0];
+
+                        #region to do 转dpi
+
+                        //int dpi = DpiHelpers.Dpi;
+                        //double x = rect.X / 72D * dpi;
+                        //double y = (rect.Y - rect.Height) / 72D * dpi;
+                        //double width = rect.Width / 72D * dpi;
+                        //double height = rect.Height / 72D * dpi;
+
+                        #endregion to do 转dpi
+
+                        //stickyAnnotArgs.ClientRect = new Rect(x, y, width, height);
+                        //stickyAnnotArgs.ClientRect = new Rect(rect.X, rect.Y - rect.Height, rect.Width, rect.Height);
+                        stickyAnnotArgs.ClientRect = rect;
+                        //PDFViewer.CreatePageAnnot(annotCommand.PageIndex, stickyAnnotArgs);
+                        NavigationParameters param = new NavigationParameters();
+                        param.Add(ParameterNames.PDFViewer, PDFViewer);
+                        param.Add(ParameterNames.StickyAnnotArgs, stickyAnnotArgs);
+                        param.Add(ParameterNames.ViewContentViewModel, viewContentViewModel);
+                        param.Add(ParameterNames.AnnotCommandArgs, annotCommand);
+
+                        System.Windows.Controls.ContentControl window = null;
+                        if (PDFViewer.Parent as ContentControl != null)
+                        {
+                            window = PDFViewer.Parent as ContentControl;
+                        }
+                        else
+                        {
+                            window = App.Current.MainWindow;
+                        }
+
+                        var point = Mouse.GetPosition(window);
+                        viewContentViewModel.NotePopupVisible = Visibility.Visible;
+                        viewContentViewModel.CanvasNoteLeft = point.X;
+                        viewContentViewModel.CanvasNoteBottom = point.Y;
+                        if (point.Y > window.ActualHeight / 2)
+                        {
+                            viewContentViewModel.CanvasNoteBottom = point.Y - window.ActualHeight / 2;
+                        }
+
+                        viewContentViewModel.IsNoteAdd = true;
+                        region.RequestNavigate(viewContentViewModel.NotePopupRegionName, "StickyNotePopup", param);
+
+                        //stickyAnnotArgs.Author = Settings.Default.AppProperties.Description.Author;
+                        //PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                        //PDFViewer.SetToolParam(stickyAnnotArgs);
+
+                        //PDFViewer.SetMouseMode(MouseModes.PanTool);
+                        break;
+
+                    case "Rect"://矩形
+                        SquareAnnotArgs squareAnnotArgs = (SquareAnnotArgs)GetRect();
+                        squareAnnotArgs.ClientRect = annotCommand.TextRect;
+                        PDFViewer.CreatePageAnnot(annotCommand.PageIndex, squareAnnotArgs);
+                        break;
+
+                    case "Circle"://圆
+                        CircleAnnotArgs circleAnnotArgs = (CircleAnnotArgs)GetCircle();
+                        circleAnnotArgs.ClientRect = annotCommand.TextRect;
+                        PDFViewer.CreatePageAnnot(annotCommand.PageIndex, circleAnnotArgs);
+                        break;
+
+                    case "Line"://线
+                        LineAnnotArgs lineAnnotArgs = (LineAnnotArgs)GetArrowLine(clickMenu.Tag.ToString());
+                        lineAnnotArgs.ClientRect = annotCommand.TextRect;
+                        lineAnnotArgs.LinePoints.Add(new Point(annotCommand.TextRect.Left, annotCommand.TextRect.Top));
+                        lineAnnotArgs.LinePoints.Add(new Point(annotCommand.TextRect.Right, annotCommand.TextRect.Bottom));
+                        PDFViewer.CreatePageAnnot(annotCommand.PageIndex, lineAnnotArgs);
+                        break;
+
+                    case "Link"://链接
+                        LinkAnnotArgs linkArgs = new LinkAnnotArgs();
+                        linkArgs.ClientRect = annotCommand.TextRect;
+                        linkArgs.URI = string.Empty;
+                        linkArgs.LinkType = LINK_TYPE.GOTO;
+                        linkArgs.DestIndex = annotCommand.PageIndex;
+                        PDFViewer.CreatePageAnnot(annotCommand.PageIndex, linkArgs);
+                        BtnLinkIsChecked = true;
+                        List<AnnotHandlerEventArgs> lists = new List<AnnotHandlerEventArgs>();
+                        lists.Add(linkArgs);
+                        propertyPanel.IsAddLink = true;
+
+                        AnnotHandlerEventArgs annotArgs = GetLink(lists);
+                        PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                        PDFViewer.SetToolParam(annotArgs);
+                        viewContentViewModel.IsPropertyOpen = true;
+                        break;
+
+                    case "OutLine":
+                        bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemOutLine");
+                        if (isTabItemAnnotation == false)
+                        {
+                            bOTAContent.TabItemOutLine.IsSelected = true;
+                        }
+                        OutLineControlViewModel outLineControlViewModel = GetOutLineControlViewModel(bOTAContentViewModel, out OutLineControl outLineControl);
+                        if (outLineControlViewModel != null && outLineControl != null)
+                        {
+                            string str = null;
+                            if (string.IsNullOrEmpty(annotCommand.Text))
+                            {
+                                str = (annotCommand.PageIndex + 1).ToString();
+                            }
+                            else
+                            {
+                                str = annotCommand.Text;
+                            }
+
+                            outLineControl.AddOutlineNode(str);
+                        }
+
+                        break;
+
+                    case "ExportPicture":
+                        ExportPicture_MenuItemClick();
+                        break;
+                }
+                //ShowPropertyPanel(false);
+            }
+        }
+
         private void PageDisplay(ItemCollection items)
         {
             foreach (var item in items)
@@ -652,14 +908,625 @@ namespace PDF_Office.ViewModels.Tools
 
         #endregion 阅读页右键菜单
 
+        #region 注释右键菜单事件
+
+        //高亮、下划线、删除
+        private void HightAnnotCopyText_Menu(object obj)
+        {
+            if (obj as CusMenuItem != null)
+            {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as AnnotHandlerEventArgs;
+                if (annot != null)
+                {
+                    System.Windows.Clipboard.SetText(annot.Content);
+                }
+            }
+        }
+
+        //更改为当前注释属性默认值
+        private void AnnotDefaultValues_Menu(object obj)
+        {
+            if (obj as CusMenuItem != null)
+            {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as AnnotHandlerEventArgs;
+                if (annot != null)
+                {
+                    if (annot is TextHighlightAnnotArgs)
+                    {
+                        var color = (annot as TextHighlightAnnotArgs).Color;
+                        HighLightColor = new SolidColorBrush(color);
+
+                        Settings.Default.AppProperties.Annotate.HighLightColor = color;
+
+                        var hightlight = GetAnnotDefault(AnnotArgsType.AnnotHighlight);
+                        hightlight.ForgoundColor = color;
+                        hightlight.Opacity = (annot as TextHighlightAnnotArgs).Transparency;
+                        SettingHelper.SetAnnotDefaultProperty(hightlight);
+                    }
+                    else if (annot is TextUnderlineAnnotArgs)
+                    {
+                        var color = (annot as TextUnderlineAnnotArgs).Color;
+                        UnderLineColor = new SolidColorBrush(color);
+
+                        Settings.Default.AppProperties.Annotate.UnderLineColor = color;
+
+                        var Underline = GetAnnotDefault(AnnotArgsType.AnnotUnderline);
+                        Underline.ForgoundColor = color;
+                        Underline.Opacity = (annot as TextUnderlineAnnotArgs).Transparency;
+                        SettingHelper.SetAnnotDefaultProperty(Underline);
+                    }
+                    else if (annot is TextStrikeoutAnnotArgs)
+                    {
+                        var color = (annot as TextStrikeoutAnnotArgs).Color;
+                        StrikeoutColor = new SolidColorBrush(color);
+
+                        Settings.Default.AppProperties.Annotate.StrikethroughColor = color;
+
+                        var Strikeout = GetAnnotDefault(AnnotArgsType.AnnotStrikeout);
+                        Strikeout.ForgoundColor = color;
+                        Strikeout.Opacity = (annot as TextStrikeoutAnnotArgs).Transparency;
+                        SettingHelper.SetAnnotDefaultProperty(Strikeout);
+                    }
+                    else if (annot is FreehandAnnotArgs)
+                    {
+                        var freeHand = annot as FreehandAnnotArgs;
+                        var color = freeHand.InkColor;
+
+                        Settings.Default.AppProperties.Annotate.FreeHandColor = color;
+
+                        var FreehandDefault = GetAnnotDefault(AnnotArgsType.AnnotFreehand);
+                        FreehandDefault.ForgoundColor = color;
+                        FreehandDefault.Opacity = freeHand.Transparency;
+                        FreehandDefault.Thickness = freeHand.LineWidth;
+
+                        var isSolid = AnnotTransfer.IsSolidStyle(freeHand.LineDash);
+                        if (isSolid)
+                        {
+                            FreehandDefault.DashArray = null;
+                        }
+                        else
+                        {
+                            FreehandDefault.DashArray = new List<double>();
+                            foreach (var item in freeHand.LineDash.Dashes)
+                            {
+                                FreehandDefault.DashArray.Add(item);
+                            }
+                        }
+
+                        SettingHelper.SetAnnotDefaultProperty(FreehandDefault);
+                    }
+                    else if (annot is FreeTextAnnotArgs)
+                    {
+                        var freeText = annot as FreeTextAnnotArgs;
+                        Settings.Default.AppProperties.Annotate.TextAnnoteColor = freeText.FontColor;
+                        Settings.Default.AppProperties.Annotate.TextFontFamaily = freeText.FontFamily.ToString();
+                        Settings.Default.AppProperties.Annotate.TextAlign = freeText.Align;
+
+                        var FreeTextDefalut = GetAnnotDefault(AnnotArgsType.AnnotFreeText);
+                        FreeTextDefalut.ForgoundColor = freeText.FontColor;
+                        FreeTextDefalut.FontFamily = freeText.FontFamily.ToString();
+                        FreeTextDefalut.TextAlign = freeText.Align;
+                        FreeTextDefalut.FontSize = freeText.FontSize;
+                        FreeTextDefalut.FontWeight = freeText.FontWeight;
+                        FreeTextDefalut.FontStyle = freeText.FontStyle;
+                        FreeTextDefalut.BackgroundColor = freeText.BgColor;
+                        FreeTextDefalut.Opacity = (annot as FreeTextAnnotArgs).Transparency;
+                        SettingHelper.SetAnnotDefaultProperty(FreeTextDefalut);
+                    }
+                    else if (annot is StickyAnnotArgs)
+                    {
+                        var color = (annot as StickyAnnotArgs).Color;
+                        Settings.Default.AppProperties.Annotate.NoteAnnoteColor = color;
+                        var StickyDefalut = GetAnnotDefault(AnnotArgsType.AnnotSticky);
+                        StickyDefalut.ForgoundColor = color;
+
+                        SettingHelper.SetAnnotDefaultProperty(StickyDefalut);
+                    }
+                    else if (annot is SquareAnnotArgs)
+                    {
+                        var square = annot as SquareAnnotArgs;
+                        var bgColor = square.BgColor;
+                        Settings.Default.AppProperties.Annotate.RectangleFillColor = bgColor;
+                        var borderColor = square.LineColor;
+                        Settings.Default.AppProperties.Annotate.RectangleBorderColor = borderColor;
+
+                        var SquareDefalut = GetAnnotDefault(AnnotArgsType.AnnotSquare);
+                        SquareDefalut.BorderColor = borderColor;
+                        SquareDefalut.BackgroundColor = bgColor;
+                        SquareDefalut.Opacity = square.Transparency;
+                        SquareDefalut.Thickness = square.LineWidth;
+
+                        var isSolid = AnnotTransfer.IsSolidStyle(square.LineDash);
+                        if (isSolid)
+                        {
+                            SquareDefalut.DashArray = null;
+                        }
+                        else
+                        {
+                            SquareDefalut.DashArray = new List<double>();
+                            foreach (var item in square.LineDash.Dashes)
+                            {
+                                SquareDefalut.DashArray.Add(item);
+                            }
+                        }
+
+                        SettingHelper.SetAnnotDefaultProperty(SquareDefalut);
+                    }
+                    else if (annot is CircleAnnotArgs)
+                    {
+                        var circle = annot as CircleAnnotArgs;
+                        var bgColor = circle.BgColor;
+                        Settings.Default.AppProperties.Annotate.CircleFillColor = bgColor;
+                        var borderColor = circle.LineColor;
+                        Settings.Default.AppProperties.Annotate.CircleBorderColor = borderColor;
+
+                        var CircleDefalut = GetAnnotDefault(AnnotArgsType.AnnotCircle);
+                        CircleDefalut.BorderColor = borderColor;
+                        CircleDefalut.BackgroundColor = bgColor;
+                        CircleDefalut.Opacity = circle.Transparency;
+                        CircleDefalut.Thickness = circle.LineWidth;
+
+                        var isSolid = AnnotTransfer.IsSolidStyle(circle.LineDash);
+                        if (isSolid)
+                        {
+                            CircleDefalut.DashArray = null;
+                        }
+                        else
+                        {
+                            CircleDefalut.DashArray = new List<double>();
+                            foreach (var item in circle.LineDash.Dashes)
+                            {
+                                CircleDefalut.DashArray.Add(item);
+                            }
+                        }
+
+                        SettingHelper.SetAnnotDefaultProperty(CircleDefalut);
+                    }
+                    else if (annot is LineAnnotArgs)
+                    {
+                        var line = (annot as LineAnnotArgs);
+                        var color = (annot as LineAnnotArgs).LineColor;
+                        Settings.Default.AppProperties.Annotate.LineColor = color;
+
+                        var lineDefalut = GetAnnotDefault(AnnotArgsType.AnnotLine);
+                        lineDefalut.BorderColor = color;
+                        lineDefalut.Opacity = (annot as LineAnnotArgs).Transparency;
+                        lineDefalut.Thickness = (annot as LineAnnotArgs).LineWidth;
+
+                        var isSolid = AnnotTransfer.IsSolidStyle(line.LineDash);
+                        if (isSolid)
+                        {
+                            lineDefalut.DashArray = null;
+                        }
+                        else
+                        {
+                            lineDefalut.DashArray = new List<double>();
+                            foreach (var item in line.LineDash.Dashes)
+                            {
+                                lineDefalut.DashArray.Add(item);
+                            }
+                        }
+
+                        SettingHelper.SetAnnotDefaultProperty(lineDefalut);
+                    }
+
+                    Settings.Default.Save();
+                }
+            }
+        }
+
+        private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType)
+        {
+            var Annot = SettingHelper.GetAnnotDefaultProperty(annotArgsType);
+            if (Annot == null)
+            {
+                Annot = new DefaultAnnotProperty();
+                Annot.AnnotToolType = annotArgsType;
+            }
+            return Annot;
+        }
+
+        private System.Windows.Controls.Primitives.Popup popup = null;
+
+        //更改颜色
+        private async void AnnotColorPalette_Menu(object obj)
+        {
+            if (obj as CusMenuItem != null)
+            {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as AnnotHandlerEventArgs;
+                if (annot != null)
+                {
+                    var item = new ColorDropBoxPop();
+                    item.DataContext = menu;
+                    item.ColorSelected -= AnnotMenu_ColorSelected;
+                    item.ColorSelected += AnnotMenu_ColorSelected;
+
+                    if (popup == null)
+                        popup = new System.Windows.Controls.Primitives.Popup();
+
+                    ContentControl window = null;
+                    if (PDFViewer.Parent as ContentControl != null)
+                        window = PDFViewer.Parent as ContentControl;
+                    else
+                        window = App.Current.MainWindow;
+
+                    popup.Child = item;
+                    popup.PlacementRectangle = new Rect(Mouse.GetPosition(window), new Size(item.Width, item.Height));
+                    popup.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint;
+                    popup.PlacementTarget = window;
+                    popup.IsOpen = true;
+
+                    Window parentWnd = Window.GetWindow(App.Current.MainWindow);
+                    if (parentWnd != null)
+                    {
+                        parentWnd.MouseDown -= parentWnd_MouseDown;
+                        parentWnd.MouseDown += parentWnd_MouseDown;
+                    }
+
+                    while (popup.IsOpen)
+                        await Task.Delay(20);
+
+                    parentWnd.MouseDown -= parentWnd_MouseDown;
+                    popup = null;
+                }
+            }
+        }
+
+        private void parentWnd_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            var ui = Mouse.DirectlyOver as FrameworkElement;
+            if (ui != null)
+            {
+                if (popup != null)
+                {
+                    popup.IsOpen = false;
+                }
+            }
+        }
+
+        private void AnnotMenu_ColorSelected(object sender, Color e)
+        {
+            if (sender != null)
+            {
+                var menu = (sender as FrameworkElement).DataContext as CusMenuItem;
+                if (menu == null) return;
+
+                var annot = menu.Parameter as AnnotHandlerEventArgs;
+                if (annot != null)
+                {
+                    if (annot is FreehandAnnotArgs || annot is StickyAnnotArgs || annot is LineAnnotArgs)
+                    {
+                        var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.Color, e);
+                        AnnotEvent?.UpdateAnnot();
+                    }
+                    else if (annot is FreeTextAnnotArgs)
+                    {
+                        var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
+                        if (menu.tag.ToString() == "FontColor")
+                            AnnotEvent?.UpdateAttrib(AnnotAttrib.FontColor, e);
+                        else
+                            AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, e);
+
+                        AnnotEvent?.UpdateAnnot();
+                    }
+                    else if (annot is SquareAnnotArgs || annot is CircleAnnotArgs)
+                    {
+                        var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
+                        if (menu.tag.ToString() == "FillColor")
+                            AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, e);
+                        else
+                            AnnotEvent?.UpdateAttrib(AnnotAttrib.Color, e);
+
+                        AnnotEvent?.UpdateAnnot();
+                    }
+                    else if (annot is TextHighlightAnnotArgs || annot is TextUnderlineAnnotArgs || annot is TextStrikeoutAnnotArgs)
+                    {
+                        var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.Color, e);
+                        AnnotEvent?.UpdateAnnot();
+                    }
+                }
+            }
+        }
+
+        //添加笔记
+        private void AnnotAddNoteText_Menu(object obj)
+        {
+            if (obj as CusMenuItem != null)
+            {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as AnnotHandlerEventArgs;
+                PopAnnotNoteText(annot);
+            }
+        }
+
+        private void PopAnnotNoteText(AnnotHandlerEventArgs annot)
+        {
+            if (annot != null)
+            {
+                AnnotationHandlerEventArgs args = new AnnotationHandlerEventArgs();
+
+                args.ClientRect = annot.ClientRect;
+                args.AnnotHandlerEventArgs = annot;
+                args.PageIndex = annot.PageIndex;
+                args.AnnotIndex = annot.AnnotIndex;
+                args.EventType = annot.EventType;
+                args.CreateTime = annot.CreateTime;
+                args.UpdateTime = annot.UpdateTime;
+                args.Content = annot.Content;
+                args.MarkupContent = annot.MarkupContent;
+                args.Author = annot.Author;
+                args.Locked = annot.Locked;
+                args.ReadOnly = annot.ReadOnly;
+                args.FormField = annot.FormField;
+                args.Document = PDFViewer.Document;
+
+                DialogParameters value = new DialogParameters();
+                value.Add(ParameterNames.Annotation, args);
+                dialogs.ShowDialog(DialogNames.AddAnnotationDialog, value, e =>
+                {
+                    if (e.Result == ButtonResult.OK && e.Parameters != null)
+                    {
+                        PDFViewer.UndoManager.CanSave = true;
+                        if (e.Parameters.ContainsKey(ParameterNames.Annotation) && e.Parameters.ContainsKey(ParameterNames.AnnotEvent))
+                        {
+                            AnnotationHandlerEventArgs annotation = e.Parameters.GetValue<AnnotationHandlerEventArgs>(ParameterNames.Annotation);
+                            //RefreshOneListItem(annotation.AnnotHandlerEventArgs);
+                            events.GetEvent<RefreshAnnotEvent>().Publish(new RefreshAnnotArgs() { Unicode = App.mainWindowViewModel.SelectedItem.Unicode, Annotation = annotation });
+                        }
+                    }
+                });
+            }
+        }
+
+        //手绘
+        private void FreeHandLineStyle_Menu(object obj)
+        {
+            if (obj as CusMenuItem != null)
+            {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as FreehandAnnotArgs;
+                if (annot != null)
+                {
+                    var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
+                    if (menu.tag.ToString() == "Solid")
+                    {
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, AnnotTransfer.GetLineDashStyle(true));
+                    }
+                    else
+                    {
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, AnnotTransfer.GetLineDashStyle(false));
+                    }
+
+                    AnnotEvent?.UpdateAnnot();
+                }
+            }
+        }
+
+        //文本
+
+        private void FreeTextFontFamily_Menu(object obj)
+        {
+            if (obj as CusMenuItem != null)
+            {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as AnnotHandlerEventArgs;
+                if (annot != null)
+                {
+                    var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
+                    AnnotEvent?.UpdateAttrib(AnnotAttrib.FontFamily, new FontFamily(menu.tag.ToString()));
+                    AnnotEvent?.UpdateAnnot();
+                }
+            }
+        }
+
+        private void FreeTextAglin_Menu(object obj)
+        {
+            if (obj as CusMenuItem != null)
+            {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as AnnotHandlerEventArgs;
+                var tag = menu.control.Tag;
+                if (annot != null && tag != null)
+                {
+                    var strTag = tag.ToString();
+
+                    var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
+                    if (strTag == "Left")
+                    {
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.TextAlign, TextAlignment.Left);
+                    }
+                    else if (strTag == "Center")
+                    {
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.TextAlign, TextAlignment.Center);
+                    }
+                    else if (strTag == "Right")
+                    {
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.TextAlign, TextAlignment.Right);
+                    }
+                    else if (strTag == "Justify")
+                    {
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.TextAlign, TextAlignment.Justify);
+                    }
+
+                    AnnotEvent?.UpdateAnnot();
+                }
+            }
+        }
+
+        //便签
+
+        private void StrikeNoteEditStrike_Menu(object obj)
+        {
+            if (obj as CusMenuItem != null)
+            {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as AnnotHandlerEventArgs;
+                if (annot != null)
+                {
+                    var sticky = annot as StickyAnnotArgs;
+                    sticky.PopupEditWnd();
+
+                    #region 设计重新调整,阅读页空白处,右键菜单,添加链接需要显示,其他和pro mac一样的效果,不显示属性栏
+
+                    //isRightMenuAddAnnot = false;
+
+                    #endregion 设计重新调整,阅读页空白处,右键菜单,添加链接需要显示,其他和pro mac一样的效果,不显示属性栏
+                }
+            }
+        }
+
+        //形状
+
+        private void ShapeLineStyle_Menu(object obj)
+        {
+            if (obj as CusMenuItem != null)
+            {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as AnnotHandlerEventArgs;
+                var tag = menu.control.Tag;
+                if (annot != null && tag != null)
+                {
+                    var strTag = tag.ToString();
+                    var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
+                    if (strTag == "Solid")
+                    {
+                        var dashStyle = AnnotTransfer.GetLineDashStyle(true);
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, dashStyle);
+                    }
+                    else
+                    {
+                        var dashStyle = AnnotTransfer.GetLineDashStyle(false);
+                        AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, dashStyle);
+                    }
+                    AnnotEvent?.UpdateAnnot();
+                }
+            }
+        }
+
+        private void ShapeLineDirect_Menu(object obj)
+        {
+            if (obj as CusMenuItem != null)
+            {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as LineAnnotArgs;
+                var tag = menu.control.Tag;
+                if (annot != null && tag != null)
+                {
+                    var strTag = tag.ToString();
+                    var AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annot.GetAnnotAttrib());
+                    if (strTag == "Ver")
+                    {
+                        annot.SetLineVertical();
+                    }
+                    else
+                    {
+                        annot.SetLineHorizontal();
+                    }
+                }
+            }
+        }
+
+        private void Link_Menu(object obj)
+        {
+            if (obj is CusMenuItem menuItem)
+            {
+                if (menuItem.Parameter is LinkAnnotArgs linkAnnotArgs)
+                {
+                    var result = PDFViewer.RemovePageAnnot(linkAnnotArgs.PageIndex, linkAnnotArgs.AnnotIndex);
+                    if (result)
+                    {
+                        viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                        bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
+                        if (isTabItemAnnotation)
+                        {
+                            AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out AnnotationContent annotation);
+                            if (viewModel != null)
+                            {
+                                viewModel.UpdateModifiedAnnot(linkAnnotArgs.PageIndex, linkAnnotArgs.AnnotIndex, true);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        //图章
+        private void StampExportPicture_Menu(object obj)
+        {
+            if (obj as CusMenuItem != null)
+            {
+                var menu = obj as CusMenuItem;
+                var annot = menu.Parameter as StampAnnotArgs;
+                if (annot != null)
+                {
+                    Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
+                    var format = menu.tag.ToString();
+                    if (format == "PDF")
+                        dlg.Filter = "PDF|*.pdf";
+                    else
+                        dlg.Filter = format + "|*." + format.ToLower();
+
+                    dlg.DefaultExt = "." + menu.tag.ToString().ToLower();
+                    dlg.FileName = PDFViewer.Document.FileName;
+                    if (dlg.ShowDialog() == true)
+                    {
+                        var stampPicture = dlg.FileName;
+                        if (menu.tag.ToString() == "PDF")
+                        {
+                            var writeStamp = annot.GetStampDrawing();
+                            var tempDoc = new CPDFViewer();
+                            tempDoc.CreateDocument();
+                            if (tempDoc.Document == null)
+                            {
+                                AlertsMessage alertsMessage = new AlertsMessage();
+                                alertsMessage.ShowDialog("", "创建文件失败.", "OK");
+                                return;
+                            }
+                            byte[] buffer;
+                            var encoder = new PngBitmapEncoder();
+                            encoder.Frames.Add(BitmapFrame.Create(writeStamp));
+                            using (var memoryStream = new MemoryStream())
+                            {
+                                encoder.Save(memoryStream);
+                                buffer = memoryStream.ToArray();
+                            }
+
+                            tempDoc.Document.InsertPage(0, writeStamp.PixelWidth, writeStamp.PixelHeight, buffer, CPDFDocumentImageMode.CPDFDocumentImageModeScaleAspectFit);
+                            var result = tempDoc.Document.WriteToFilePath(dlg.FileName);
+                            if (result)
+                            {
+                            }
+                        }
+                        else
+                        {
+                            var writeStamp = annot.GetStampDrawing();
+                            using (FileStream stream5 = new FileStream(stampPicture, FileMode.Create))
+                            {
+                                PngBitmapEncoder encoder5 = new PngBitmapEncoder();
+                                encoder5.Frames.Add(BitmapFrame.Create(writeStamp));
+                                encoder5.Save(stream5);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        #endregion 注释右键菜单事件
+
         #region 快捷键
 
         private void ShortCut_KeyDown(object sender, KeyEventArgs e)
         {
             if (KeyEventsHelper.IsSingleKey(Key.Escape))
             {
-                BtnHandIsChecked = true;
-                PDFViewer.SetMouseMode(MouseModes.Scroll);
+                //BtnHandIsChecked = true;
+                PDFViewer.SetMouseMode(MouseModes.PanTool);
                 PDFViewer.ClearSelectAnnots();
                 StrAnnotToolChecked = "";
                 ShowPropertyPanel(false);

+ 1 - 1
PDF Office/Views/BOTA/AnnotationContent.xaml.cs

@@ -292,7 +292,7 @@ namespace PDF_Office.Views.BOTA
             var a3 = (e.Source as ListBox).SelectedItems.Count;
             if (a1 == 1)
             {
-                viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute((sender as ListBox).SelectedItem);
+                viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute((sender as ListBox).SelectedItems[0]);
             }
             else if (a1 > 1)
             {

+ 2 - 2
PDF Office/Views/PropertyPanel/AnnotPanel/FreehandAnnotProperty.xaml

@@ -222,7 +222,7 @@
                         CommandParameter="{Binding ElementName=BtnSolid, Path=Tag}"
                         Foreground="#616469"
                         GroupName="LineMode"
-                        IsChecked="{Binding BasicVm.IsSolidLine,Mode=TwoWay}"
+                        IsChecked="{Binding BasicVm.IsSolidLine, Mode=TwoWay}"
                         Style="{DynamicResource GreyBgRadioBtnStyle}"
                         Tag="Solid">
                         <RadioButton.Content>
@@ -247,7 +247,7 @@
                         CommandParameter="{Binding ElementName=BtnDashed, Path=Tag}"
                         Foreground="#616469"
                         GroupName="LineMode"
-                        IsChecked="{Binding BasicVm.IsDashLine,Mode=TwoWay}"
+                        IsChecked="{Binding BasicVm.IsDashLine, Mode=TwoWay}"
                         Style="{DynamicResource GreyBgRadioBtnStyle}"
                         Tag="Dashed">
                         <RadioButton.Content>

+ 159 - 70
PDF Office/Views/PropertyPanel/AnnotPanel/SharpsAnnotProperty.xaml

@@ -5,17 +5,17 @@
     xmlns:CompositeControl="clr-namespace:PDF_Office.CustomControl.CompositeControl"
     xmlns:Convert="clr-namespace:PDF_Office.DataConvert"
     xmlns:DashConvert="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel"
+    xmlns:convert="clr-namespace:PDF_Office.Views.Tools"
     xmlns:cus="clr-namespace:PDF_Office.CustomControl"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
     xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
-    xmlns:convert="clr-namespace:PDF_Office.Views.Tools"
-    d:DesignHeight="450"
+    d:DesignHeight="800"
     d:DesignWidth="260"
-    Background="{StaticResource color.sys.layout.mg}"
     prism:ViewModelLocator.AutoWireViewModel="True"
+    Background="{StaticResource color.sys.layout.mg}"
     mc:Ignorable="d">
     <UserControl.Resources>
         <ResourceDictionary>
@@ -25,7 +25,7 @@
             </ResourceDictionary.MergedDictionaries>
             <Convert:ColorToBrushConverter x:Key="ColorToBrushConvert" />
             <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert" />
-            <convert:AnnotToolIsCheckedConvert x:Key="AnnotToolIsCheckedConvert"/>
+            <convert:AnnotToolIsCheckedConvert x:Key="AnnotToolIsCheckedConvert" />
             <DashConvert:DashStyleConverter x:Key="DashStyleConverter" />
             <Convert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert" />
             <Style x:Key="line1Style" TargetType="{x:Type Line}">
@@ -79,7 +79,7 @@
                 BorderBrush="#DDDDDD"
                 BorderThickness="1"
                 CornerRadius="2"
-                Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}">
+                Visibility="{Binding BasicVm.IsMultiSelected, Converter={StaticResource InvertBoolToVisibleConvert}}">
                 <Grid>
                     <Path
                         Name="SharpPath"
@@ -103,9 +103,10 @@
                 Width="162"
                 Height="32"
                 Margin="0,12,0,0"
+                HorizontalAlignment="Left"
                 BorderBrush="#FFE2E3E6"
-                BorderThickness="0"  HorizontalAlignment="Left"
-                Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}">
+                BorderThickness="0"
+                Visibility="{Binding BasicVm.IsMultiSelected, Converter={StaticResource InvertBoolToVisibleConvert}}">
                 <Grid Name="ToolGrid">
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="40.5" />
@@ -114,11 +115,19 @@
                         <ColumnDefinition Width="40.5" />
                     </Grid.ColumnDefinitions>
 
-                    <RadioButton x:Name="SharpRectBtn" Tag="Rect" GroupName="Shape"
-                                 Width="32" Height="32" Margin="0,0" ToolTip="矩形" Padding="7,0,0,0"
-                                 VerticalContentAlignment="Center" Background="Transparent"
-                                 IsChecked="{Binding IsRect}"
-                                 Style="{DynamicResource GreyBgRadioBtnStyle}">
+                    <RadioButton
+                        x:Name="SharpRectBtn"
+                        Width="32"
+                        Height="32"
+                        Margin="0,0"
+                        Padding="7,0,0,0"
+                        VerticalContentAlignment="Center"
+                        Background="Transparent"
+                        GroupName="Shape"
+                        IsChecked="{Binding IsRect}"
+                        Style="{DynamicResource GreyBgRadioBtnStyle}"
+                        Tag="Rect"
+                        ToolTip="矩形">
                         <RadioButton.Content>
                             <Rectangle
                                 Width="16"
@@ -129,16 +138,25 @@
                         </RadioButton.Content>
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
-                                <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}"  CommandParameter="{Binding ElementName=SharpRectBtn, Path=Tag}"/>
+                                <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpRectBtn, Path=Tag}" />
                             </i:EventTrigger>
                         </i:Interaction.Triggers>
                     </RadioButton>
 
-                    <RadioButton x:Name="SharpCircleBtn" Tag="Circle" GroupName="Shape"  Grid.Column="1"
-                                 Width="32" Height="32" Margin="0,0" ToolTip="圆" Padding="7,0,0,0"
-                                 VerticalContentAlignment="Center" Background="Transparent"
-                                 IsChecked="{Binding IsCircle}"
-                                 Style="{DynamicResource GreyBgRadioBtnStyle}">
+                    <RadioButton
+                        x:Name="SharpCircleBtn"
+                        Grid.Column="1"
+                        Width="32"
+                        Height="32"
+                        Margin="0,0"
+                        Padding="7,0,0,0"
+                        VerticalContentAlignment="Center"
+                        Background="Transparent"
+                        GroupName="Shape"
+                        IsChecked="{Binding IsCircle}"
+                        Style="{DynamicResource GreyBgRadioBtnStyle}"
+                        Tag="Circle"
+                        ToolTip="圆">
                         <RadioButton.Content>
                             <Ellipse
                                 Width="16"
@@ -149,16 +167,25 @@
                         </RadioButton.Content>
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
-                                <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}"  CommandParameter="{Binding ElementName=SharpCircleBtn, Path=Tag}"/>
+                                <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpCircleBtn, Path=Tag}" />
                             </i:EventTrigger>
                         </i:Interaction.Triggers>
                     </RadioButton>
 
-                    <RadioButton x:Name="SharpArrowBtn" Tag="Arrow" GroupName="Shape"  Grid.Column="2"
-                                 Width="32" Height="32" Margin="0,0" ToolTip="箭头" Padding="7,0,0,0"
-                                 VerticalContentAlignment="Center" Background="Transparent"
-                                 IsChecked="{Binding IsArrow}"
-                                 Style="{DynamicResource GreyBgRadioBtnStyle}">
+                    <RadioButton
+                        x:Name="SharpArrowBtn"
+                        Grid.Column="2"
+                        Width="32"
+                        Height="32"
+                        Margin="0,0"
+                        Padding="7,0,0,0"
+                        VerticalContentAlignment="Center"
+                        Background="Transparent"
+                        GroupName="Shape"
+                        IsChecked="{Binding IsArrow}"
+                        Style="{DynamicResource GreyBgRadioBtnStyle}"
+                        Tag="Arrow"
+                        ToolTip="箭头">
                         <RadioButton.Content>
                             <Path
                                 Width="16"
@@ -173,15 +200,24 @@
                         </RadioButton.Content>
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
-                                <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}"  CommandParameter="{Binding ElementName=SharpArrowBtn, Path=Tag}"/>
+                                <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpArrowBtn, Path=Tag}" />
                             </i:EventTrigger>
                         </i:Interaction.Triggers>
                     </RadioButton>
 
-                    <RadioButton x:Name="SharpLineBtn" Tag="Line" GroupName="Shape"  Grid.Column="3"
-                                 Width="32" Height="32" Margin="0,0" ToolTip="线条" Padding="7,8,0,0"
-                                 IsChecked="{Binding IsLine}" Background="Transparent"
-                                 Style="{DynamicResource GreyBgRadioBtnStyle}">
+                    <RadioButton
+                        x:Name="SharpLineBtn"
+                        Grid.Column="3"
+                        Width="32"
+                        Height="32"
+                        Margin="0,0"
+                        Padding="7,8,0,0"
+                        Background="Transparent"
+                        GroupName="Shape"
+                        IsChecked="{Binding IsLine}"
+                        Style="{DynamicResource GreyBgRadioBtnStyle}"
+                        Tag="Line"
+                        ToolTip="线条">
                         <RadioButton.Content>
                             <Polygon
                                 Width="16"
@@ -196,35 +232,46 @@
                         </RadioButton.Content>
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="Checked">
-                                <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}"  CommandParameter="{Binding ElementName=SharpLineBtn, Path=Tag}"/>
+                                <i:InvokeCommandAction Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpLineBtn, Path=Tag}" />
                             </i:EventTrigger>
                         </i:Interaction.Triggers>
                     </RadioButton>
                 </Grid>
             </Border>
 
-            <Grid x:Name="GridFill" Margin="0,18,0,0" Visibility="{Binding IsLineAnnot,Converter={StaticResource InvertBoolToVisibleConvert}}">
+            <Grid
+                x:Name="GridFill"
+                Margin="0,18,0,0"
+                Visibility="{Binding IsLineAnnot, Converter={StaticResource InvertBoolToVisibleConvert}}">
                 <Grid.RowDefinitions>
                     <RowDefinition Height="auto" />
                     <RowDefinition />
                 </Grid.RowDefinitions>
-                <TextBlock Text="Fill" Foreground="{StaticResource color.sys.text.neutral.lv2}" VerticalAlignment="Center" />
-                <CompositeControl:SlidContent x:Name="layerFill" HorizontalAlignment="Right"
-                                              InitValue="{Binding BasicVm.FillOpacity,Mode=OneWay}"
-                                              Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}">
+                <TextBlock
+                    VerticalAlignment="Center"
+                    Foreground="{StaticResource color.sys.text.neutral.lv2}"
+                    Text="Fill" />
+                <CompositeControl:SlidContent
+                    x:Name="layerFill"
+                    HorizontalAlignment="Right"
+                    InitValue="{Binding BasicVm.FillOpacity, Mode=OneWay}"
+                    Visibility="{Binding BasicVm.IsMultiSelected, Converter={StaticResource InvertBoolToVisibleConvert}}">
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="SelectedValueChanged">
-                            <i:InvokeCommandAction Command="{Binding SelectedOpacityValueCommand}" CommandParameter="{Binding ElementName=layerFill,Path=Value}" />
+                            <i:InvokeCommandAction Command="{Binding SelectedOpacityValueCommand}" CommandParameter="{Binding ElementName=layerFill, Path=Value}" />
                         </i:EventTrigger>
                     </i:Interaction.Triggers>
                 </CompositeControl:SlidContent>
-                <CompositeControl:ColorContent x:Name="cusFillColor" Grid.Row="1" Margin="0,8,0,0"
-                                               ItemSource="{Binding BasicVm.FillColorItems}"
-                                               ColorType="Fill"
-                                               UIColor="{Binding BasicVm.CurrentFillColor,Mode=OneWay}">
+                <CompositeControl:ColorContent
+                    x:Name="cusFillColor"
+                    Grid.Row="1"
+                    Margin="0,8,0,0"
+                    ColorType="Fill"
+                    ItemSource="{Binding BasicVm.FillColorItems}"
+                    UIColor="{Binding BasicVm.CurrentFillColor, Mode=OneWay}">
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="SelectedColorInvoke">
-                            <i:InvokeCommandAction Command="{Binding SelectedFillColorCommand}" CommandParameter="{Binding ElementName=cusFillColor,Path=SelectedColor}" />
+                            <i:InvokeCommandAction Command="{Binding SelectedFillColorCommand}" CommandParameter="{Binding ElementName=cusFillColor, Path=SelectedColor}" />
                         </i:EventTrigger>
                     </i:Interaction.Triggers>
                 </CompositeControl:ColorContent>
@@ -235,60 +282,102 @@
                     <RowDefinition Height="auto" />
                     <RowDefinition />
                 </Grid.RowDefinitions>
-                <TextBlock Text="Border" Foreground="{StaticResource color.sys.text.neutral.lv2}" VerticalAlignment="Center" />
-                <CompositeControl:SlidContent x:Name="layerThick" HorizontalAlignment="Right"
-                                              InitValue="{Binding BasicVm.FillOpacity,Mode=OneWay}"
-                                              Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}">
+                <TextBlock
+                    VerticalAlignment="Center"
+                    Foreground="{StaticResource color.sys.text.neutral.lv2}"
+                    Text="Border" />
+                <CompositeControl:SlidContent
+                    x:Name="layerThick"
+                    HorizontalAlignment="Right"
+                    InitValue="{Binding BasicVm.FillOpacity, Mode=OneWay}"
+                    Visibility="{Binding BasicVm.IsMultiSelected, Converter={StaticResource InvertBoolToVisibleConvert}}">
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="SelectedValueChanged">
-                            <i:InvokeCommandAction Command="{Binding SelectedOpacityValueCommand}" CommandParameter="{Binding ElementName=layerThick,Path=Value}" />
+                            <i:InvokeCommandAction Command="{Binding SelectedOpacityValueCommand}" CommandParameter="{Binding ElementName=layerThick, Path=Value}" />
                         </i:EventTrigger>
                     </i:Interaction.Triggers>
                 </CompositeControl:SlidContent>
 
-                <CompositeControl:ColorContent x:Name="cusColor" Grid.Row="1" Margin="0,8,0,0"
-                                               ItemSource="{Binding BasicVm.ColorItems}"
-                                               ColorType="Border"
-                                               UIColor="{Binding BasicVm.CurrentBorderColor,Mode=OneWay}">
+                <CompositeControl:ColorContent
+                    x:Name="cusColor"
+                    Grid.Row="1"
+                    Margin="0,8,0,0"
+                    ColorType="Border"
+                    ItemSource="{Binding BasicVm.ColorItems}"
+                    UIColor="{Binding BasicVm.CurrentBorderColor, Mode=OneWay}">
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="SelectedColorInvoke">
-                            <i:InvokeCommandAction Command="{Binding SelectedBorderColorCommand}" CommandParameter="{Binding ElementName=cusColor,Path=SelectedColor}" />
+                            <i:InvokeCommandAction Command="{Binding SelectedBorderColorCommand}" CommandParameter="{Binding ElementName=cusColor, Path=SelectedColor}" />
                         </i:EventTrigger>
                     </i:Interaction.Triggers>
                 </CompositeControl:ColorContent>
             </Grid>
 
-            <CompositeControl:SlidComboControl x:Name="thickness" Margin="0,0,0,0"  ItemsSource="{Binding ThicknessItems}" Value="{Binding  BasicVm.AnnotThickness,Mode=TwoWay}">
+            <CompositeControl:SlidComboControl
+                x:Name="thickness"
+                Margin="0,0,0,0"
+                ItemsSource="{Binding ThicknessItems}"
+                Value="{Binding BasicVm.AnnotThickness, Mode=TwoWay}">
                 <i:Interaction.Triggers>
                     <i:EventTrigger EventName="ValueChanged">
-                        <i:InvokeCommandAction Command="{Binding SelectedThickCommand}" CommandParameter="{Binding ElementName=thickness,Path=Value}" />
+                        <i:InvokeCommandAction Command="{Binding SelectedThickCommand}" CommandParameter="{Binding ElementName=thickness, Path=Value}" />
                     </i:EventTrigger>
                 </i:Interaction.Triggers>
             </CompositeControl:SlidComboControl>
 
-            <StackPanel  x:Name="PnlLineStyle" Orientation="Horizontal" Margin="0,20,0,0">
+            <StackPanel
+                x:Name="PnlLineStyle"
+                Margin="0,20,0,0"
+                Orientation="Horizontal">
 
-                <RadioButton x:Name="BtnSolid" Tag="Solid" GroupName="LineMode"
-                             Width="105" Height="32" Margin="0,0,10,0" Foreground="#616469"
-                             VerticalContentAlignment="Center" Background="Transparent"
-                             Command="{Binding LineStyleCommand}"
-                             CommandParameter="{Binding ElementName=BtnSolid, Path=Tag}"
-                             IsChecked="{Binding BasicVm.IsSolidLine}"
-                             Style="{DynamicResource GreyBgRadioBtnStyle}">
+                <RadioButton
+                    x:Name="BtnSolid"
+                    Width="105"
+                    Height="32"
+                    Margin="0,0,10,0"
+                    VerticalContentAlignment="Center"
+                    Background="Transparent"
+                    Command="{Binding LineStyleCommand}"
+                    CommandParameter="{Binding ElementName=BtnSolid, Path=Tag}"
+                    Foreground="#616469"
+                    GroupName="LineMode"
+                    IsChecked="{Binding BasicVm.IsSolidLine}"
+                    Style="{DynamicResource GreyBgRadioBtnStyle}"
+                    Tag="Solid">
                     <RadioButton.Content>
-                        <Line X1="10" Y1="5" X2="90" Y2="5" Stroke="Black" StrokeThickness="2" />
+                        <Line
+                            Stroke="Black"
+                            StrokeThickness="2"
+                            X1="10"
+                            X2="90"
+                            Y1="5"
+                            Y2="5" />
                     </RadioButton.Content>
                 </RadioButton>
 
-                <RadioButton x:Name="BtnDashed" Tag="Dashed" GroupName="LineMode"
-                             Width="105" Height="32" Margin="0,0" Foreground="#616469"
-                             VerticalContentAlignment="Center" Background="Transparent"
-                             Command="{Binding LineStyleCommand}"
-                             CommandParameter="{Binding ElementName=BtnDashed, Path=Tag}"
-                             IsChecked="{Binding BasicVm.IsDashLine}"
-                             Style="{DynamicResource GreyBgRadioBtnStyle}">
+                <RadioButton
+                    x:Name="BtnDashed"
+                    Width="105"
+                    Height="32"
+                    Margin="0,0"
+                    VerticalContentAlignment="Center"
+                    Background="Transparent"
+                    Command="{Binding LineStyleCommand}"
+                    CommandParameter="{Binding ElementName=BtnDashed, Path=Tag}"
+                    Foreground="#616469"
+                    GroupName="LineMode"
+                    IsChecked="{Binding BasicVm.IsDashLine}"
+                    Style="{DynamicResource GreyBgRadioBtnStyle}"
+                    Tag="Dashed">
                     <RadioButton.Content>
-                        <Line X1="10" Y1="5" X2="90" Y2="5" Stroke="Black" StrokeThickness="2" StrokeDashArray="2" />
+                        <Line
+                            Stroke="Black"
+                            StrokeDashArray="2"
+                            StrokeThickness="2"
+                            X1="10"
+                            X2="90"
+                            Y1="5"
+                            Y2="5" />
                     </RadioButton.Content>
                 </RadioButton>
             </StackPanel>