Browse Source

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

ZhouJieSheng 2 years ago
parent
commit
b1f057181a

+ 7 - 0
PDF Office/PDF Office.csproj

@@ -377,7 +377,14 @@
     <Compile Include="ViewModels\EditTools\HeaderFooter\HeaderFooterTemplateListContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Redaction\RedactionContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Redaction\RedactionDocumentContentViewModel.cs" />
+    <Compile Include="ViewModels\Form\ButtonPropertyViewModel.cs" />
+    <Compile Include="ViewModels\Form\CheckBoxPropertyViewModel.cs" />
+    <Compile Include="ViewModels\Form\ComboxPropertyViewModel.cs" />
     <Compile Include="ViewModels\Form\FormsToolContentViewModel.cs" />
+    <Compile Include="ViewModels\Form\ListBoxPropertyViewModel.cs" />
+    <Compile Include="ViewModels\Form\RadioButtonPropertyViewModel.cs" />
+    <Compile Include="ViewModels\Form\SignPropertyViewModel.cs" />
+    <Compile Include="ViewModels\Form\TextFieldPropertyViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\PDFTools\PDFToolsContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\PDFTools\QuickToolsContentViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\SignatureAnnotPropertyViewModel.cs" />

+ 14 - 0
PDF Office/ViewModels/Form/ButtonPropertyViewModel.cs

@@ -0,0 +1,14 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.Form
+{
+    public class ButtonPropertyViewModel : BindableBase
+    {
+
+    }
+}

+ 13 - 0
PDF Office/ViewModels/Form/CheckBoxPropertyViewModel.cs

@@ -0,0 +1,13 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.Form
+{
+    public class CheckBoxPropertyViewModel : BindableBase
+    {
+    }
+}

+ 13 - 0
PDF Office/ViewModels/Form/ComboxPropertyViewModel.cs

@@ -0,0 +1,13 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.Form
+{
+    public class ComboxPropertyViewModel: BindableBase
+    {
+    }
+}

+ 13 - 0
PDF Office/ViewModels/Form/ListBoxPropertyViewModel.cs

@@ -0,0 +1,13 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.Form
+{
+    public class ListBoxPropertyViewModel: BindableBase
+    {
+    }
+}

+ 13 - 0
PDF Office/ViewModels/Form/RadioButtonPropertyViewModel.cs

@@ -0,0 +1,13 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.Form
+{
+    public class RadioButtonPropertyViewModel: BindableBase
+    {
+    }
+}

+ 13 - 0
PDF Office/ViewModels/Form/SignPropertyViewModel.cs

@@ -0,0 +1,13 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.Form
+{
+    public class SignPropertyViewModel : BindableBase
+    {
+    }
+}

+ 17 - 0
PDF Office/ViewModels/Form/TextFieldPropertyViewModel.cs

@@ -0,0 +1,17 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.Form
+{
+    public class TextFieldPropertyViewModel : BindableBase
+    {
+        public TextFieldPropertyViewModel()
+        {
+            
+        }
+    }
+}

+ 348 - 313
PDF Office/ViewModels/PropertyPanel/TextEditPropertyViewModel.cs

@@ -23,72 +23,41 @@ namespace PDF_Office.ViewModels.PropertyPanel
         #region 属性
 
         #region 编辑PDF全局
+        //多选时,选中的既是文本也是图像
+        private bool _isSelectTextAndImg = false;
+        public bool IsSelectTextAndImg{get { return _isSelectTextAndImg; } set {SetProperty(ref _isSelectTextAndImg, value);}}
 
+        //平均对齐布局
         private bool _isLayoutAvgAlign = false;
-        public bool IsLayoutAvgAlign
-        {
-            get { return _isLayoutAvgAlign; }
-            set
-            {
-                SetProperty(ref _isLayoutAvgAlign, value);
-
-            }
-        }
+        public bool IsLayoutAvgAlign { get { return _isLayoutAvgAlign; }set {SetProperty(ref _isLayoutAvgAlign, value); }}
+        //对齐布局
 
         private bool _isLayoutAlign = false;
-        public bool IsLayoutAlign
-        {
-            get { return _isLayoutAlign; }
-            set
-            {
-                SetProperty(ref _isLayoutAlign, value);
-
-            }
-        }
+        public bool IsLayoutAlign {get { return _isLayoutAlign; }set{SetProperty(ref _isLayoutAlign, value);}}
+        //是否为文本
 
         private bool _isTextEdit = true;
-        public bool IsTextEdit
-        {
-            get { return _isTextEdit; }
-            set
-            {
-                SetProperty(ref _isTextEdit, value);
-
-            }
-        }
+        public bool IsTextEdit {get { return _isTextEdit; }set{ SetProperty(ref _isTextEdit, value);} }
 
 
         #endregion
 
 
-
         #region 文本属性
 
         private double _angle;
-        public double Angle
-        {
-            get { return _angle; }
-            set
-            {
-                SetProperty(ref _angle, value);
-
-            }
-        }
+        public double Angle{ get { return _angle; }set{ SetProperty(ref _angle, value);}}
 
         private Brush selectColor = new SolidColorBrush(Colors.Black);
-        public Brush SelectColor
-        {
+        public Brush SelectColor {
             get { return selectColor; }
-            set
-            {
+            set{
                 SetProperty(ref selectColor, value);
 
                 if (TextEditEvent != null)
                 {
-                    bool isok = TextEditEvent.FontColor.A != (SelectColor as SolidColorBrush).Color.A ||
-                         TextEditEvent.FontColor.B != (SelectColor as SolidColorBrush).Color.B ||
-                         TextEditEvent.FontColor.G != (SelectColor as SolidColorBrush).Color.G ||
-                         TextEditEvent.FontColor.R != (SelectColor as SolidColorBrush).Color.R;
+                    bool isok = TextEditEvent.FontColor.A != (SelectColor as SolidColorBrush).Color.A ||TextEditEvent.FontColor.B != (SelectColor as SolidColorBrush).Color.B ||
+                         TextEditEvent.FontColor.G != (SelectColor as SolidColorBrush).Color.G ||TextEditEvent.FontColor.R != (SelectColor as SolidColorBrush).Color.R;
 
                     if (isok)
                     {
@@ -98,7 +67,6 @@ namespace PDF_Office.ViewModels.PropertyPanel
 
                 }
 
-
             }
         }
 
@@ -147,7 +115,6 @@ namespace PDF_Office.ViewModels.PropertyPanel
             }
         }
 
-
         private int fontSize = 24;
         public int TextFontSize
         {
@@ -187,7 +154,7 @@ namespace PDF_Office.ViewModels.PropertyPanel
             }
         }
 
-
+        //选中的图像
         private System.Windows.Media.Imaging.BitmapSource _currentImg;
         public System.Windows.Media.Imaging.BitmapSource CurrentImg
         {
@@ -203,9 +170,13 @@ namespace PDF_Office.ViewModels.PropertyPanel
 
         #endregion
 
-
         #region Command
 
+        #region 全局
+
+        public event EventHandler ClearCheckedAglin;
+        #endregion
+
         #region 文本Command
         public DelegateCommand AddTextCommand { get; set; }
         public DelegateCommand AddImgCommand { get; set; }
@@ -218,6 +189,8 @@ namespace PDF_Office.ViewModels.PropertyPanel
 
         public DelegateCommand<object> TextAlignCheckedCommand { get; set; }
 
+        public DelegateCommand EditTextModeCommand { get; set; }
+
         #endregion
 
         #region 图像Command
@@ -240,17 +213,19 @@ namespace PDF_Office.ViewModels.PropertyPanel
 
         #endregion
 
-        public event EventHandler ClearCheckedAglin;
+        #endregion
 
+        #region 变量
+        private PDFEditEvent TextEditEvent;
+        private CPDFViewer PDFViewer;
         #endregion
 
-        private ComPDFKitViewer.PDFEditEvent TextEditEvent;
+        #region 初始化
         public TextEditPropertyViewModel()
         {
             InitVariable();
             InitCommand();
         }
-
         private void InitVariable()
         {
             InitFontStyles();
@@ -276,6 +251,7 @@ namespace PDF_Office.ViewModels.PropertyPanel
             FontStyleChangedCommand = new DelegateCommand<object>(FontStyleChanged);
             FontSizeChangedCommand = new DelegateCommand<object>(FontSizeChanged);
             TextAlignCheckedCommand = new DelegateCommand<object>(TextAlignChecked);
+            EditTextModeCommand = new DelegateCommand(EditTextMode);
 
             AntiClockwiseCommand = new DelegateCommand(AntiClockwise);
             ClockwiseCommand = new DelegateCommand(Clockwise);
@@ -283,48 +259,153 @@ namespace PDF_Office.ViewModels.PropertyPanel
             CancelCropCommand = new DelegateCommand(CancelCropImg);
         }
 
-        private void ImgAlignChecked(object obj)
+        #endregion
+
+        #region 文本处理
+
+        private void AddText()
         {
-            if (obj != null)
+            PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditText);
+        }
+
+        private void EditTextMode()
+        {
+
+        }
+
+        private void TextAlignChecked(object obj)
+        {
+            if ((string)obj != null && TextEditEvent != null)
             {
-                switch((string)obj)
+                switch ((string)obj)
                 {
                     case "AlignLeft":
-                        PDFViewer.SetPDFEditAligment(AlignModes.AlignLeft);
+                        TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignLeft;
                         break;
-                    case "AlignHorizonCenter":
-                        PDFViewer.SetPDFEditAligment(AlignModes.AlignHorizonCenter);
+
+                    case "AlignCenter":
+                        TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignMiddle;
                         break;
+
                     case "AlignRight":
-                        PDFViewer.SetPDFEditAligment(AlignModes.AlignRight);
-                        break;
-                    case "DistributeHorizontal":
-                        PDFViewer.SetPDFEditAligment(AlignModes.DistributeHorizontal);
-                        break;
-                    case "AlignTop":
-                        PDFViewer.SetPDFEditAligment(AlignModes.AlignTop);
-                        break;
-                    case "AlignVerticalCenter":
-                        PDFViewer.SetPDFEditAligment(AlignModes.AlignVerticalCenter);
-                        break;
-                    case "AlignBottom":
-                        PDFViewer.SetPDFEditAligment(AlignModes.AlignBottom);
+                        TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignRight;
                         break;
-                    case "DistributeVertical":
-                        PDFViewer.SetPDFEditAligment(AlignModes.DistributeVertical);
+
+                    case "Align":
+                        TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignNone;
                         break;
                 }
-              
+                TextEditEvent.UpdatePDFEditByEventArgs();
+            }
+        }
+
+        private void Clockwise()
+        {
+            Angle = TextEditEvent.Rotate = TextEditEvent.Rotate + 90;
+            TextEditEvent.UpdatePDFEditByEventArgs();
+        }
+
+        private void AntiClockwise()
+        {
+            Angle = TextEditEvent.Rotate = TextEditEvent.Rotate - 90;
+            TextEditEvent.UpdatePDFEditByEventArgs();
+        }
+
+
+        private void SelectedColor(object obj)
+        {
+            if (obj != null)
+            {
+                var colorValue = (Color)obj;
+                if (colorValue != null)
+                {
+
+                    SelectColor = new SolidColorBrush(colorValue);
+                }
+            }
+        }
+
+        private void SelectedFontStyle(object obj)
+        {
+            if (obj != null && (FontStyleItem)obj != null)
+            {
+                var item = (FontStyleItem)obj;
+
+            }
+        }
+
+        private void FontFamilyChanged(object obj)
+        {
+            if (obj != null && (int)obj > -1)
+            {
+                switch ((int)obj)
+                {
+                    case 0: TextFontFamily = new FontFamily("Courier"); break;
+                    case 1: TextFontFamily = new FontFamily("Helvetica"); break;
+                    case 2: TextFontFamily = new FontFamily("Times"); break;
+                }
             }
+
         }
 
+        private void FontStyleChanged(object obj)
+        {
+            if (obj != null && (ComboBoxItem)obj != null)
+            {
+                var item = (ComboBoxItem)obj;
+                var content = (string)item.Content;
+                if (content != null)
+                {
+                    switch (content)
+                    {
+                        case "Regular":
+                            TextFontWeights = FontWeights.Normal;
+                            TextFontStyle = FontStyles.Normal;
+                            break;
+                        case "Bold":
+                            TextFontWeights = FontWeights.Bold;
+                            TextFontStyle = FontStyles.Normal;
+                            break;
+                        case "Italic":
+                            TextFontWeights = FontWeights.Normal;
+                            TextFontStyle = FontStyles.Italic;
+                            break;
+                        case "Bold Italic":
+                            TextFontWeights = FontWeights.Bold;
+                            TextFontStyle = FontStyles.Italic;
+                            break;
+                    }
+
+                }
+            }
+        }
+
+        private void FontSizeChanged(object obj)
+        {
+            if (obj != null)
+            {
+                var item = (ComboBoxItem)obj;
+                var content = (string)item.Content;
+                if (content != null)
+                {
+                    var intData = int.Parse(content);
+                    TextFontSize = intData;
+                }
+            }
+        }
+
+
+        #endregion
+
+        #region 图像处理
+
         private void CancelCropImg()
         {
             if (TextEditEvent != null)
             {
                 TextEditEvent.ClipImage = false;
                 TextEditEvent.CancelClip();
-                
+
                 TextEditEvent.UpdatePDFEditByEventArgs();
                 IsCrop = false;
             }
@@ -332,7 +413,7 @@ namespace PDF_Office.ViewModels.PropertyPanel
 
         private void CropImg()
         {
-           if(TextEditEvent != null)
+            if (TextEditEvent != null)
             {
                 TextEditEvent.SaveClip();
                 TextEditEvent.ClipImage = false;
@@ -345,10 +426,6 @@ namespace PDF_Office.ViewModels.PropertyPanel
         {
             if (PDFViewer == null || TextEditEvent == null || TextEditEvent.EditType != ComPDFKit.PDFPage.CPDFEditType.EditImage) return;
 
-            //SaveFileDialog saveFileDialog = new SaveFileDialog();
-            //saveFileDialog.Filter = "png|*.png;|Image|*.gif;*.jpg;*.jpeg;*.bmp;*.jfif;*.png;";
-            //saveFileDialog.FileName = "编辑PDF导出图片";
-
             System.Windows.Forms.FolderBrowserDialog folder = new System.Windows.Forms.FolderBrowserDialog();
             folder.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
 
@@ -361,7 +438,7 @@ namespace PDF_Office.ViewModels.PropertyPanel
                 int i = 0;
                 foreach (var bitmap in keyValueList)
                 {
-                   foreach(var bitmapItem in bitmap.Value)
+                    foreach (var bitmapItem in bitmap.Value)
                     {
                         bitmapItem.Save(folder.SelectedPath + "\\" + i + ".png", System.Drawing.Imaging.ImageFormat.Png);
                         i++;
@@ -369,7 +446,7 @@ namespace PDF_Office.ViewModels.PropertyPanel
                 }
 
 
-                
+
             }
         }
 
@@ -404,197 +481,170 @@ namespace PDF_Office.ViewModels.PropertyPanel
             }
         }
 
-        private void AddText()
+        private void CropMode()
         {
-            PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditText);
+            IsCrop = true;
+            if (TextEditEvent != null)
+            {
+                TextEditEvent.ClipImage = true;
+                TextEditEvent.UpdatePDFEditByEventArgs();
+            }
         }
 
-        private void TextAlignChecked(object obj)
+        #endregion
+
+        #region 布局处理
+        private void ImgAlignChecked(object obj)
         {
-           if((string)obj != null && TextEditEvent != null)
+            if (obj != null)
             {
-                switch((string)obj)
+                switch ((string)obj)
                 {
                     case "AlignLeft":
-                        TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignLeft;
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignLeft);
                         break;
-
-                    case "AlignCenter":
-                        TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignMiddle;
+                    case "AlignHorizonCenter":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignHorizonCenter);
                         break;
-
                     case "AlignRight":
-                        TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignRight;
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignRight);
                         break;
-                        
-                    case "Align":
-                        TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignNone;
+                    case "DistributeHorizontal":
+                        PDFViewer.SetPDFEditAligment(AlignModes.DistributeHorizontal);
+                        break;
+                    case "AlignTop":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignTop);
+                        break;
+                    case "AlignVerticalCenter":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignVerticalCenter);
+                        break;
+                    case "AlignBottom":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignBottom);
+                        break;
+                    case "DistributeVertical":
+                        PDFViewer.SetPDFEditAligment(AlignModes.DistributeVertical);
                         break;
                 }
-                TextEditEvent.UpdatePDFEditByEventArgs();
+
             }
         }
 
-        private void Clockwise()
+        private void ReLoadLayoutAlign(int count)
         {
-            Angle = TextEditEvent.Rotate = TextEditEvent.Rotate + 90;
-            TextEditEvent.UpdatePDFEditByEventArgs();
-        }
+            if (count >= 2)
+                IsLayoutAlign = true;
+            else
+                IsLayoutAlign = false;
 
-        private void AntiClockwise()
-        {
-            Angle = TextEditEvent.Rotate = TextEditEvent.Rotate - 90;
-            TextEditEvent.UpdatePDFEditByEventArgs();
+            if (count >= 3)
+                IsLayoutAvgAlign = true;
+            else
+                IsLayoutAvgAlign = false;
         }
+        #endregion
 
+        #region 右键菜单
 
-        private void CropMode()
+        //点击空白处时
+        private ContextMenu EmptyStateMenu(object sender)
         {
-            IsCrop = true;
-            if(TextEditEvent != null)
+            var popMenu = App.Current.FindResource("NoneMenu") as ContextMenu;
+            if (popMenu != null && popMenu.Items.Count == 3)
             {
-                TextEditEvent.ClipImage = true;
-                TextEditEvent.UpdatePDFEditByEventArgs();
+                //粘贴
+                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);
             }
-        }
-
-        private void SelectedColor(object obj)
-        {
-            if (obj != null)
-            {
-                var colorValue = (Color)obj;
-                if (colorValue != null)
-                {
 
-                    SelectColor = new SolidColorBrush(colorValue);
-                }
-            }
+            return popMenu;
         }
-
-        private void SelectedFontStyle(object obj)
+        //选中图像时
+        private ContextMenu SelectImgPDFEdit(object sender)
         {
-            if (obj != null && (FontStyleItem)obj != null)
+            var popMenu = App.Current.FindResource("SelectImgMenu") as ContextMenu;
+            if (popMenu != null && popMenu.Items.Count == 7)
             {
-                var item = (FontStyleItem)obj;
-
+                //复制
+                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);
             }
+            return popMenu;
         }
 
-
-        private void FontFamilyChanged(object obj)
+        //选中文字的框
+        private ContextMenu SelectTextBorder(object sender)
         {
-            if (obj != null)
+            var popMenu = App.Current.FindResource("SelectTextMenu") as ContextMenu;
+            if (popMenu != null && popMenu.Items.Count == 5)
             {
-                if ((int)obj > -1)
-                {
-                    if ((int)obj == 0)
-                    {
-
-                        TextFontFamily = new FontFamily("Courier");
-                    }
-
-
-                    if ((int)obj == 1)
-                    {
-                        TextFontFamily = new FontFamily("Helvetica");
-
-                    }
-
-
-                    if ((int)obj == 2)
-                    {
-                        TextFontFamily = new FontFamily("Times");
-
-                    }
+                //编辑
+                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);
 
-                }
             }
-
+            return popMenu;
         }
 
-
-
-        private void FontStyleChanged(object obj)
+        //选中文字内容
+        private ContextMenu SelectTextContent(object sender)
         {
-            if (obj != null)
+            var popMenu = App.Current.FindResource("SelectContentMenu") as ContextMenu;
+            if (popMenu != null && popMenu.Items.Count == 6)
             {
-                var item = (ComboBoxItem)obj;
-                var content = (string)item.Content;
-                if (content != null)
-                {
-                    if (content == "Regular")
-                    {
-                        TextFontWeights = FontWeights.Normal;
-                        TextFontStyle = FontStyles.Normal;
-                    }
-
-
-                    if (content == "Bold")
-                    {
-                        TextFontWeights = FontWeights.Bold;
-                        TextFontStyle = FontStyles.Normal;
-                    }
-
-
-                    if (content == "Italic")
-                    {
-                        TextFontWeights = FontWeights.Normal;
-                        TextFontStyle = FontStyles.Italic;
-                    }
-
-                    if (content == "Bold Italic")
-                    {
-                        TextFontWeights = FontWeights.Bold;
-                        TextFontStyle = FontStyles.Italic;
-                    }
+                //复制
+                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);
 
-                }
             }
-        }
-
 
-        private void FontSizeChanged(object obj)
-        {
-            if (obj != null)
-            {
-                var item = (ComboBoxItem)obj;
-                var content = (string)item.Content;
-                if (content != null)
-                {
-                    var intData = int.Parse(content);
-                    TextFontSize = intData;
-                }
-            }
+            return popMenu;
         }
 
-
-        private CPDFViewer PDFViewer;
-
-        public void OnNavigatedTo(NavigationContext navigationContext)
+        private void SetPopMenuItem(MenuItem menu, object sender, ICommand command)
         {
-
-            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
-            if (PDFViewer != null)
-            {
-                PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
-                PDFViewer.PDFEditActiveHandler += PDFViewer_PDFEditActiveHandler;
-
-                PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
-                PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
-               
-            }
+            MenuItem menuItem = menu;
+            menuItem.CommandTarget = (UIElement)sender;
+            menuItem.Command = command;
         }
 
-        public bool IsNavigationTarget(NavigationContext navigationContext)
-        {
-            return true;
-        }
+        #endregion
 
-       
-        public void OnNavigatedFrom(NavigationContext navigationContext)
-        {
-        }
 
+        #region 编辑PDF内容触发的事件
+
+        /// <summary>
+        /// 右键菜单的事件
+        /// </summary>
         private void PDFViewer_PDFEditCommandHandler(object sender, PDFEditCommand e)
         {
 
@@ -604,157 +654,142 @@ namespace PDF_Office.ViewModels.PropertyPanel
             switch (e.CommandType)
             {
                 case CommandType.Context:
-                   
+
                     if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.None)
                     {
                         e.PopupMenu = EmptyStateMenu(sender);
-                        if (e.PopupMenu != null)
-                        {
-                            e.Handle = true;
-                        }
+
                     }
-                    else if(e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
+                    else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
                     {
-                        e.PopupMenu = SelectPDFEdit(sender);
-                        if (e.PopupMenu != null)
-                        {
-                            e.Handle = true;
-                        }
+                        e.PopupMenu = SelectImgPDFEdit(sender);
                     }
-                    else if(e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
+                    else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
                     {
-                     //   e.SelectText
+                        //文字编辑
+                        if (e.PressOnBorder == true)
+                        {
+                            e.PopupMenu = SelectTextBorder(sender);
+                        }
+
+                        if (e.PressOnSelectedText == true)
+                        {
+                            e.PopupMenu = SelectTextContent(sender);
+                        }
                     }
 
-            break;
+                    break;
 
                 default:
                     e.DoCommand();
                     break;
 
             }
-        }
-
-        private ContextMenu EmptyStateMenu(object sender)
-        {
-            var popMenu = App.Current.FindResource("NoneMenu") as ContextMenu;
-            if (popMenu != null && popMenu.Items.Count == 3)
+            if (e.PopupMenu != null)
             {
-                //复制
-                MenuItem menuItem = popMenu.Items[0] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Paste;
-                //添加文本
-                menuItem = popMenu.Items[1] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = AddTextCommand;
-                //添加图像
-                menuItem = popMenu.Items[2] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = AddImgCommand;
+                e.Handle = true;
             }
-            return popMenu;
         }
-
-        private ContextMenu SelectPDFEdit(object sender)
-        {
-            var popMenu = App.Current.FindResource("SelectImgMenu") as ContextMenu;
-            if (popMenu != null && popMenu.Items.Count == 7)
-            {
-                //复制
-                MenuItem menuItem = popMenu.Items[0] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Copy;
-                //剪切
-                menuItem = popMenu.Items[1] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Cut;
-                //粘贴
-                menuItem = popMenu.Items[2] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Paste;
-                //删除
-                menuItem = popMenu.Items[3] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Delete;
-                //裁剪
-                menuItem = popMenu.Items[4] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = CropModeCommand;
-                //替换
-                menuItem = popMenu.Items[5] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ReplaceImgCommand;
-                //导出
-                menuItem = popMenu.Items[6] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ExportImgCommand;
-                
-            }
-            return popMenu;
-        }
-
+        /// <summary>
+        /// 选中编辑PDF内容的事件
+        /// </summary>
         private void PDFViewer_PDFEditActiveHandler(object sender, List<PDFEditEvent> e)
         {
-            if(e != null && e.Count > 0)
+            if (e != null && e.Count > 0)
             {
 
                 ReLoadLayoutAlign(e.Count);
 
                 IsTextEdit = (e[0].EditType == ComPDFKit.PDFPage.CPDFEditType.EditText);
                 TextEditEvent = e[0];
-                
+
                 if (IsTextEdit == false)
                 {
                     var list = PDFViewer.GetSelectedImages();
-                    if(list != null && list.Count > 0)
+                    if (list != null && list.Count > 0)
                     {
                         System.Drawing.Bitmap bitmap = null;
                         foreach (var item in list)
                         {
-                            if(item.Value.Count>0)
+                            if (item.Value.Count > 0)
                             {
                                 bitmap = item.Value[0];
                                 break;
                             }
                         }
 
-                        if(bitmap != null)
+                        if (bitmap != null)
                         {
                             IntPtr ip = bitmap.GetHbitmap();
                             System.Windows.Media.Imaging.BitmapSource bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(ip, IntPtr.Zero, Int32Rect.Empty,
                             System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
                             CurrentImg = bitmapSource;
                         }
-                       
+
                     }
-                    
+
 
                 }
 
+                bool isText = false;
+                bool isImg = false;
+
+                foreach (var item in e)
+                {
+                    if (item.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
+                    {
+                        isText = true;
+                    }
+
+                    if (item.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
+                    {
+                        isImg = true;
+                    }
+
+                }
+
+                if (isImg == true && isText == true)
+                    IsSelectTextAndImg = true;
+                else
+                    IsSelectTextAndImg = false;
+
             }
             else
             {
                 IsLayoutAlign = false;
                 IsLayoutAvgAlign = false;
-                ClearCheckedAglin?.Invoke(null, null);
+                IsSelectTextAndImg = false;
                 IsTextEdit = true;
+
+                ClearCheckedAglin?.Invoke(null, null);
+
             }
         }
 
-        private void ReLoadLayoutAlign(int count)
+        #endregion
+
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
         {
-            if (count >= 2)
-                IsLayoutAlign = true;
-            else
-                IsLayoutAlign = false;
 
-            if (count >= 3)
-                IsLayoutAvgAlign = true;
-            else
-                IsLayoutAvgAlign = false;
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            if (PDFViewer != null)
+            {
+                PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
+                PDFViewer.PDFEditActiveHandler += PDFViewer_PDFEditActiveHandler;
 
+                PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
+                PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
+               
+            }
         }
 
+        public bool IsNavigationTarget(NavigationContext navigationContext){   return true; }
+
+       
+        public void OnNavigatedFrom(NavigationContext navigationContext){}
+
+
+
     }
 }

+ 18 - 28
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -150,7 +150,7 @@ namespace PDF_Office.ViewModels.Tools
             annotAttribsList[AnnotAttrib.Transparency] = highlightArgs.Transparency;
             annotAttribsList[AnnotAttrib.NoteText] = string.Empty;
 
-            AddToPropertyPanel(highlightArgs, "HighLight", "TextAnnotProperty", annotAttribsList);
+            AddToPropertyPanel("TextAnnotProperty", "HighLight", highlightArgs, annotAttribsList);
             return highlightArgs;
         }
 
@@ -181,7 +181,7 @@ namespace PDF_Office.ViewModels.Tools
             annotAttribsList[AnnotAttrib.Transparency] = underlineArgs.Transparency;
             annotAttribsList[AnnotAttrib.NoteText] = string.Empty;
           
-            AddToPropertyPanel(underlineArgs, "UnderLine", "TextAnnotProperty", annotAttribsList);
+            AddToPropertyPanel("TextAnnotProperty", "UnderLine", underlineArgs,  annotAttribsList);
             return underlineArgs;
         }
 
@@ -212,7 +212,7 @@ namespace PDF_Office.ViewModels.Tools
             annotAttribsList[AnnotAttrib.Transparency] = squigglyArgs.Transparency;
             annotAttribsList[AnnotAttrib.NoteText] = string.Empty;
 
-            AddToPropertyPanel(squigglyArgs, "Squiggly", "TextAnnotProperty", annotAttribsList);
+            AddToPropertyPanel("TextAnnotProperty", "Squiggly", squigglyArgs,  annotAttribsList);
             return squigglyArgs;
         }
 
@@ -243,7 +243,7 @@ namespace PDF_Office.ViewModels.Tools
             annotAttribsList[AnnotAttrib.Transparency] = strikeoutArgs.Transparency;
             annotAttribsList[AnnotAttrib.NoteText] = string.Empty;
 
-            AddToPropertyPanel(strikeoutArgs, "Strikeout", "TextAnnotProperty", annotAttribsList);
+            AddToPropertyPanel("TextAnnotProperty", "Strikeout", strikeoutArgs, annotAttribsList);
             return strikeoutArgs;
         }
 
@@ -278,7 +278,7 @@ namespace PDF_Office.ViewModels.Tools
             annotAttribsList[AnnotAttrib.Thickness] = freehandArgs.LineWidth;
             annotAttribsList[AnnotAttrib.NoteText] = freehandArgs.Content;
 
-            AddToPropertyPanel(freehandArgs, "Freehand", "FreehandAnnotProperty", annotAttribsList);
+            AddToPropertyPanel("FreehandAnnotProperty", "Freehand", freehandArgs, annotAttribsList);
             return freehandArgs;
         }
 
@@ -346,7 +346,7 @@ namespace PDF_Office.ViewModels.Tools
             annotAttribsList[AnnotAttrib.TextAlign] = textAlignment;
             annotAttribsList[AnnotAttrib.NoteText] = freetextArgs.TextContent;
 
-            AddToPropertyPanel(freetextArgs, "Freetext", "FreetextAnnotProperty", annotAttribsList);
+            AddToPropertyPanel("FreetextAnnotProperty", "Freetext", freetextArgs, annotAttribsList);
             return freetextArgs;
         }
 
@@ -369,7 +369,7 @@ namespace PDF_Office.ViewModels.Tools
             annotAttribsList[AnnotAttrib.Transparency] = stickyAnnotArgs.Transparency;
             annotAttribsList[AnnotAttrib.NoteText] = stickyAnnotArgs.StickyNote;
 
-            AddToPropertyPanel(stickyAnnotArgs, "StickyNote", "FreetextAnnotProperty", annotAttribsList);
+            AddToPropertyPanel("FreetextAnnotProperty", "StickyNote", stickyAnnotArgs, annotAttribsList);
             return stickyAnnotArgs;
         }
 
@@ -424,7 +424,7 @@ namespace PDF_Office.ViewModels.Tools
             annotAttribsList[AnnotAttrib.Transparency] = squareArgs.Transparency;
             annotAttribsList[AnnotAttrib.NoteText] = squareArgs.Content;
 
-            AddToPropertyPanel(squareArgs, "Rect", "SharpsAnnotProperty", annotAttribsList);
+            AddToPropertyPanel("SharpsAnnotProperty", "Rect", squareArgs, annotAttribsList);
             return squareArgs;
         }
 
@@ -477,7 +477,7 @@ namespace PDF_Office.ViewModels.Tools
             annotAttribsList[AnnotAttrib.Transparency] = circleAnnotArgs.Transparency;
             annotAttribsList[AnnotAttrib.NoteText] = circleAnnotArgs.Content;
 
-            AddToPropertyPanel(circleAnnotArgs, "Circle", "SharpsAnnotProperty", annotAttribsList);
+            AddToPropertyPanel("SharpsAnnotProperty", "Circle", circleAnnotArgs, annotAttribsList);
             return circleAnnotArgs;
         }
 
@@ -548,27 +548,19 @@ namespace PDF_Office.ViewModels.Tools
             annotAttribsList[AnnotAttrib.Transparency] = lineArgs.Transparency;
             annotAttribsList[AnnotAttrib.NoteText] = lineArgs.Content;
 
-            AddToPropertyPanel(lineArgs, TagStr, "SharpsAnnotProperty", annotAttribsList);
+            AddToPropertyPanel("SharpsAnnotProperty", TagStr, lineArgs, annotAttribsList);
             return lineArgs;
         }
 
         private AnnotHandlerEventArgs GetStamp()
         {
-            Dictionary<AnnotAttrib, object> annotAttribsList = new Dictionary<AnnotAttrib, object>();
-            StampAnnotArgs stampAnnotArgs = new StampAnnotArgs();
-            stampAnnotArgs.Opacity = 1;
-            stampAnnotArgs.StampText = "APPROVED";
-            stampAnnotArgs.Type = StampType.STANDARD_STAMP;
-
-            annotAttribsList[AnnotAttrib.Transparency] = stampAnnotArgs.Opacity;
-             
-            AddToPropertyPanel(stampAnnotArgs, null, "StampAnnotProperty", annotAttribsList);
-            return stampAnnotArgs;
+            AddToPropertyPanel("StampAnnotProperty");
+            return null;
         }
 
         private AnnotHandlerEventArgs GetSignature()
         {
-            AddToPropertyPanel(null, null, "SignatureAnnotProperty", null);
+            AddToPropertyPanel("SignatureAnnotProperty");
             return null;
         }
 
@@ -588,18 +580,18 @@ namespace PDF_Office.ViewModels.Tools
               
             }
 
-            AddToPropertyPanel(stampArgs, null, "ImageAnnotProperty", annotAttribsList);
+            AddToPropertyPanel("ImageAnnotProperty", null, stampArgs, annotAttribsList);
             return stampArgs;
         }
 
         /// <summary>
-        /// 添加到属性面板
+        /// 导航到同一个注释xaml时,需要区分某个注释;比如高亮、删除线、下划线
         /// </summary>
-        /// <param name="annot"></param>
-        /// <param name="toolTag">导航到同一个注释xaml时,需要区分某个注释;比如高亮、删除线、下划线</param>
         /// <param name="viewContent">对应的注释面板</param>
+        /// <param name="toolTag">导航到同一个注释xaml时,需要区分某个注释;比如高亮、删除线、下划线</param>
+        /// <param name="annot">注释</param>
         /// <param name="annotAttribsList">更改注释属性的键值对,更改值后会自动记录undoRedo容器里</param>
-        private void AddToPropertyPanel(AnnotHandlerEventArgs annot, string toolTag, string viewContent, Dictionary<AnnotAttrib, object> annotAttribsList)
+        private void AddToPropertyPanel(string viewContent, string toolTag = null, AnnotHandlerEventArgs annot = null, Dictionary<AnnotAttrib, object> annotAttribsList = null)
         {
             if (string.IsNullOrEmpty(toolTag) == false)
             {
@@ -616,9 +608,7 @@ namespace PDF_Office.ViewModels.Tools
                 propertyPanel.AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annot, annotAttribsList);
 
             if (string.IsNullOrEmpty(viewContent) == false)
-            {
                 viewContentViewModel.SelectedPrpoertyPanel(viewContent, propertyPanel);
-            }
 
         }
 

+ 34 - 35
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -44,17 +44,20 @@ namespace PDF_Office.ViewModels.Tools
         private Dictionary<string, bool> ToolExpandDict = new Dictionary<string, bool>();
         public void BtnMyTools_Click(CustomIconToggleBtn annotBtn)
         {
-            if(annotBtn.IsChecked == true)
+            //不创建注释,属于注释模板
+            bool isTemplateAnnot = false;
+            AnnotHandlerEventArgs annotArgs = null;
+
+            if (annotBtn.IsChecked == true)
             {
-                AnnotHandlerEventArgs annotArgs = null;
 
                 switch (annotBtn.Tag.ToString())
                 {
                     case "SnapshotEdit":
                         break;
 
-                    case "HighLight": 
-                         annotArgs = GetHighLight();
+                    case "HighLight":
+                        annotArgs = GetHighLight();
                         break;
 
                     case "UnderLine":
@@ -96,6 +99,7 @@ namespace PDF_Office.ViewModels.Tools
 
                     case "Stamp":
                         annotArgs = GetStamp();
+                        isTemplateAnnot = true;
                         break;
 
                     case "Image":
@@ -104,6 +108,7 @@ namespace PDF_Office.ViewModels.Tools
 
                     case "Signature":
                         annotArgs = GetSignature();
+                        isTemplateAnnot = true;
                         break;
 
                     case "Link":
@@ -111,35 +116,29 @@ namespace PDF_Office.ViewModels.Tools
 
                 }
 
-
                 if (annotArgs != null)
                 {
                     annotArgs.Author = Settings.Default.AppProperties.Description.Author;
                     PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
                     PDFViewer.SetToolParam(annotArgs);
                 }
-                else
-                {
-                    PDFViewer.SetMouseMode(MouseModes.PanTool);
-                    viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
-                    ShowPropertyPanel(false);
-                }
-                ShowPropertyPanel();
 
             }
-            else
+
+            //当不是注释模板,且无创建注释时,属性面板显示为空内容
+            if(isTemplateAnnot == false && annotArgs == null)
             {
                 PDFViewer.SetMouseMode(MouseModes.PanTool);
-                viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent",null);
-                ShowPropertyPanel(false);
+                viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
             }
 
-          
+            ShowPropertyPanel((bool)annotBtn.IsChecked);
+
         }
 
         private void AnnotProperty_DefaultStored(object sender, object e)
         {
-           
+
         }
 
         private void AnnotPropertyPanel_AnnotTypeChanged(object sender, Dictionary<AnnotArgsType, object> e)
@@ -176,7 +175,7 @@ namespace PDF_Office.ViewModels.Tools
                 }
             }
         }
-        
+
 
         private void AnnotPropertyPanel_DataChanged(object sender, Dictionary<AnnotArgsType, object> e)
         {
@@ -233,11 +232,11 @@ namespace PDF_Office.ViewModels.Tools
                         case AnnotArgsType.AnnotFreehand:
                             if (e[argsType] is Color)
                             {
-                               // FreehandPath.Fill = new SolidColorBrush((Color)e[argsType]);
+                                // FreehandPath.Fill = new SolidColorBrush((Color)e[argsType]);
                             }
                             if (e[argsType] is double)
                             {
-                              //  FreehandPath.Opacity = (double)e[argsType];
+                                //  FreehandPath.Opacity = (double)e[argsType];
                             }
                             break;
                         case AnnotArgsType.AnnotErase:
@@ -245,8 +244,8 @@ namespace PDF_Office.ViewModels.Tools
                             {
                                 ToggleButton clickBtn = e[argsType] as ToggleButton;
                                 //PDFViewerCtrl viewCtrl = GetCurrentViewer();
-                               // ClearSelectedToolPanel(BtnFreeHand);
-                           //     if (viewCtrl != null && viewCtrl.PdfViewer != null)
+                                // ClearSelectedToolPanel(BtnFreeHand);
+                                //     if (viewCtrl != null && viewCtrl.PdfViewer != null)
                                 {
                                     if (clickBtn.IsChecked == true)
                                     {
@@ -275,7 +274,7 @@ namespace PDF_Office.ViewModels.Tools
                                         annotAttribsList[AnnotAttrib.Color] = eraseArgs.UIBorderColor;
                                         annotAttribsList[AnnotAttrib.FillColor] = eraseArgs.UIFillColor;
                                         annotAttribsList[AnnotAttrib.Thickness] = eraseArgs.Thickness;
-                                        AddToPropertyPanel(eraseArgs, "Freehand", "FreehandAnnotProperty", annotAttribsList);
+                                        AddToPropertyPanel("FreehandAnnotProperty", "Freehand", eraseArgs, annotAttribsList);
                                         //清空选中注释
                                         //viewCtrl.PdfViewer.ClearSelectAnnots(false);
                                         //viewCtrl.PdfViewer.SetMouseMode(MouseModes.AnnotCreate);
@@ -318,8 +317,8 @@ namespace PDF_Office.ViewModels.Tools
                                     }
                                     else
                                     {
-                                      //  BtnFreeHand.IsChecked = true;
-                                      //   BtnTool_Click(BtnFreeHand, new RoutedEventArgs());
+                                        //  BtnFreeHand.IsChecked = true;
+                                        //   BtnTool_Click(BtnFreeHand, new RoutedEventArgs());
                                     }
                                 }
                             }
@@ -367,17 +366,17 @@ namespace PDF_Office.ViewModels.Tools
 
         private void PDFViewer_WidgetClickHander(object sender, WidgetArgs e)
         {
-           
+
         }
 
         private void PDFViewer_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
         {
-           
+
         }
 
         private void PDFViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e)
         {
-            if(e != null)
+            if (e != null)
             {
                 var annot = e.AnnotItemsList[0];
                 if (annot != null)
@@ -438,10 +437,10 @@ namespace PDF_Office.ViewModels.Tools
             }
             else
             {
-               // PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                // PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
                 //  viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
             }
-           
+
         }
 
         private void PDFViewer_AnnotCommandHandler(object sender, AnnotCommandArgs e)
@@ -450,11 +449,11 @@ namespace PDF_Office.ViewModels.Tools
             if (e.AnnotEventArgsList == null)
                 return;
 
-           // var annotlist = e.AnnotEventArgsList;
+            // var annotlist = e.AnnotEventArgsList;
             switch (e.CommandType)
             {
                 case CommandType.Context:
-                    if(e.AnnotEventArgsList.Count > 0)
+                    if (e.AnnotEventArgsList.Count > 0)
                     {
                         e.PopupMenu = SelectAnnotContextMenu(sender);
                         if (e.PopupMenu != null)
@@ -479,7 +478,7 @@ namespace PDF_Office.ViewModels.Tools
 
         private ContextMenu SelectAnnotContextMenu(object sender)
         {
-           var  popMenu = App.Current.FindResource("SelectAnnotContextMenu") as ContextMenu;
+            var popMenu = App.Current.FindResource("SelectAnnotContextMenu") as ContextMenu;
             if (popMenu != null && popMenu.Items.Count == 4)
             {
                 //剪切
@@ -524,11 +523,11 @@ namespace PDF_Office.ViewModels.Tools
         /// <summary>
         /// 展开显示属性面板
         /// </summary>
-        private void ShowPropertyPanel(bool show=true)
+        private void ShowPropertyPanel(bool show = true)
         {
             viewContentViewModel.IsPropertyOpen = show;
         }
 
     }
-   
+
 }

+ 2 - 0
PDF Office/Views/Form/ButtonProperty.xaml

@@ -4,6 +4,8 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>

+ 2 - 0
PDF Office/Views/Form/CheckBoxProperty.xaml

@@ -4,6 +4,8 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>

+ 2 - 0
PDF Office/Views/Form/ComboxProperty.xaml

@@ -4,6 +4,8 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>

+ 2 - 0
PDF Office/Views/Form/ListBoxProperty.xaml

@@ -4,6 +4,8 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>

+ 2 - 0
PDF Office/Views/Form/RadioButtonProperty.xaml

@@ -4,6 +4,8 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>

+ 2 - 0
PDF Office/Views/Form/SignProperty.xaml

@@ -4,6 +4,8 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>

+ 2 - 0
PDF Office/Views/Form/TextFieldProperty.xaml

@@ -8,6 +8,8 @@
     xmlns:form="clr-namespace:PDF_Office.CustomControl.Form"
     xmlns:local="clr-namespace:PDF_Office.Views.Form"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    prism:ViewModelLocator.AutoWireViewModel="True"
     d:DesignHeight="750"
     d:DesignWidth="260"
     Background="{StaticResource color.sys.layout.mg}"

+ 397 - 384
PDF Office/Views/PropertyPanel/TextEditProperty.xaml

@@ -49,452 +49,465 @@
         </ResourceDictionary>
     </UserControl.Resources>
     <Grid Background="#F3F3F3">
-        <StackPanel Visibility="{Binding IsTextEdit,Converter={StaticResource BoolToVisible}}">
-            <TextBlock Name="AnnotTypeTitle" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="18" LineHeight="24" HorizontalAlignment="Left" Margin="10,8,0,0">Freetext</TextBlock>
-            <Border Width="228" Height="100" BorderThickness="1" CornerRadius="2" BorderBrush="#DDDDDD" Background="White" Margin="0,8,0,0">
-                <Grid>
-                    <Border Name="FreeTextBorder" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="5">
-                        <TextBlock Name="SampleText"
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="Auto"/>
+        </Grid.RowDefinitions>
+        <Grid Visibility="{Binding IsSelectTextAndImg,Converter={StaticResource InvertBoolToVisibleConvert}}">
+
+            <StackPanel Visibility="{Binding IsTextEdit,Converter={StaticResource BoolToVisible}}">
+                <TextBlock Name="AnnotTypeTitle" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="18" LineHeight="24" HorizontalAlignment="Left" Margin="10,8,0,0">Freetext</TextBlock>
+                <Border Width="228" Height="100" BorderThickness="1" CornerRadius="2" BorderBrush="#DDDDDD" Background="White" Margin="0,8,0,0">
+                    <Grid>
+                        <Border Name="FreeTextBorder" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="5">
+                            <TextBlock Name="SampleText"
                                    Foreground="{Binding SelectColor}" 
                                    FontFamily="{Binding TextFontFamily}"
                                    FontWeight="{Binding TextFontWeights}" 
                                    FontStyle="{Binding TextFontStyle}"
                                    FontSize="{Binding TextFontSize}" 
                                    Text="Sample" HorizontalAlignment="Center" VerticalAlignment="Center">
-                        </TextBlock>
-                    </Border>
-
-                    <Path Name="UnderlinePath" HorizontalAlignment="Center" StrokeThickness="2" Margin="0,51,0,0" Visibility="Collapsed">
-                        <Path.Data>
-                            <LineGeometry StartPoint="0,0" EndPoint="62,0"></LineGeometry>
-                        </Path.Data>
-                    </Path>
-                    <Path Name="StrikeoutPath" HorizontalAlignment="Center" StrokeThickness="2" Margin="0,40,0,0" Visibility="Collapsed">
-                        <Path.Data>
-                            <LineGeometry StartPoint="0,0" EndPoint="62,0"></LineGeometry>
-                        </Path.Data>
-                    </Path>
-                    <Path Name="SquigglyPath"  HorizontalAlignment="Center" StrokeThickness="2" Margin="0,51,0,0" Visibility="Collapsed">
-
-                    </Path>
-                </Grid>
-            </Border>
+                            </TextBlock>
+                        </Border>
+
+                        <Path Name="UnderlinePath" HorizontalAlignment="Center" StrokeThickness="2" Margin="0,51,0,0" Visibility="Collapsed">
+                            <Path.Data>
+                                <LineGeometry StartPoint="0,0" EndPoint="62,0"></LineGeometry>
+                            </Path.Data>
+                        </Path>
+                        <Path Name="StrikeoutPath" HorizontalAlignment="Center" StrokeThickness="2" Margin="0,40,0,0" Visibility="Collapsed">
+                            <Path.Data>
+                                <LineGeometry StartPoint="0,0" EndPoint="62,0"></LineGeometry>
+                            </Path.Data>
+                        </Path>
+                        <Path Name="SquigglyPath"  HorizontalAlignment="Center" StrokeThickness="2" Margin="0,51,0,0" Visibility="Collapsed">
+
+                        </Path>
+                    </Grid>
+                </Border>
 
 
-            <Border BorderBrush="#E2E3E6"  Height="32" Margin="12,0,4,0"  BorderThickness="0">
-                <StackPanel Orientation="Horizontal">
-                    <ComboBox IsReadOnly="True" Name="FontTitleBox" Background="Transparent" Padding="10 10 0 0"  Width="148"   BorderThickness="1" BorderBrush="#FFE2E3E6"
+                <Border BorderBrush="#E2E3E6"  Height="32" Margin="12,0,4,0"  BorderThickness="0">
+                    <StackPanel Orientation="Horizontal">
+                        <ComboBox IsReadOnly="True" Name="FontTitleBox" Background="Transparent" Padding="10 10 0 0"  Width="148"   BorderThickness="1" BorderBrush="#FFE2E3E6"
                                 ItemsSource="{Binding FontStyleList}"
                               ItemTemplate="{StaticResource FontStyleData}"
                               >
-                        <i:Interaction.Triggers>
-                            <i:EventTrigger EventName="SelectionChanged">
-                                <i:InvokeCommandAction Command="{Binding SelectedFontStyleCommand}" CommandParameter="{Binding ElementName=FontTitleBox,Path=SelectedItem}"/>
-                            </i:EventTrigger>
-                        </i:Interaction.Triggers>
-                    </ComboBox>
-                    <Button Width="32" Height="32" ContextMenu="{StaticResource BtnFlyoutMenu}"/>
-                </StackPanel>
-            </Border>
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="SelectionChanged">
+                                    <i:InvokeCommandAction Command="{Binding SelectedFontStyleCommand}" CommandParameter="{Binding ElementName=FontTitleBox,Path=SelectedItem}"/>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </ComboBox>
+                        <Button Width="32" Height="32" ContextMenu="{StaticResource BtnFlyoutMenu}"/>
+                    </StackPanel>
+                </Border>
 
 
 
 
-            <TextBlock x:Name="FontText"  FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,18,0,0" >Font</TextBlock>
+                <TextBlock x:Name="FontText"  FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,18,0,0" >Font</TextBlock>
 
-            <Grid Margin="0,6,0,0">
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-                <Grid.RowDefinitions>
-                    <RowDefinition Height="auto"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
-                </Grid.RowDefinitions>
+                <Grid Margin="0,6,0,0">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                    </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="auto"></RowDefinition>
+                        <RowDefinition Height="auto"></RowDefinition>
+                        <RowDefinition Height="auto"></RowDefinition>
+                    </Grid.RowDefinitions>
 
-                <Border BorderBrush="#E2E3E6" Grid.ColumnSpan="2"  Width="228" Height="32" Margin="12,0,4,0"  BorderThickness="0">
-                    <Grid>
-                        <ComboBox IsReadOnly="True" Name="FontFamilyBox" Background="Transparent" Padding="10 10 0 0"  BorderThickness="1" BorderBrush="#FFE2E3E6"
+                    <Border BorderBrush="#E2E3E6" Grid.ColumnSpan="2"  Width="228" Height="32" Margin="12,0,4,0"  BorderThickness="0">
+                        <Grid>
+                            <ComboBox IsReadOnly="True" Name="FontFamilyBox" Background="Transparent" Padding="10 10 0 0"  BorderThickness="1" BorderBrush="#FFE2E3E6"
                                 >
-                            <ComboBox.ItemContainerStyle>
-                                <Style TargetType="{x:Type ComboBoxItem}">
-                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                </Style>
-                            </ComboBox.ItemContainerStyle>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <TextBlock Text="Courier New" FontFamily="Courier New" Tag="Courier"  FontSize="14"/>
-                            </ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <TextBlock Text="Arial" FontFamily="Arial" Tag="Helvetica" FontSize="14"/>
-                            </ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <TextBlock Text="Times New Roman" FontFamily="Times New Roman" Tag="Times Roman" FontSize="14"/>
-                            </ComboBoxItem>
-                            <i:Interaction.Triggers>
-                                <i:EventTrigger EventName="SelectionChanged">
-                                    <i:InvokeCommandAction Command="{Binding FontFamilyChangedCommand}" CommandParameter="{Binding ElementName=FontFamilyBox,Path=SelectedIndex}"/>
-                                </i:EventTrigger>
-                            </i:Interaction.Triggers>
-                        </ComboBox>
-
-                        <TextBox Name="FontFamilyText" FontFamily="Segoe UI" FontSize="14" Background="White"  Padding="10 0 0 0" Margin="2,0,25,0" IsReadOnly="True"
+                                <ComboBox.ItemContainerStyle>
+                                    <Style TargetType="{x:Type ComboBoxItem}">
+                                        <Setter Property="Padding" Value="10 0 0 0"/>
+                                    </Style>
+                                </ComboBox.ItemContainerStyle>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
+                                    <TextBlock Text="Courier New" FontFamily="Courier New" Tag="Courier"  FontSize="14"/>
+                                </ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
+                                    <TextBlock Text="Arial" FontFamily="Arial" Tag="Helvetica" FontSize="14"/>
+                                </ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
+                                    <TextBlock Text="Times New Roman" FontFamily="Times New Roman" Tag="Times Roman" FontSize="14"/>
+                                </ComboBoxItem>
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="SelectionChanged">
+                                        <i:InvokeCommandAction Command="{Binding FontFamilyChangedCommand}" CommandParameter="{Binding ElementName=FontFamilyBox,Path=SelectedIndex}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </ComboBox>
+
+                            <TextBox Name="FontFamilyText" FontFamily="Segoe UI" FontSize="14" Background="White"  Padding="10 0 0 0" Margin="2,0,25,0" IsReadOnly="True"
                              BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left">
-                        </TextBox>
-                    </Grid>
-                </Border>
+                            </TextBox>
+                        </Grid>
+                    </Border>
 
-                <cusColor:ColorSubContent x:Name="FontColorBox" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left"
+                    <cusColor:ColorSubContent x:Name="FontColorBox" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left"
                                    ></cusColor:ColorSubContent>
 
-                <Border Grid.Row="1" BorderBrush="#E2E3E6"  Width="148" Height="32" Margin="12,8,4,0"  BorderThickness="0">
-                    <Grid>
-                        <ComboBox Name="FontStyleBox" IsReadOnly="True" BorderThickness="1" BorderBrush="#FFE2E3E6" Padding="10 10 0 0" Background="Transparent">
-                            <ComboBox.ItemContainerStyle>
-                                <Style TargetType="{x:Type ComboBoxItem}">
-                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                </Style>
-                            </ComboBox.ItemContainerStyle>
-                            <ComboBoxItem x:Name="RegularItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Regular</ComboBoxItem>
-                            <ComboBoxItem x:Name="BoldItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold</ComboBoxItem>
-                            <ComboBoxItem x:Name="ItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Italic</ComboBoxItem>
-                            <ComboBoxItem x:Name="BoldItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold Italic</ComboBoxItem>
-
-                            <i:Interaction.Triggers>
-                                <i:EventTrigger EventName="SelectionChanged">
-                                    <i:InvokeCommandAction Command="{Binding FontStyleChangedCommand}" CommandParameter="{Binding ElementName=FontStyleBox,Path=SelectedItem}"/>
-                                </i:EventTrigger>
-                            </i:Interaction.Triggers>
-                        </ComboBox>
-                        <TextBox Name="FontStyleText" IsReadOnly="True" FontFamily="Segoe UI" FontSize="14" Background="White" Padding="10 0 0 0" Height="20" Margin="2,0,35,0" 
+                    <Border Grid.Row="1" BorderBrush="#E2E3E6"  Width="148" Height="32" Margin="12,8,4,0"  BorderThickness="0">
+                        <Grid>
+                            <ComboBox Name="FontStyleBox" IsReadOnly="True" BorderThickness="1" BorderBrush="#FFE2E3E6" Padding="10 10 0 0" Background="Transparent">
+                                <ComboBox.ItemContainerStyle>
+                                    <Style TargetType="{x:Type ComboBoxItem}">
+                                        <Setter Property="Padding" Value="10 0 0 0"/>
+                                    </Style>
+                                </ComboBox.ItemContainerStyle>
+                                <ComboBoxItem x:Name="RegularItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Regular</ComboBoxItem>
+                                <ComboBoxItem x:Name="BoldItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold</ComboBoxItem>
+                                <ComboBoxItem x:Name="ItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Italic</ComboBoxItem>
+                                <ComboBoxItem x:Name="BoldItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold Italic</ComboBoxItem>
+
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="SelectionChanged">
+                                        <i:InvokeCommandAction Command="{Binding FontStyleChangedCommand}" CommandParameter="{Binding ElementName=FontStyleBox,Path=SelectedItem}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </ComboBox>
+                            <TextBox Name="FontStyleText" IsReadOnly="True" FontFamily="Segoe UI" FontSize="14" Background="White" Padding="10 0 0 0" Height="20" Margin="2,0,35,0" 
                              BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left">
-                        </TextBox>
-                    </Grid>
-                </Border>
+                            </TextBox>
+                        </Grid>
+                    </Border>
 
-                <Border Grid.Row="1" Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="-1,8,0,0"  BorderThickness="0">
-                    <Grid>
-                        <ComboBox Name="FontSizeBox" BorderThickness="1" Background="Transparent" BorderBrush="#FFE2E3E6"
+                    <Border Grid.Row="1" Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="-1,8,0,0"  BorderThickness="0">
+                        <Grid>
+                            <ComboBox Name="FontSizeBox" BorderThickness="1" Background="Transparent" BorderBrush="#FFE2E3E6"
                                   MaxDropDownHeight="200">
-                            <ComboBox.ItemContainerStyle>
-                                <Style TargetType="{x:Type ComboBoxItem}">
-                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                </Style>
-                            </ComboBox.ItemContainerStyle>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">6</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">8</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">9</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">10</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">12</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">14</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">18</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">20</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">22</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">24</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">26</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">28</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">32</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">36</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">48</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">72</ComboBoxItem>
-                            <i:Interaction.Triggers>
-                                <i:EventTrigger EventName="SelectionChanged">
-                                    <i:InvokeCommandAction Command="{Binding FontSizeChangedCommand}" CommandParameter="{Binding ElementName=FontSizeBox,Path=SelectedItem}"/>
-                                </i:EventTrigger>
-                            </i:Interaction.Triggers>
-                        </ComboBox>
-                        <TextBox Name="FontSizeText" FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Padding="10 0 0 0" Margin="2,0,35,0" 
+                                <ComboBox.ItemContainerStyle>
+                                    <Style TargetType="{x:Type ComboBoxItem}">
+                                        <Setter Property="Padding" Value="10 0 0 0"/>
+                                    </Style>
+                                </ComboBox.ItemContainerStyle>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">6</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">8</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">9</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">10</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">12</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">14</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">18</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">20</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">22</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">24</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">26</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">28</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">32</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">36</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">48</ComboBoxItem>
+                                <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">72</ComboBoxItem>
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="SelectionChanged">
+                                        <i:InvokeCommandAction Command="{Binding FontSizeChangedCommand}" CommandParameter="{Binding ElementName=FontSizeBox,Path=SelectedItem}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </ComboBox>
+                            <TextBox Name="FontSizeText" FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Padding="10 0 0 0" Margin="2,0,35,0" 
                              BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" IsReadOnly="True">
-                        </TextBox>
-                    </Grid>
-                </Border>
+                            </TextBox>
+                        </Grid>
+                    </Border>
 
 
-                <Border Grid.ColumnSpan="2" Grid.Row="2" Width="148"  Margin="12,8,0,0"  HorizontalAlignment="Left">
-                    <Grid Name="ToolGrid">
-                        <Grid.ColumnDefinitions>
-                            <ColumnDefinition Width="*"></ColumnDefinition>
-                            <ColumnDefinition Width="*"></ColumnDefinition>
-                            <ColumnDefinition Width="*"></ColumnDefinition>
-                            <ColumnDefinition Width="*"></ColumnDefinition>
-                        </Grid.ColumnDefinitions>
+                    <Border Grid.ColumnSpan="2" Grid.Row="2" Width="148"  Margin="12,8,0,0"  HorizontalAlignment="Left">
+                        <Grid Name="ToolGrid">
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="*"></ColumnDefinition>
+                                <ColumnDefinition Width="*"></ColumnDefinition>
+                                <ColumnDefinition Width="*"></ColumnDefinition>
+                                <ColumnDefinition Width="*"></ColumnDefinition>
+                            </Grid.ColumnDefinitions>
 
 
 
-                        <RadioButton x:Name="TextAlignLeftBtn" IsChecked="True" Tag="AlignLeft" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469"  Background="Transparent" VerticalContentAlignment="Center"
+                            <RadioButton x:Name="TextAlignLeftBtn" IsChecked="True" Tag="AlignLeft" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469"  Background="Transparent" VerticalContentAlignment="Center"
                                       Style="{DynamicResource GreyBgRadioBtnStyle}" >
-                            <RadioButton.Content>
-                                <Grid Width="32" Height="32">
-                                    <Canvas Margin="5,10,0,0">
-                                        <Rectangle Canvas.Top="0.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignLeftBtn,Path=Foreground}"/>
-                                        <Rectangle Canvas.Top="4.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignLeftBtn,Path=Foreground}"/>
-                                        <Rectangle Canvas.Top="12.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignLeftBtn,Path=Foreground}"/>
-                                        <Rectangle Canvas.Top="8.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignLeftBtn,Path=Foreground}"/>
-                                    </Canvas>
-                                </Grid>
-                            </RadioButton.Content>
-                            <i:Interaction.Triggers>
-                                <i:EventTrigger EventName="Checked">
-                                    <i:InvokeCommandAction Command="{Binding TextAlignCheckedCommand}" CommandParameter="{Binding ElementName=TextAlignLeftBtn,Path=Tag}"/>
-                                </i:EventTrigger>
-                            </i:Interaction.Triggers>
-                        </RadioButton>
-
-                        <RadioButton x:Name="TextAlignCenterBtn" Grid.Column="1" Tag="AlignCenter" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                                <RadioButton.Content>
+                                    <Grid Width="32" Height="32">
+                                        <Canvas Margin="5,10,0,0">
+                                            <Rectangle Canvas.Top="0.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignLeftBtn,Path=Foreground}"/>
+                                            <Rectangle Canvas.Top="4.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignLeftBtn,Path=Foreground}"/>
+                                            <Rectangle Canvas.Top="12.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignLeftBtn,Path=Foreground}"/>
+                                            <Rectangle Canvas.Top="8.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignLeftBtn,Path=Foreground}"/>
+                                        </Canvas>
+                                    </Grid>
+                                </RadioButton.Content>
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="Checked">
+                                        <i:InvokeCommandAction Command="{Binding TextAlignCheckedCommand}" CommandParameter="{Binding ElementName=TextAlignLeftBtn,Path=Tag}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </RadioButton>
+
+                            <RadioButton x:Name="TextAlignCenterBtn" Grid.Column="1" Tag="AlignCenter" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                                       Style="{DynamicResource GreyBgRadioBtnStyle}" >
-                            <RadioButton.Content>
-                                <Grid Width="32" Height="32">
-                                    <Canvas Margin="5,10,0,0">
-                                        <Rectangle Canvas.Top="0.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignCenterBtn,Path=Foreground}"/>
-                                        <Rectangle Canvas.Left="3" Canvas.Top="4.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignCenterBtn,Path=Foreground}"/>
-                                        <Rectangle Canvas.Left="3" Canvas.Top="12.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignCenterBtn,Path=Foreground}"/>
-                                        <Rectangle Canvas.Top="8.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignCenterBtn,Path=Foreground}"/>
-                                    </Canvas>
-                                </Grid>
-                            </RadioButton.Content>
-                            <i:Interaction.Triggers>
-                                <i:EventTrigger EventName="Checked">
-                                    <i:InvokeCommandAction Command="{Binding TextAlignCheckedCommand}" CommandParameter="{Binding ElementName=TextAlignCenterBtn,Path=Tag}"/>
-                                </i:EventTrigger>
-                            </i:Interaction.Triggers>
-                        </RadioButton>
-
-                        <RadioButton x:Name="TextAlignRightBtn" Grid.Column="2" Tag="AlignRight" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                                <RadioButton.Content>
+                                    <Grid Width="32" Height="32">
+                                        <Canvas Margin="5,10,0,0">
+                                            <Rectangle Canvas.Top="0.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignCenterBtn,Path=Foreground}"/>
+                                            <Rectangle Canvas.Left="3" Canvas.Top="4.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignCenterBtn,Path=Foreground}"/>
+                                            <Rectangle Canvas.Left="3" Canvas.Top="12.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignCenterBtn,Path=Foreground}"/>
+                                            <Rectangle Canvas.Top="8.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignCenterBtn,Path=Foreground}"/>
+                                        </Canvas>
+                                    </Grid>
+                                </RadioButton.Content>
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="Checked">
+                                        <i:InvokeCommandAction Command="{Binding TextAlignCheckedCommand}" CommandParameter="{Binding ElementName=TextAlignCenterBtn,Path=Tag}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </RadioButton>
+
+                            <RadioButton x:Name="TextAlignRightBtn" Grid.Column="2" Tag="AlignRight" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                                       Style="{DynamicResource GreyBgRadioBtnStyle}" >
-                            <RadioButton.Content>
-                                <Grid Width="32" Height="32">
-                                    <Canvas Margin="5,10,0,0">
-                                        <Rectangle Canvas.Top="0.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignRightBtn,Path=Foreground}"/>
-                                        <Rectangle Canvas.Left="6" Canvas.Top="4.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignRightBtn,Path=Foreground}"/>
-                                        <Rectangle Canvas.Left="6" Canvas.Top="12.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignRightBtn,Path=Foreground}"/>
-                                        <Rectangle Canvas.Top="8.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignRightBtn,Path=Foreground}"/>
-                                    </Canvas>
-                                </Grid>
-                            </RadioButton.Content>
-                            <i:Interaction.Triggers>
-                                <i:EventTrigger EventName="Checked">
-                                    <i:InvokeCommandAction Command="{Binding TextAlignCheckedCommand}" CommandParameter="{Binding ElementName=TextAlignRightBtn,Path=Tag}"/>
-                                </i:EventTrigger>
-                            </i:Interaction.Triggers>
-                        </RadioButton>
-
-                        <RadioButton x:Name="TextAlignBtn" Grid.Column="3" Tag="Align" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                                <RadioButton.Content>
+                                    <Grid Width="32" Height="32">
+                                        <Canvas Margin="5,10,0,0">
+                                            <Rectangle Canvas.Top="0.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignRightBtn,Path=Foreground}"/>
+                                            <Rectangle Canvas.Left="6" Canvas.Top="4.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignRightBtn,Path=Foreground}"/>
+                                            <Rectangle Canvas.Left="6" Canvas.Top="12.25" Width="8" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignRightBtn,Path=Foreground}"/>
+                                            <Rectangle Canvas.Top="8.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignRightBtn,Path=Foreground}"/>
+                                        </Canvas>
+                                    </Grid>
+                                </RadioButton.Content>
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="Checked">
+                                        <i:InvokeCommandAction Command="{Binding TextAlignCheckedCommand}" CommandParameter="{Binding ElementName=TextAlignRightBtn,Path=Tag}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </RadioButton>
+
+                            <RadioButton x:Name="TextAlignBtn" Grid.Column="3" Tag="Align" GroupName="TextAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                                       Style="{DynamicResource GreyBgRadioBtnStyle}" >
-                            <RadioButton.Content>
-                                <Grid Width="32" Height="32">
-                                    <Canvas Margin="5,10,0,0">
-                                        <Rectangle Canvas.Top="0.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignBtn,Path=Foreground}"/>
-                                        <Rectangle Canvas.Top="8.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignBtn,Path=Foreground}"/>
-                                        <Rectangle Canvas.Top="4.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignBtn,Path=Foreground}"/>
-                                        <Rectangle Canvas.Top="12.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignBtn,Path=Foreground}"/>
-                                    </Canvas>
-                                </Grid>
-                            </RadioButton.Content>
-                            <i:Interaction.Triggers>
-                                <i:EventTrigger EventName="Checked">
-                                    <i:InvokeCommandAction Command="{Binding TextAlignCheckedCommand}" CommandParameter="{Binding ElementName=TextAlignBtn,Path=Tag}"/>
-                                </i:EventTrigger>
-                            </i:Interaction.Triggers>
-                        </RadioButton>
+                                <RadioButton.Content>
+                                    <Grid Width="32" Height="32">
+                                        <Canvas Margin="5,10,0,0">
+                                            <Rectangle Canvas.Top="0.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignBtn,Path=Foreground}"/>
+                                            <Rectangle Canvas.Top="8.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignBtn,Path=Foreground}"/>
+                                            <Rectangle Canvas.Top="4.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignBtn,Path=Foreground}"/>
+                                            <Rectangle Canvas.Top="12.25" Width="14" Height="1.5" StrokeThickness="1.5" Stroke="{Binding ElementName=TextAlignBtn,Path=Foreground}"/>
+                                        </Canvas>
+                                    </Grid>
+                                </RadioButton.Content>
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="Checked">
+                                        <i:InvokeCommandAction Command="{Binding TextAlignCheckedCommand}" CommandParameter="{Binding ElementName=TextAlignBtn,Path=Tag}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </RadioButton>
+
+                        </Grid>
+                    </Border>
+                </Grid>
 
+                <TextBlock x:Name="AlignText" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,14,0,0" >Align</TextBlock>
+            </StackPanel>
+
+            <StackPanel Visibility="{Binding IsTextEdit,Converter={StaticResource InvertBoolToVisibleConvert}}">
+                <TextBlock Name="AnnotTypeTitle1" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="18" LineHeight="24" HorizontalAlignment="Left" Margin="10,8,0,0">Image</TextBlock>
+                <Border Width="228" Height="100" BorderThickness="1" CornerRadius="2" BorderBrush="#DDDDDD" Background="White" Margin="0,8,0,0">
+                    <Grid>
+                        <Border Name="FreeTextBorder1" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="5" >
+                            <Image x:Name="ImgExmple" Source="{Binding CurrentImg}">
+                                <Image.RenderTransform>
+                                    <RotateTransform x:Name="test"  Angle="{Binding Angle}"/>
+                                </Image.RenderTransform>
+                            </Image>
+                        </Border>
                     </Grid>
                 </Border>
-            </Grid>
-
-            <TextBlock x:Name="AlignText" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,14,0,0" >Thickness</TextBlock>
-            <Grid x:Name="LayoutAlignGrid" Width="150" HorizontalAlignment="Left" Margin="0,10,0,0">
-                <Grid.RowDefinitions>
-                    <RowDefinition Height="*"/>
-                    <RowDefinition Height="*"/>
-                </Grid.RowDefinitions>
-
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"/>
-                    <ColumnDefinition Width="*"/>
-                    <ColumnDefinition Width="*"/>
-                    <ColumnDefinition Width="*"/>
-                </Grid.ColumnDefinitions>
-
-                <RadioButton x:Name="BtnImgLayoutAlignLeft"  Grid.Row="0" Grid.Column="0" Tag="AlignLeft" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                <StackPanel Orientation="Horizontal" Margin="0,18,0,0" HorizontalAlignment="Center">
+                    <Button Margin="0,0,20,0" Content="逆转" Width="32" Height="32"
+                         IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"
+                        Command="{Binding AntiClockwiseCommand}"/>
+                    <Button  Content="顺转" Width="32" Height="32" 
+                          IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"
+                         Command="{Binding ClockwiseCommand}"/>
+                </StackPanel>
+
+                <CompositeControl:SlidComboControl  IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"/>
+                <StackPanel Width="228" HorizontalAlignment="Center"  Margin="0,20,0,0">
+                    <Grid x:Name="GridCrop">
+                        <cus:CustomIconToggleBtn x:Name="BtnCrop" Tag="Crop" BorderBrush="#DFE1E5" BorderThickness="1" Style="{StaticResource ToggleBtnViewModeStyle}" 
+                                             Foreground="Black" ContentStringFormat="156" 
+                                             Command="{Binding CropModeCommand}"
+                                             Visibility="{Binding IsCrop,Converter={StaticResource InvertBoolToVisibleConvert}}"
+                                             
+                                             >
+                            <TextBlock Text="Crop"/>
+                        </cus:CustomIconToggleBtn>
+                        <Grid Visibility="{Binding IsCrop,Converter={StaticResource BoolToVisible}}">
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="*"/>
+                                <ColumnDefinition Width="8"/>
+                                <ColumnDefinition Width="*"/>
+                            </Grid.ColumnDefinitions>
+
+                            <Button Content="Confirm" Background="#1770F4" Height="32" Command="{Binding CropImgCommand}"/>
+                            <Button Grid.Column="2" Content="Cancel" Background="White" BorderBrush="#DFE1E5" BorderThickness="1"
+                                Command="{Binding CancelCropCommand}"
+                                />
+                        </Grid>
+                    </Grid>
+                    <cus:CustomIconToggleBtn x:Name="BtnReplace"  Margin="0,13,0,0" Tag="Replace" BorderBrush="#DFE1E5" BorderThickness="1" Style="{StaticResource ToggleBtnViewModeStyle}" 
+                                         Foreground="Black" ContentStringFormat="156"
+                                         IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"
+                                         Command="{Binding ReplaceImgCommand}"
+                                         >
+                        <TextBlock Text="Replace"/>
+                    </cus:CustomIconToggleBtn>
+
+                    <cus:CustomIconToggleBtn x:Name="BtnExtract" Margin="0,13,0,0" Tag="Extract" BorderBrush="#DFE1E5" BorderThickness="1" Style="{StaticResource ToggleBtnViewModeStyle}" 
+                                         Foreground="Black" ContentStringFormat="156"
+                                         IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"
+                                         Command="{Binding ExportImgCommand}"
+                                         >
+                        <TextBlock Text="Extract"/>
+                    </cus:CustomIconToggleBtn>
+                </StackPanel>
+                <TextBlock x:Name="AlignImg" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,14,0,0" >Align</TextBlock>
+            </StackPanel>
+
+        </Grid>
+
+        <StackPanel Visibility="{Binding IsSelectTextAndImg,Converter={StaticResource BoolToVisible}}">
+            <TextBlock x:Name="GeneralProperties" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,14,0,0" >General Properties</TextBlock>
+            <TextBlock x:Name="AlignTextAndImg" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,14,0,0" >Align</TextBlock>
+        </StackPanel>
+        
+        <Grid x:Name="LayoutAlignGrid" Grid.Row="1" Width="150" HorizontalAlignment="Left" Margin="0,10,0,0">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="*"/>
+                <RowDefinition Height="*"/>
+            </Grid.RowDefinitions>
+
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="*"/>
+                <ColumnDefinition Width="*"/>
+                <ColumnDefinition Width="*"/>
+                <ColumnDefinition Width="*"/>
+            </Grid.ColumnDefinitions>
+
+            <RadioButton x:Name="BtnImgLayoutAlignLeft"  Grid.Row="0" Grid.Column="0" Tag="AlignLeft" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                              IsEnabled="{Binding IsLayoutAlign}"       
                              Style="{DynamicResource GreyBgRadioBtnStyle}" >
-                    <RadioButton.Content>
-                        <Path Margin="5,0,0,0" Data="M2.01367 15V1H3.51367V15H2.01367ZM5 4H11V7H5V4ZM14 9H5V12H14V9Z"
+                <RadioButton.Content>
+                    <Path Margin="5,0,0,0" Data="M2.01367 15V1H3.51367V15H2.01367ZM5 4H11V7H5V4ZM14 9H5V12H14V9Z"
                               Fill="{Binding ElementName=BtnImgLayoutAlignLeft,Path=Foreground}"/>
-                    </RadioButton.Content>
-                    <i:Interaction.Triggers>
-                        <i:EventTrigger EventName="Checked">
-                            <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignLeft,Path=Tag}"/>
-                        </i:EventTrigger>
-                    </i:Interaction.Triggers>
-                </RadioButton>
-
-                <RadioButton x:Name="BtnImgLayoutAlignHorizonCenter"  Grid.Row="0" Grid.Column="1" Tag="AlignHorizonCenter" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                </RadioButton.Content>
+                <i:Interaction.Triggers>
+                    <i:EventTrigger EventName="Checked">
+                        <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignLeft,Path=Tag}"/>
+                    </i:EventTrigger>
+                </i:Interaction.Triggers>
+            </RadioButton>
+
+            <RadioButton x:Name="BtnImgLayoutAlignHorizonCenter"  Grid.Row="0" Grid.Column="1" Tag="AlignHorizonCenter" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                              IsEnabled="{Binding IsLayoutAlign}"           
                              Style="{DynamicResource GreyBgRadioBtnStyle}" >
-                    <RadioButton.Content>
-                        <Path Margin="5,0,0,0" Data="M8.75 7L8.75 9L12 9L12 12L8.75 12L8.75 15L7.25 15L7.25 12L4 12L4 9L7.25 9L7.25 7L2 7L2 4L7.25 4L7.25 0.999999L8.75 1L8.75 4L14 4L14 7L8.75 7Z" 
+                <RadioButton.Content>
+                    <Path Margin="5,0,0,0" Data="M8.75 7L8.75 9L12 9L12 12L8.75 12L8.75 15L7.25 15L7.25 12L4 12L4 9L7.25 9L7.25 7L2 7L2 4L7.25 4L7.25 0.999999L8.75 1L8.75 4L14 4L14 7L8.75 7Z" 
                             Fill="{Binding ElementName=BtnImgLayoutAlignHorizonCenter,Path=Foreground}"/>
-                    </RadioButton.Content>
-                    <i:Interaction.Triggers>
-                        <i:EventTrigger EventName="Checked">
-                            <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignHorizonCenter,Path=Tag}"/>
-                        </i:EventTrigger>
-                    </i:Interaction.Triggers>
-                </RadioButton>
-
-                <RadioButton x:Name="BtnImgLayoutAlignRight"  Grid.Row="0" Grid.Column="2" Tag="AlignRight" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                </RadioButton.Content>
+                <i:Interaction.Triggers>
+                    <i:EventTrigger EventName="Checked">
+                        <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignHorizonCenter,Path=Tag}"/>
+                    </i:EventTrigger>
+                </i:Interaction.Triggers>
+            </RadioButton>
+
+            <RadioButton x:Name="BtnImgLayoutAlignRight"  Grid.Row="0" Grid.Column="2" Tag="AlignRight" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                              IsEnabled="{Binding IsLayoutAlign}"            
                              Style="{DynamicResource GreyBgRadioBtnStyle}" >
-                    <RadioButton.Content>
-                        <Path Margin="5,0,0,0" Data="M14 1L14 15L12.5 15L12.5 1L14 1ZM11 12L2 12L2 9L11 9L11 12ZM4 7L11 7L11 4L4 4L4 7Z" 
+                <RadioButton.Content>
+                    <Path Margin="5,0,0,0" Data="M14 1L14 15L12.5 15L12.5 1L14 1ZM11 12L2 12L2 9L11 9L11 12ZM4 7L11 7L11 4L4 4L4 7Z" 
                                Fill="{Binding ElementName=BtnImgLayoutAlignRight,Path=Foreground}"/>
-                    </RadioButton.Content>
-                    <i:Interaction.Triggers>
-                        <i:EventTrigger EventName="Checked">
-                            <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignRight,Path=Tag}"/>
-                        </i:EventTrigger>
-                    </i:Interaction.Triggers>
-                </RadioButton>
-
-                <RadioButton x:Name="BtnImgLayoutAlignDistributeHorizontal"  Grid.Row="0" Grid.Column="3" Tag="DistributeHorizontal" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                </RadioButton.Content>
+                <i:Interaction.Triggers>
+                    <i:EventTrigger EventName="Checked">
+                        <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignRight,Path=Tag}"/>
+                    </i:EventTrigger>
+                </i:Interaction.Triggers>
+            </RadioButton>
+
+            <RadioButton x:Name="BtnImgLayoutAlignDistributeHorizontal"  Grid.Row="0" Grid.Column="3" Tag="DistributeHorizontal" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                              IsEnabled="{Binding IsLayoutAvgAlign}"         
                              Style="{DynamicResource GreyBgRadioBtnStyle}" >
-                    <RadioButton.Content>
-                        <Path Margin="5,0,0,0" Data="M15 12.5L1 12.5L1 14L15 14L15 12.5ZM12 9.5L4 9.5L4 6.5L12 6.5L12 9.5ZM1 2L15 2L15 3.5L1 3.5L1 2Z" 
+                <RadioButton.Content>
+                    <Path Margin="5,0,0,0" Data="M15 12.5L1 12.5L1 14L15 14L15 12.5ZM12 9.5L4 9.5L4 6.5L12 6.5L12 9.5ZM1 2L15 2L15 3.5L1 3.5L1 2Z" 
                               Fill="{Binding ElementName=BtnImgLayoutAlignDistributeHorizontal,Path=Foreground}"/>
-                    </RadioButton.Content>
-                    <i:Interaction.Triggers>
-                        <i:EventTrigger EventName="Checked">
-                            <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignDistributeHorizontal,Path=Tag}"/>
-                        </i:EventTrigger>
-                    </i:Interaction.Triggers>
-                </RadioButton>
-
-                <RadioButton x:Name="BtnImgLayoutAlignTop"  Grid.Row="1" Grid.Column="0" Tag="AlignTop" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                </RadioButton.Content>
+                <i:Interaction.Triggers>
+                    <i:EventTrigger EventName="Checked">
+                        <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignDistributeHorizontal,Path=Tag}"/>
+                    </i:EventTrigger>
+                </i:Interaction.Triggers>
+            </RadioButton>
+
+            <RadioButton x:Name="BtnImgLayoutAlignTop"  Grid.Row="1" Grid.Column="0" Tag="AlignTop" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                              IsEnabled="{Binding IsLayoutAlign}"           
                              Style="{DynamicResource GreyBgRadioBtnStyle}" >
-                    <RadioButton.Content>
-                        <Path Margin="5,0,0,0" Data="M15 2L1 2L1 3.5L15 3.5L15 2ZM12 5L12 11L9 11L9 5L12 5ZM7 5L7 14L4 14L4 5L7 5Z"
+                <RadioButton.Content>
+                    <Path Margin="5,0,0,0" Data="M15 2L1 2L1 3.5L15 3.5L15 2ZM12 5L12 11L9 11L9 5L12 5ZM7 5L7 14L4 14L4 5L7 5Z"
                               Fill="{Binding ElementName=BtnImgLayoutAlignTop,Path=Foreground}"/>
-                    </RadioButton.Content>
-                    <i:Interaction.Triggers>
-                        <i:EventTrigger EventName="Checked">
-                            <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignTop,Path=Tag}"/>
-                        </i:EventTrigger>
-                    </i:Interaction.Triggers>
-                </RadioButton>
-
-                <RadioButton x:Name="BtnImgLayoutAlignVerticalCenter"  Grid.Row="1" Grid.Column="1" Tag="AlignVerticalCenter" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                </RadioButton.Content>
+                <i:Interaction.Triggers>
+                    <i:EventTrigger EventName="Checked">
+                        <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignTop,Path=Tag}"/>
+                    </i:EventTrigger>
+                </i:Interaction.Triggers>
+            </RadioButton>
+
+            <RadioButton x:Name="BtnImgLayoutAlignVerticalCenter"  Grid.Row="1" Grid.Column="1" Tag="AlignVerticalCenter" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                              IsEnabled="{Binding IsLayoutAlign}"           
                              Style="{DynamicResource GreyBgRadioBtnStyle}" >
-                    <RadioButton.Content>
-                        <Path Margin="5,0,0,0" Data="M7 7.25L9 7.25L9 4L12 4L12 7.25L15 7.25L15 8.75L12 8.75L12 12L9 12L9 8.75L7 8.75L7 14L4 14L4 8.75L1 8.75L1 7.25L4 7.25L4 2L7 2L7 7.25Z" 
+                <RadioButton.Content>
+                    <Path Margin="5,0,0,0" Data="M7 7.25L9 7.25L9 4L12 4L12 7.25L15 7.25L15 8.75L12 8.75L12 12L9 12L9 8.75L7 8.75L7 14L4 14L4 8.75L1 8.75L1 7.25L4 7.25L4 2L7 2L7 7.25Z" 
                               Fill="{Binding ElementName=BtnImgLayoutAlignVerticalCenter,Path=Foreground}"/>
-                    </RadioButton.Content>
-                    <i:Interaction.Triggers>
-                        <i:EventTrigger EventName="Checked">
-                            <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignVerticalCenter,Path=Tag}"/>
-                        </i:EventTrigger>
-                    </i:Interaction.Triggers>
-                </RadioButton>
-
-                <RadioButton x:Name="BtnImgLayoutAlignBottom"  Grid.Row="1" Grid.Column="2" Tag="AlignBottom" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
+                </RadioButton.Content>
+                <i:Interaction.Triggers>
+                    <i:EventTrigger EventName="Checked">
+                        <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignVerticalCenter,Path=Tag}"/>
+                    </i:EventTrigger>
+                </i:Interaction.Triggers>
+            </RadioButton>
+
+            <RadioButton x:Name="BtnImgLayoutAlignBottom"  Grid.Row="1" Grid.Column="2" Tag="AlignBottom" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"
                              IsEnabled="{Binding IsLayoutAlign}"         
                              Style="{DynamicResource GreyBgRadioBtnStyle}" >
-                    <RadioButton.Content>
-                        <Path Margin="5,0,0,0" Data="M9 2H12V11H9V2ZM4 5H7V11H4V5ZM1 14H15V12.5H1V14Z" 
+                <RadioButton.Content>
+                    <Path Margin="5,0,0,0" Data="M9 2H12V11H9V2ZM4 5H7V11H4V5ZM1 14H15V12.5H1V14Z" 
                               Fill="{Binding ElementName=BtnImgLayoutAlignBottom,Path=Foreground}"/>
-                    </RadioButton.Content>
-                    <i:Interaction.Triggers>
-                        <i:EventTrigger EventName="Checked">
-                            <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignBottom,Path=Tag}"/>
-                        </i:EventTrigger>
-                    </i:Interaction.Triggers>
-                </RadioButton>
-
-                <RadioButton x:Name="BtnImgLayoutDistributeVertical"  Grid.Row="1" Grid.Column="3" Tag="DistributeVertical" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"     
+                </RadioButton.Content>
+                <i:Interaction.Triggers>
+                    <i:EventTrigger EventName="Checked">
+                        <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutAlignBottom,Path=Tag}"/>
+                    </i:EventTrigger>
+                </i:Interaction.Triggers>
+            </RadioButton>
+
+            <RadioButton x:Name="BtnImgLayoutDistributeVertical"  Grid.Row="1" Grid.Column="3" Tag="DistributeVertical" GroupName="ImgAlign" Width="32" Height="32" Foreground="#616469" Background="Transparent" VerticalContentAlignment="Center"     
                              IsEnabled="{Binding IsLayoutAvgAlign}"
                              Style="{DynamicResource GreyBgRadioBtnStyle}" >
-                    <RadioButton.Content>
-                        <Path Margin="5,0,0,0" Data="M2 15V1H3.5V15H2ZM6.5 4H9.5V12H6.5V4ZM12.5 1V15H14V1H12.5Z"
+                <RadioButton.Content>
+                    <Path Margin="5,0,0,0" Data="M2 15V1H3.5V15H2ZM6.5 4H9.5V12H6.5V4ZM12.5 1V15H14V1H12.5Z"
                               
                               Fill="{Binding ElementName=BtnImgLayoutDistributeVertical,Path=Foreground}"/>
-                    </RadioButton.Content>
-                    <i:Interaction.Triggers>
-                        <i:EventTrigger EventName="Checked">
-                            <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutDistributeVertical,Path=Tag}"/>
-                        </i:EventTrigger>
-                    </i:Interaction.Triggers>
-                </RadioButton>
-
-
-            </Grid>
-
-        </StackPanel>
-
-        <StackPanel Visibility="{Binding IsTextEdit,Converter={StaticResource InvertBoolToVisibleConvert}}">
-            <TextBlock Name="AnnotTypeTitle1" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="18" LineHeight="24" HorizontalAlignment="Left" Margin="10,8,0,0">Image</TextBlock>
-            <Border Width="228" Height="100" BorderThickness="1" CornerRadius="2" BorderBrush="#DDDDDD" Background="White" Margin="0,8,0,0">
-                <Grid>
-                    <Border Name="FreeTextBorder1" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="5" >
-                        <Image x:Name="ImgExmple" Source="{Binding CurrentImg}">
-                            <Image.RenderTransform>
-                                <RotateTransform x:Name="test"  Angle="{Binding Angle}"/>
-                            </Image.RenderTransform>
-                        </Image>
-                    </Border>
-                </Grid>
-            </Border>
-            <StackPanel Orientation="Horizontal" Margin="0,18,0,0" HorizontalAlignment="Center">
-                <Button Margin="0,0,20,0" Content="逆转" Width="32" Height="32"
-                         IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"
-                        Command="{Binding AntiClockwiseCommand}"/>
-                <Button  Content="顺转" Width="32" Height="32" 
-                          IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"
-                         Command="{Binding ClockwiseCommand}"/>
-            </StackPanel>
-
-            <CompositeControl:SlidComboControl  IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"/>
-            <StackPanel Width="228" HorizontalAlignment="Center"  Margin="0,20,0,0">
-                <Grid x:Name="GridCrop">
-                    <cus:CustomIconToggleBtn x:Name="BtnCrop" Tag="Crop" BorderBrush="#DFE1E5" BorderThickness="1" Style="{StaticResource ToggleBtnViewModeStyle}" 
-                                             Foreground="Black" ContentStringFormat="156" 
-                                             Command="{Binding CropModeCommand}"
-                                             Visibility="{Binding IsCrop,Converter={StaticResource InvertBoolToVisibleConvert}}"
-                                             
-                                             >
-                        <TextBlock Text="Crop"/>
-                    </cus:CustomIconToggleBtn>
-                    <Grid Visibility="{Binding IsCrop,Converter={StaticResource BoolToVisible}}">
-                        <Grid.ColumnDefinitions>
-                            <ColumnDefinition Width="*"/>
-                            <ColumnDefinition Width="8"/>
-                            <ColumnDefinition Width="*"/>
-                        </Grid.ColumnDefinitions>
-
-                        <Button Content="Confirm" Background="#1770F4" Height="32" Command="{Binding CropImgCommand}"/>
-                        <Button Grid.Column="2" Content="Cancel" Background="White" BorderBrush="#DFE1E5" BorderThickness="1"
-                                Command="{Binding CancelCropCommand}"
-                                />
-                    </Grid>
-                </Grid>
-                <cus:CustomIconToggleBtn x:Name="BtnReplace"  Margin="0,13,0,0" Tag="Replace" BorderBrush="#DFE1E5" BorderThickness="1" Style="{StaticResource ToggleBtnViewModeStyle}" 
-                                         Foreground="Black" ContentStringFormat="156"
-                                         IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"
-                                         Command="{Binding ReplaceImgCommand}"
-                                         >
-                    <TextBlock Text="Replace"/>
-                </cus:CustomIconToggleBtn>
-
-                <cus:CustomIconToggleBtn x:Name="BtnExtract" Margin="0,13,0,0" Tag="Extract" BorderBrush="#DFE1E5" BorderThickness="1" Style="{StaticResource ToggleBtnViewModeStyle}" 
-                                         Foreground="Black" ContentStringFormat="156"
-                                         IsEnabled="{Binding IsCrop,Converter={StaticResource InvertBoolConvert}}"
-                                         Command="{Binding ExportImgCommand}"
-                                         >
-                    <TextBlock Text="Extract"/>
-                </cus:CustomIconToggleBtn>
-            </StackPanel>
-        </StackPanel>
+                </RadioButton.Content>
+                <i:Interaction.Triggers>
+                    <i:EventTrigger EventName="Checked">
+                        <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=BtnImgLayoutDistributeVertical,Path=Tag}"/>
+                    </i:EventTrigger>
+                </i:Interaction.Triggers>
+            </RadioButton>
+
+        </Grid>
     </Grid>
 </UserControl>