Просмотр исходного кода

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

# Conflicts:
#	PDF Office/ViewModels/BOTA/OutLineControlViewModel.cs
ZhouJieSheng 2 лет назад
Родитель
Сommit
9c6a35d5e3
88 измененных файлов с 6713 добавлено и 1351 удалено
  1. 6 4
      PDF Office/App.xaml.cs
  2. 66 44
      PDF Office/CustomControl/CompositeControl/ColorContent.xaml
  3. 26 15
      PDF Office/CustomControl/CompositeControl/SlidContent.xaml
  4. 31 0
      PDF Office/DataConvert/AnnotateFontSizeConverter.cs
  5. 38 0
      PDF Office/DataConvert/BoolToTextWrapConvert.cs
  6. 38 0
      PDF Office/DataConvert/CreateTimeToDate.cs
  7. 48 0
      PDF Office/DataConvert/GroupHeaderConverter.cs
  8. 37 0
      PDF Office/DataConvert/IntAndTagToBoolMultiBinding.cs
  9. 27 0
      PDF Office/DataConvert/IntToBooleanConvert.cs
  10. 57 0
      PDF Office/DataConvert/StringToDateConvert.cs
  11. 22 0
      PDF Office/Model/AnnotPanel/Stamp.cs
  12. 29 0
      PDF Office/Model/BOTA/AnnotationHandlerEventArgs.cs
  13. 14 1
      PDF Office/Model/DialogNames.cs
  14. 12 2
      PDF Office/Model/ParameterNames.cs
  15. 16 0
      PDF Office/Model/RegionNames.cs
  16. 81 2
      PDF Office/PDF Office.csproj
  17. 14 1
      PDF Office/Properties/Settings.Designer.cs
  18. BIN
      PDF Office/Resources/BOTA/Annotation/Arrow.png
  19. BIN
      PDF Office/Resources/BOTA/Annotation/Bookmark.png
  20. BIN
      PDF Office/Resources/BOTA/Annotation/Circle.png
  21. BIN
      PDF Office/Resources/BOTA/Annotation/Freehande.png
  22. BIN
      PDF Office/Resources/BOTA/Annotation/Freehande2.png
  23. BIN
      PDF Office/Resources/BOTA/Annotation/Hand.png
  24. BIN
      PDF Office/Resources/BOTA/Annotation/Highlight.png
  25. BIN
      PDF Office/Resources/BOTA/Annotation/Hyperlink.png
  26. BIN
      PDF Office/Resources/BOTA/Annotation/Image.png
  27. BIN
      PDF Office/Resources/BOTA/Annotation/Line.png
  28. BIN
      PDF Office/Resources/BOTA/Annotation/Note.png
  29. BIN
      PDF Office/Resources/BOTA/Annotation/Point.png
  30. BIN
      PDF Office/Resources/BOTA/Annotation/Rectangle.png
  31. BIN
      PDF Office/Resources/BOTA/Annotation/Selecttool.png
  32. BIN
      PDF Office/Resources/BOTA/Annotation/Stamp.png
  33. BIN
      PDF Office/Resources/BOTA/Annotation/Textbox.png
  34. BIN
      PDF Office/Resources/BOTA/Annotation/wavyline2.png
  35. BIN
      PDF Office/Resources/BOTA/empty_annotation.png
  36. 34 5
      PDF Office/Styles/ButtonStyle.xaml
  37. 47 0
      PDF Office/Styles/ComboxStyle.xaml
  38. 23 0
      PDF Office/Styles/ContextMenuStyle.xaml
  39. 110 9
      PDF Office/Styles/CustomBtnStyle.xaml
  40. 284 34
      PDF Office/Styles/ExpanderStyle.xaml
  41. 56 3
      PDF Office/Styles/ListViewStyle.xaml
  42. 4 4
      PDF Office/Styles/PathButtonStyle.xaml
  43. 302 423
      PDF Office/Styles/SliderStyle.xaml
  44. 483 0
      PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs
  45. 171 0
      PDF Office/ViewModels/BOTA/AnnotationListItemViewModel.cs
  46. 4 3
      PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs
  47. 5 0
      PDF Office/ViewModels/BOTA/BookmarkContentViewModel.cs
  48. 1 1
      PDF Office/ViewModels/BOTA/OutLineControlViewModel.cs
  49. 197 0
      PDF Office/ViewModels/Dialog/BOTA/AddAnnotationDialogViewModel.cs
  50. 437 0
      PDF Office/ViewModels/Dialog/BOTA/ScreenAnnotationDialogViewModel.cs
  51. 4 99
      PDF Office/ViewModels/HomePanel/HomeGuidContentViewModel.cs
  52. 78 0
      PDF Office/ViewModels/HomePanel/PDFTools/PDFToolsContentViewModel.cs
  53. 222 0
      PDF Office/ViewModels/HomePanel/PDFTools/QuickToolsContentViewModel.cs
  54. 198 8
      PDF Office/ViewModels/PropertyPanel/AnnotPanel/CustomCreateDialogViewModel.cs
  55. 170 33
      PDF Office/ViewModels/PropertyPanel/AnnotPanel/StampAnnotPropertyViewModel.cs
  56. 1 0
      PDF Office/ViewModels/PropertyPanel/ViewModular/ReadModeContentViewModel.cs
  57. 213 0
      PDF Office/ViewModels/PropertyPanel/ViewModular/ReadViewContentViewModel.cs
  58. 69 2
      PDF Office/ViewModels/ViewContentViewModel.cs
  59. 301 0
      PDF Office/Views/BOTA/AnnotationContent.xaml
  60. 239 0
      PDF Office/Views/BOTA/AnnotationContent.xaml.cs
  61. 351 0
      PDF Office/Views/BOTA/AnnotationListItem.xaml
  62. 208 0
      PDF Office/Views/BOTA/AnnotationListItem.xaml.cs
  63. 27 15
      PDF Office/Views/BOTA/BookmarkContent.xaml
  64. 307 0
      PDF Office/Views/Dialog/BOTA/AddAnnotationDialog.xaml
  65. 28 0
      PDF Office/Views/Dialog/BOTA/AddAnnotationDialog.xaml.cs
  66. 448 0
      PDF Office/Views/Dialog/BOTA/ScreenAnnotationDialog.xaml
  67. 28 0
      PDF Office/Views/Dialog/BOTA/ScreenAnnotationDialog.xaml.cs
  68. 43 0
      PDF Office/Views/HomePanel/PDFTools/PDFToolExpendItem.xaml
  69. 81 0
      PDF Office/Views/HomePanel/PDFTools/PDFToolExpendItem.xaml.cs
  70. 2 36
      PDF Office/Views/HomePanel/PDFTools/PDFToolItem.xaml
  71. 1 140
      PDF Office/Views/HomePanel/PDFTools/PDFToolItem.xaml.cs
  72. 59 11
      PDF Office/Views/HomePanel/PDFTools/PDFToolsContent.xaml
  73. 128 38
      PDF Office/Views/HomePanel/PDFTools/PDFToolsContent.xaml.cs
  74. 26 12
      PDF Office/Views/HomePanel/PDFTools/QuickToolsContent.xaml
  75. 65 34
      PDF Office/Views/HomePanel/PDFTools/QuickToolsContent.xaml.cs
  76. 93 107
      PDF Office/Views/HomePanel/RecentFiles/RecentFilesContent.xaml
  77. 122 17
      PDF Office/Views/PropertyPanel/AnnotPanel/CustomCreateDialog.xaml
  78. 2 1
      PDF Office/Views/PropertyPanel/AnnotPanel/CustomCreateDialog.xaml.cs
  79. 290 96
      PDF Office/Views/PropertyPanel/AnnotPanel/SharpsAnnotProperty.xaml
  80. 14 2
      PDF Office/Views/PropertyPanel/AnnotPanel/StampAnnotProperty.xaml
  81. 17 0
      PDF Office/Views/PropertyPanel/AnnotPanel/StampAnnotProperty.xaml.cs
  82. 26 19
      PDF Office/Views/PropertyPanel/TextEditProperty.xaml
  83. 53 0
      PDF Office/Views/PropertyPanel/ViewModular/ReadViewContent.xaml
  84. 63 0
      PDF Office/Views/PropertyPanel/ViewModular/ReadViewContent.xaml.cs
  85. 3 3
      PDF Office/Views/PropertyPanel/ViewModular/ViewModularContent.xaml.cs
  86. 4 34
      PDF Office/Views/ViewContent.xaml
  87. 7 93
      PDF Office/Views/ViewContent.xaml.cs
  88. 2 0
      PDFSettings/CustomStampList.cs

+ 6 - 4
PDF Office/App.xaml.cs

@@ -38,9 +38,11 @@ using PDF_Office.Views.FillAndSign.PropertyPanel;
 using PDF_Office.Views.PropertyPanel.ViewModular;
 using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
 using PDF_Office.Views.Dialog.ConverterDialogs;
+
 using PDF_Office.Helper;
+
 using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageConverter;
-using PDF_Office.Views.EditTools.Watermark; 
+using PDF_Office.Views.EditTools.Watermark;
 using PDF_Office.Views.EditTools.Background;
 using PDF_Office.Views.EditTools.Bates;
 using PDF_Office.Views.EditTools.HeaderFooter;
@@ -89,7 +91,6 @@ namespace PDF_Office
 
             if (Settings.Default.QuickPDFToolsList == null)
                 Settings.Default.QuickPDFToolsList = new PDFSettings.QuickPDFToolsList();
-
         }
 
         protected override void OnStartup(StartupEventArgs e)
@@ -155,7 +156,8 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<SplitScreenContent>();
             containerRegistry.RegisterForNavigation<ThemesContent>();
             containerRegistry.RegisterForNavigation<ReadModeContent>();
-
+            containerRegistry.RegisterForNavigation<AnnotationContent>();
+            containerRegistry.RegisterForNavigation<ReadViewContent>();
 
             containerRegistry.RegisterForNavigation<HomePagePrinterModSizeContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModPosterContent>();
@@ -250,7 +252,7 @@ namespace PDF_Office
             containerRegistry.RegisterDialog<ConverterRTFDialog>(DialogNames.ConverterRTFDialog);
             containerRegistry.RegisterDialog<ConverterExcelDialog>(DialogNames.ConverterExcelDialog);
             containerRegistry.RegisterDialog<ConverterProgressBarDialog>(DialogNames.ConverterProgressBarDialog);
-
+            containerRegistry.RegisterDialog<ScreenAnnotationDialog>(DialogNames.ScreenAnnotationDialog);
 
             #endregion 注册弹窗
         }

+ 66 - 44
PDF Office/CustomControl/CompositeControl/ColorContent.xaml

@@ -1,72 +1,94 @@
-<UserControl x:Class="PDF_Office.CustomControl.CompositeControl.ColorContent"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             xmlns:local="clr-namespace:PDF_Office.CustomControl.CompositeControl"
-             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
-             mc:Ignorable="d" 
-             d:DesignHeight="450" d:DesignWidth="800">
+<UserControl
+    x:Class="PDF_Office.CustomControl.CompositeControl.ColorContent"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:local="clr-namespace:PDF_Office.CustomControl.CompositeControl"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    mc:Ignorable="d">
     <UserControl.Resources>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
-                <ResourceDictionary Source="../../Styles/CustomBtnStyle.xaml"/>
+                <ResourceDictionary Source="../../Styles/CustomBtnStyle.xaml" />
             </ResourceDictionary.MergedDictionaries>
             <DataTemplate x:Key="listboxData">
-                <Ellipse Height="20" Width="20" Fill="{Binding Color}"/>
+                <Ellipse
+                    Width="20"
+                    Height="20"
+                    Fill="{Binding Color}" />
             </DataTemplate>
-            
+
             <ContextMenu x:Key="FlyoutMenu" FontSize="14">
                 <ContextMenu.ItemContainerStyle>
                     <Style TargetType="MenuItem">
-                        <Setter Property="Padding" Value="0,7,0,7"/>
-                        <Setter Property="VerticalContentAlignment" Value="Center"/>
+                        <Setter Property="Padding" Value="0,7,0,7" />
+                        <Setter Property="VerticalContentAlignment" Value="Center" />
                     </Style>
                 </ContextMenu.ItemContainerStyle>
-                <MenuItem Name="ChangeColorMenuItem" Click="ChangeColorMenuItem_Click" Header="更改颜色" IsEnabled="True">
-                </MenuItem>
-                <MenuItem Name="BackColorMenuItem" Click="BackColorMenuItem_Click"  Header="恢复默认颜色"  IsEnabled="True">
-                </MenuItem>
+                <MenuItem
+                    Name="ChangeColorMenuItem"
+                    Click="ChangeColorMenuItem_Click"
+                    Header="更改颜色"
+                    IsEnabled="True" />
+                <MenuItem
+                    Name="BackColorMenuItem"
+                    Click="BackColorMenuItem_Click"
+                    Header="恢复默认颜色"
+                    IsEnabled="True" />
             </ContextMenu>
 
             <Style x:Key="listboxItemStyle" TargetType="{x:Type ListBoxItem}">
-                <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
-                <Setter Property="HorizontalContentAlignment" Value="Center"/>
-                <Setter Property="Height" Value="32"/>
-                <Setter Property="Margin" Value="2,0,2,0"/>
-                <EventSetter Event="PreviewMouseRightButtonDown"
-                             Handler="listboxItem_PreviewMouseRightButtonDown"/>
+                <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}" />
+                <Setter Property="HorizontalContentAlignment" Value="Center" />
+                <Setter Property="Height" Value="32" />
+                <Setter Property="Margin" Value="2,0,2,0" />
+                <EventSetter Event="PreviewMouseRightButtonDown" Handler="listboxItem_PreviewMouseRightButtonDown" />
             </Style>
         </ResourceDictionary>
     </UserControl.Resources>
-    <Grid >
+    <Grid>
         <Grid.ColumnDefinitions>
-            <ColumnDefinition Width="*"></ColumnDefinition>
-            <ColumnDefinition Width="auto"></ColumnDefinition>
+            <ColumnDefinition Width="*" />
+            <ColumnDefinition Width="auto" />
         </Grid.ColumnDefinitions>
-        <Border Width="56" Height="32" Grid.Column="1" Margin="0,0,5,0" BorderThickness="1" CornerRadius="4" BorderBrush="#E2E3E6"  HorizontalAlignment="Right" >
+        <Border
+            Grid.Column="1"
+            Width="56"
+            Height="32"
+            Margin="0,0,5,0"
+            HorizontalAlignment="Right"
+            BorderBrush="#E2E3E6"
+            BorderThickness="1"
+            CornerRadius="4">
             <StackPanel Orientation="Horizontal">
 
-                <Ellipse x:Name="ElcustomColor" Fill="Transparent" Width="20" Height="20" StrokeThickness="1"
-                         PreviewMouseLeftButtonDown="ElcustomColor_PreviewMouseLeftButtonDown">
-                    <Ellipse.Stroke>
-                        <SolidColorBrush Color="#000000" Opacity="0.1"/>
-                    </Ellipse.Stroke>
-                </Ellipse>
-                <cus:ColorDropBox x:Name="ColorDropPicker" SelectedColorChanged="ColorDropPicker_SelectedColorChanged">
-                </cus:ColorDropBox>
+                <Ellipse
+                    x:Name="ElcustomColor"
+                    Width="20"
+                    Height="20"
+                    Fill="Transparent"
+                    PreviewMouseLeftButtonDown="ElcustomColor_PreviewMouseLeftButtonDown" />
+                <cus:ColorDropBox x:Name="ColorDropPicker" SelectedColorChanged="ColorDropPicker_SelectedColorChanged" />
             </StackPanel>
         </Border>
-        <cus:ColorDropBox x:Name="PnlColor" SelectedColorChanged="PnlColor_SelectedColorChanged" Opacity="0">
-        </cus:ColorDropBox>
-        
-        <ListBox x:Name="ListColor"  BorderThickness="0" Background="Transparent" 
-                 SelectionChanged="ListColor_SelectionChanged"
-                 ItemContainerStyle="{StaticResource listboxItemStyle}" ItemTemplate="{StaticResource listboxData}"
-                 >
+        <cus:ColorDropBox
+            x:Name="PnlColor"
+            Opacity="0"
+            SelectedColorChanged="PnlColor_SelectedColorChanged" />
+
+        <ListBox
+            x:Name="ListColor"
+            Background="Transparent"
+            BorderThickness="0"
+            ItemContainerStyle="{StaticResource listboxItemStyle}"
+            ItemTemplate="{StaticResource listboxData}"
+            SelectionChanged="ListColor_SelectionChanged">
             <ListBox.ItemsPanel>
                 <ItemsPanelTemplate>
-                    <WrapPanel Orientation="Horizontal"/>
+                    <WrapPanel Orientation="Horizontal" />
                 </ItemsPanelTemplate>
             </ListBox.ItemsPanel>
         </ListBox>

Разница между файлами не показана из-за своего большого размера
+ 26 - 15
PDF Office/CustomControl/CompositeControl/SlidContent.xaml


+ 31 - 0
PDF Office/DataConvert/AnnotateFontSizeConverter.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace PDF_Office.DataConvert
+{
+    public class AnnotateFontSizeConverter : IValueConverter
+    {
+        //用于注释列表的字体   作者和日期的日期比正文日期小两个规格
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if ((double)value <= 0)
+            {
+                return null;
+            }
+            else
+            {
+                return (double)value - 2;
+            }
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 38 - 0
PDF Office/DataConvert/BoolToTextWrapConvert.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows;
+
+namespace PDF_Office.DataConvert
+{
+    public class BoolToTextWrapConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value == null)
+            {
+                return TextWrapping.NoWrap;
+            }
+            else
+            {
+                if ((bool)value)
+                {
+                    return TextWrapping.Wrap;
+                }
+                else
+                {
+                    return TextWrapping.NoWrap;
+                }
+            }
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 38 - 0
PDF Office/DataConvert/CreateTimeToDate.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace PDF_Office.DataConvert
+{
+    public class CreateTimeToDate : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (string.IsNullOrEmpty(value.ToString()))
+            {
+                //没有时间得返回系统当前时间
+                return System.DateTime.Now.ToString("yyyyMMdd");
+            }
+            else
+            {
+                //部分日期不正常 需要进一步处理
+                string dateStr = Regex.Match(value.ToString(), "(?<=D\\:)[0-9]+(?=[\\+\\-])").Value;
+                if (string.IsNullOrEmpty(dateStr))//日期不合格时 显示当前系统日期
+                {
+                    dateStr = System.DateTime.Now.ToString("yyyyMMdd");
+                }
+                return dateStr.Substring(0, 8);
+            }
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 48 - 0
PDF Office/DataConvert/GroupHeaderConverter.cs

@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace PDF_Office.DataConvert
+{
+    public class GroupHeaderConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value == null || string.IsNullOrEmpty(value.ToString())) return null;
+            if (value.ToString().Length == 8)//日期
+            {
+                string dateStr = value.ToString();
+                string text = dateStr.Substring(0, 4) + "-" + dateStr.Substring(4, 2) + "-" + dateStr.Substring(6, 2);
+                return text;
+            }
+            else//页码
+            {
+                try
+                {
+                    string page = "Page ";
+                    if ((int)value == -1)
+                    {
+                        return null;
+                    }
+                    else
+                    {
+                        return page + ((int)value + 1).ToString();
+                    }
+                }
+                catch (Exception ex)
+                {
+                    return null;
+                }
+            }
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 37 - 0
PDF Office/DataConvert/IntAndTagToBoolMultiBinding.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace PDF_Office.DataConvert
+{
+    class IntAndTagToBoolMultiBinding : IMultiValueConverter
+    {
+        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (values[0] == null|| values[1]==null)
+            {
+                return false;
+            }
+            else
+            {
+                if (values[0].ToString()== values[1].ToString())
+                {
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
+            }
+        }
+
+        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 27 - 0
PDF Office/DataConvert/IntToBooleanConvert.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace PDF_Office.DataConvert
+{
+    public class IntToBooleanConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value is int && ((int)value) > 0)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 57 - 0
PDF Office/DataConvert/StringToDateConvert.cs

@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace PDF_Office.DataConvert
+{
+    /// <summary>
+    /// 用于注释 书签等的时间转换
+    /// </summary>
+    public class StringToDateConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            string date = "";
+            if (string.IsNullOrEmpty((string)value) || !Regex.IsMatch(value.ToString(), "(?<=D\\:)[0-9]+(?=[\\+\\-])"))
+            {
+                date = System.DateTime.Now.ToString("HH:mm");
+            }
+            else if (Regex.IsMatch(value.ToString(), "(?<=D\\:)[0-9]+(?=[\\+\\-])"))
+            {
+                string dateStr = Regex.Match(value.ToString(), "(?<=D\\:)[0-9]+(?=[\\+\\-])").Value;
+
+                #region to do
+
+                if (string.Equals(dateStr.Substring(4, 4), DateTime.Now.ToString("MMdd")))
+                {//同天
+                    date = dateStr.Substring(8, 2) + ":" + dateStr.Substring(10, 2);
+                }
+                else if (string.Equals(dateStr.Substring(0, 4), DateTime.Now.ToString("yyyy")))
+                {//同年
+                    date = dateStr.Substring(4, 2) + "/" + dateStr.Substring(6, 2) + " " + dateStr.Substring(8, 2) + ":" +
+                   dateStr.Substring(10, 2);
+                }
+                else
+                {
+                    date = dateStr.Substring(0, 4) + "/" + dateStr.Substring(4, 2) + "/" + dateStr.Substring(6, 2) + " " + dateStr.Substring(8, 2) + ":" +
+                    dateStr.Substring(10, 2);
+                }
+
+                #endregion to do
+
+                //date = dateStr.Substring(4, 2) + "-" + dateStr.Substring(6, 2) + "   " + dateStr.Substring(8, 2) + ":" + dateStr.Substring(10, 2);
+            }
+            return date;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            return null;
+        }
+    }
+}

+ 22 - 0
PDF Office/Model/AnnotPanel/Stamp.cs

@@ -131,5 +131,27 @@ namespace PDF_Office.Model.AnnotPanel
             }
         }
 
+        private bool isCheckedDate;
+
+        public bool IsCheckedDate
+        {
+            get { return isCheckedDate; }
+            set
+            {
+                SetProperty(ref isCheckedDate, value);
+            }
+        }
+
+        private bool isCheckedTime;
+
+        public bool IsCheckedTime
+        {
+            get { return isCheckedTime; }
+            set
+            {
+                SetProperty(ref isCheckedTime, value);
+            }
+        }
+
     }
 }

+ 29 - 0
PDF Office/Model/BOTA/AnnotationHandlerEventArgs.cs

@@ -0,0 +1,29 @@
+using ComPDFKit.PDFDocument;
+using ComPDFKitViewer.AnnotEvent;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media.Imaging;
+
+namespace PDF_Office.Model.BOTA
+{
+    public class AnnotationHandlerEventArgs : EventArgs
+    {
+        public string Content { get; set; }
+        public string MarkupContent { get; set; }
+        public string Author { get; set; }
+        public string CreateTime { get; set; }
+        public string UpdateTime { get; set; }
+        public AnnotArgsType EventType { get; set; }
+        public bool Locked { get; set; }
+        public bool ReadOnly { get; set; }
+        public ComPDFKitViewer.FormField FormField { get; set; }
+        public int PageIndex { get; set; }
+        public int AnnotIndex { get; set; }
+        public AnnotHandlerEventArgs AnnotHandlerEventArgs { get; set; }
+        public WriteableBitmap WriteableBitmap { get; set; }
+        public CPDFDocument Document { get; set; }
+    }
+}

+ 14 - 1
PDF Office/Model/DialogNames.cs

@@ -95,10 +95,21 @@ namespace PDF_Office.Model
         ///BOTA-书签-添加书签弹窗
         /// </summary>
         public static string AddBookmarkDialog = "AddBookmarkDialog";
+
+        /// <summary>
+        /// BOTA-注释列表-添加笔记
+        /// </summary>
+        public static string AddAnnotationDialog = "AddAnnotationDialog";
+
+        /// <summary>
+        /// BOTA-注释列表-筛选注释
+        /// </summary>
+        public static string ScreenAnnotationDialog = "ScreenAnnotationDialog";
+
         ///<summary>
         ///主页工具-PDF批量工具
         /// </summary>
-        public static string HomePageBatchProcessingDialog ="HomePageBatchProcessingDialog";
+        public static string HomePageBatchProcessingDialog = "HomePageBatchProcessingDialog";
 
         /// <summary>
         /// 注释-图章-动态图章设置弹窗
@@ -114,6 +125,7 @@ namespace PDF_Office.Model
         ///转档-CSVD,PPT,Text,Word,HTML,Img,RTF,Excel弹窗
         /// </summary>
         public static string ConverterCSVDialog = "ConverterCSVDialog";
+
         public static string ConverterPPTDialog = "ConverterPPTDialog";
         public static string ConverterTextDialog = "ConverterTextDialog";
         public static string ConverterWordDialog = "ConverterWordDialog";
@@ -121,6 +133,7 @@ namespace PDF_Office.Model
         public static string ConverterImgDialog = "ConverterImgDialog";
         public static string ConverterRTFDialog = "ConverterRTFDialog";
         public static string ConverterExcelDialog = "ConverterExcelDialog";
+
         ///<summary>
         ///转档进度条弹窗
         /// </summary>

+ 12 - 2
PDF Office/Model/ParameterNames.cs

@@ -12,12 +12,14 @@ namespace PDF_Office.Model
     public static class ParameterNames
     {
         #region ViewModelName
+
         public static string MainViewModel = "MainViewModel";
 
         public static string ViewContentViewModel = "ViewContentViewModel";
 
-        public static string PropertyPanelContentViewModel = "PropertyPanelContentViewModel";
-        #endregion
+        public static string PropertyPanelContentViewModel = "PropertyPanelContentViewModel";
+
+        #endregion ViewModelName
 
         public static string PDFViewer = "PDFViewer";
 
@@ -46,6 +48,14 @@ namespace PDF_Office.Model
 
         public static string BookmarkInfo = "BookmarkInfo";
 
+        /// <summary>
+        /// 注释列表
+        /// </summary>
+
+        public static string Annotation = "Annotation";
+        public static string AnnotEvent = "AnnotEvent";
+        public static string AnnotationList = "AnnotationList";
+
         /// <summary>
         /// 底部工具栏
         /// </summary>

+ 16 - 0
PDF Office/Model/RegionNames.cs

@@ -39,6 +39,14 @@ namespace PDF_Office.Model
             }
         }
 
+        public static string ReadRegionName
+        {
+            get
+            {
+                return GetRegionName("ReadRegionName");
+            }
+        }
+
         /// <summary>
         /// 阅读页PDFViewer 对应的Content RegionName
         /// </summary>
@@ -154,6 +162,14 @@ namespace PDF_Office.Model
             }
         }
 
+        public static string ReadModePageRegionName
+        {
+            get
+            {
+                return GetRegionName("ReadModePageRegionName");
+            }
+        }
+
         /// <summary>
         /// 获取MainWindowsViewModel RegionNames字典里的RegionName,
         /// 如果字典里没有键值就新建一个GUID,并插入到

+ 81 - 2
PDF Office/PDF Office.csproj

@@ -45,11 +45,11 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>.\ComOCRKit.Desk.dll</HintPath>
     </Reference>
-    <Reference Include="ComPDFKit.Desk, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
+    <Reference Include="ComPDFKit.Desk, Version=1.7.0.0, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>.\ComPDFKit.Desk.dll</HintPath>
     </Reference>
-    <Reference Include="ComPDFKit.Viewer, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
+    <Reference Include="ComPDFKit.Viewer, Version=1.7.0.0, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>.\ComPDFKit.Viewer.dll</HintPath>
     </Reference>
@@ -232,11 +232,18 @@
     <Compile Include="CustomControl\WritableComboBox.xaml.cs">
       <DependentUpon>WritableComboBox.xaml</DependentUpon>
     </Compile>
+    <Compile Include="DataConvert\AnnotateFontSizeConverter.cs" />
+    <Compile Include="DataConvert\BoolToTextWrapConvert.cs" />
+    <Compile Include="DataConvert\CreateTimeToDate.cs" />
     <Compile Include="DataConvert\FileFormatToIconConvert.cs" />
+    <Compile Include="DataConvert\GroupHeaderConverter.cs" />
+    <Compile Include="DataConvert\IntToBooleanConvert.cs" />
     <Compile Include="DataConvert\FileToImageSourceConvert.cs" />
+    <Compile Include="DataConvert\IntAndTagToBoolMultiBinding.cs" />
     <Compile Include="DataConvert\InvertBoolConvert.cs" />
     <Compile Include="DataConvert\ObjectConvert.cs" />
     <Compile Include="DataConvert\PropertyPanelVisible.cs" />
+    <Compile Include="DataConvert\StringToDateConvert.cs" />
     <Compile Include="DataConvert\StringToVisibleConvert.cs" />
     <Compile Include="DataConvert\UnVisivleConvert.cs" />
     <Compile Include="DataConvert\WidthConvert.cs" />
@@ -259,6 +266,7 @@
     <Compile Include="Helper\SetterAction.cs" />
     <Compile Include="Helper\SettingHelper.cs" />
     <Compile Include="Helper\ToolMethod.cs" />
+    <Compile Include="Model\BOTA\AnnotationHandlerEventArgs.cs" />
     <Compile Include="Model\AnnotPanel\Stamp.cs" />
     <Compile Include="Model\BOTA\OutlineNode.cs" />
     <Compile Include="Model\CloudDrive\CloudDriveItem.cs" />
@@ -328,11 +336,15 @@
     <Compile Include="ViewModels\EditTools\Bates\BatesCreateContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Bates\BatesDocumentContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Bates\BatesTemplateListContentViewModel.cs" />
+    <Compile Include="ViewModels\BOTA\AnnotationContentViewModel.cs" />
+    <Compile Include="ViewModels\BOTA\AnnotationListItemViewModel.cs" />
     <Compile Include="ViewModels\BOTA\BookmarkContentViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\BOTA\AddAnnotationDialogViewModel.cs" />
     <Compile Include="ViewModels\BOTA\OutLineControlViewModel.cs" />
     <Compile Include="ViewModels\BOTA\SearchContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\BOTA\AddBookmarkDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\BOTA\BookmarkInfoDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\BOTA\ScreenAnnotationDialogViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Background\BackgroundContentViewModel.cs" />
     <Compile Include="ViewModels\BOTA\BOTAContentViewModel.cs" />
     <Compile Include="ViewModels\BottomToolContentViewModel.cs" />
@@ -364,6 +376,9 @@
     <Compile Include="ViewModels\EditTools\Redaction\RedactionContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Redaction\RedactionDocumentContentViewModel.cs" />
     <Compile Include="ViewModels\Form\FormsToolContentViewModel.cs" />
+    <Compile Include="ViewModels\HomePanel\PDFTools\PDFToolsContentViewModel.cs" />
+    <Compile Include="ViewModels\HomePanel\PDFTools\QuickToolsContentViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\ViewModular\ReadViewContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\RecentFiles\RecentFilesContentViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\CustomCreateDialogViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\DynamicPropertyDialogViewModel.cs" />
@@ -434,6 +449,12 @@
     <Compile Include="ViewModels\EditTools\Watermark\WatermarkTemplateListBaseContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Watermark\WatermarkTemplateListFileContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Watermark\WatermarkTemplateListTextContentViewModel.cs" />
+    <Compile Include="Views\BOTA\AnnotationContent.xaml.cs">
+      <DependentUpon>AnnotationContent.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\BOTA\AnnotationListItem.xaml.cs">
+      <DependentUpon>AnnotationListItem.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\BOTA\BookmarkContent.xaml.cs">
       <DependentUpon>BookmarkContent.xaml</DependentUpon>
     </Compile>
@@ -450,6 +471,12 @@
     <Compile Include="Views\BottomToolContent.xaml.cs">
       <DependentUpon>BottomToolContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Dialog\BOTA\AddAnnotationDialog.xaml.cs">
+      <DependentUpon>AddAnnotationDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\BOTA\ScreenAnnotationDialog.xaml.cs">
+      <DependentUpon>ScreenAnnotationDialog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Dialog\ConverterDialogs\ConverterCSVDialog.xaml.cs">
       <DependentUpon>ConverterCSVDialog.xaml</DependentUpon>
     </Compile>
@@ -694,6 +721,9 @@
     <Compile Include="Views\HomePanel\HomeGuidContent.xaml.cs">
       <DependentUpon>HomeGuidContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\HomePanel\PDFTools\PDFToolExpendItem.xaml.cs">
+      <DependentUpon>PDFToolExpendItem.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\HomePanel\PDFTools\PDFToolItem.xaml.cs">
       <DependentUpon>PDFToolItem.xaml</DependentUpon>
     </Compile>
@@ -770,6 +800,9 @@
     <Compile Include="Views\PropertyPanel\ViewModular\ReadModeContent.xaml.cs">
       <DependentUpon>ReadModeContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\PropertyPanel\ViewModular\ReadViewContent.xaml.cs">
+      <DependentUpon>ReadViewContent.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\PropertyPanel\ViewModular\SplitScreenContent.xaml.cs">
       <DependentUpon>SplitScreenContent.xaml</DependentUpon>
     </Compile>
@@ -862,6 +895,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Styles\ContextMenuStyle.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Styles\ContextMenuTextEditStyle.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -930,6 +967,14 @@
       <SubType>Designer</SubType>
       <Generator>XamlIntelliSenseFileGenerator</Generator>
     </Page>
+    <Page Include="Views\BOTA\AnnotationContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\BOTA\AnnotationListItem.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\BOTA\BookmarkContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -950,6 +995,14 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Dialog\BOTA\AddAnnotationDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\BOTA\ScreenAnnotationDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\Dialog\ConverterDialogs\ConverterCSVDialog.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1201,6 +1254,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Views\HomePanel\PDFTools\PDFToolExpendItem.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\PropertyPanel\AnnotPanel\CustomCreateDialog.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1307,6 +1364,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\PropertyPanel\ViewModular\ReadViewContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\PropertyPanel\ViewModular\SplitScreenContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1444,6 +1505,24 @@
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
     </None>
     <None Include="source\AnalysisWord\Res\word\_rels\document.xml.rels" />
+    <Resource Include="Resources\BOTA\Annotation\Arrow.png" />
+    <Resource Include="Resources\BOTA\Annotation\Bookmark.png" />
+    <Resource Include="Resources\BOTA\Annotation\Circle.png" />
+    <Resource Include="Resources\BOTA\Annotation\Freehande.png" />
+    <Resource Include="Resources\BOTA\Annotation\Freehande2.png" />
+    <Resource Include="Resources\BOTA\Annotation\Hand.png" />
+    <Resource Include="Resources\BOTA\Annotation\Highlight.png" />
+    <Resource Include="Resources\BOTA\Annotation\Hyperlink.png" />
+    <Resource Include="Resources\BOTA\Annotation\Image.png" />
+    <Resource Include="Resources\BOTA\Annotation\Line.png" />
+    <Resource Include="Resources\BOTA\Annotation\Note.png" />
+    <Resource Include="Resources\BOTA\Annotation\Point.png" />
+    <Resource Include="Resources\BOTA\Annotation\Rectangle.png" />
+    <Resource Include="Resources\BOTA\Annotation\Selecttool.png" />
+    <Resource Include="Resources\BOTA\Annotation\Stamp.png" />
+    <Resource Include="Resources\BOTA\Annotation\Textbox.png" />
+    <Resource Include="Resources\BOTA\Annotation\wavyline2.png" />
+    <Resource Include="Resources\BOTA\empty_annotation.png" />
     <Resource Include="Resources\HomeIcon\PDFTools\background.png" />
     <Resource Include="Resources\HomeIcon\PDFTools\batch-remove.png" />
     <Resource Include="Resources\HomeIcon\PDFTools\batch.png" />

+ 14 - 1
PDF Office/Properties/Settings.Designer.cs

@@ -22,7 +22,20 @@ namespace PDF_Office.Properties {
                 return defaultInstance;
             }
         }
-        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("10")]
+        public double AnnotateFontSize
+        {
+            get
+            {
+                return ((double)(this["AnnotateFontSize"]));
+            }
+            set
+            {
+                this["AnnotateFontSize"] = value;
+            }
+        }
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
         public global::PDFSettings.Settings.RecentOpenFiles RecentOpenFiles {

BIN
PDF Office/Resources/BOTA/Annotation/Arrow.png


BIN
PDF Office/Resources/BOTA/Annotation/Bookmark.png


BIN
PDF Office/Resources/BOTA/Annotation/Circle.png


BIN
PDF Office/Resources/BOTA/Annotation/Freehande.png


BIN
PDF Office/Resources/BOTA/Annotation/Freehande2.png


BIN
PDF Office/Resources/BOTA/Annotation/Hand.png


BIN
PDF Office/Resources/BOTA/Annotation/Highlight.png


BIN
PDF Office/Resources/BOTA/Annotation/Hyperlink.png


BIN
PDF Office/Resources/BOTA/Annotation/Image.png


BIN
PDF Office/Resources/BOTA/Annotation/Line.png


BIN
PDF Office/Resources/BOTA/Annotation/Note.png


BIN
PDF Office/Resources/BOTA/Annotation/Point.png


BIN
PDF Office/Resources/BOTA/Annotation/Rectangle.png


BIN
PDF Office/Resources/BOTA/Annotation/Selecttool.png


BIN
PDF Office/Resources/BOTA/Annotation/Stamp.png


BIN
PDF Office/Resources/BOTA/Annotation/Textbox.png


BIN
PDF Office/Resources/BOTA/Annotation/wavyline2.png


BIN
PDF Office/Resources/BOTA/empty_annotation.png


+ 34 - 5
PDF Office/Styles/ButtonStyle.xaml

@@ -1,4 +1,5 @@
 <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
     <Style x:Key="FocusVisual">
         <Setter Property="Control.Template">
             <Setter.Value>
@@ -13,7 +14,37 @@
             </Setter.Value>
         </Setter>
     </Style>
-
+    <Style x:Key="PageEditToolBtn" BasedOn="{StaticResource TitleBarBtn}" TargetType="{x:Type Button}">
+        <Setter Property="Background" Value="Transparent" />
+        <Setter Property="BorderBrush" Value="Transparent" />
+        <Setter Property="Width" Value="auto" />
+        <Setter Property="Height" Value="40" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type Button}">
+                    <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
+                        <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="true">
+                            <Setter Property="Background" TargetName="border" Value="#1A000000" />
+                            <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}" />
+                        </Trigger>
+                        <Trigger Property="IsPressed" Value="true">
+                            <Setter Property="Background" TargetName="border" Value="#26000000" />
+                            <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}" />
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="false">
+                            <Setter Property="Background" TargetName="border" Value="Transparent" />
+                            <Setter Property="BorderBrush" TargetName="border" Value="#33000000" />
+                            <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="#FF999999" />
+                            <Setter Property="Opacity" TargetName="contentPresenter" Value="0.4" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
     <Style x:Key="TitleBarBtn" TargetType="{x:Type Button}">
         <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
         <Setter Property="Background" Value="{StaticResource Button.Static.Background}" />
@@ -310,8 +341,8 @@
     </ControlTemplate>
 
     <!--
-        Style for Btn.cta
-        样式里仅设置了背景色和文字颜色变化,字体大小和控件宽度需要调用时设置
+    Style for Btn.cta
+    样式里仅设置了背景色和文字颜色变化,字体大小和控件宽度需要调用时设置
     -->
     <Style x:Key="Btn.cta" TargetType="{x:Type Button}">
         <Setter Property="FocusVisualStyle" Value="{x:Null}" />
@@ -343,7 +374,6 @@
                 <Setter Property="Foreground" Value="{StaticResource color.btn.cta.text.dis}" />
             </Trigger>
         </Style.Triggers>
-
     </Style>
 
     <!--  style for Btn.Brand  -->
@@ -495,5 +525,4 @@
             </Trigger>
         </Style.Triggers>
     </Style>
-
 </ResourceDictionary>

+ 47 - 0
PDF Office/Styles/ComboxStyle.xaml

@@ -83,4 +83,51 @@
         <Setter Property="FontFamily" Value="Segoe UI" />
         <Setter Property="FontSize" Value="14" />
     </Style>
+
+    <Style x:Key="ContextMenuStyle" TargetType="{x:Type ContextMenu}">
+        <Setter Property="SnapsToDevicePixels" Value="True" />
+        <Setter Property="Grid.IsSharedSizeScope" Value="true" />
+        <Setter Property="HasDropShadow" Value="True" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type ContextMenu}">
+                    <Border Uid="Border_93">
+                        <Border.Style>
+                            <Style TargetType="{x:Type Border}">
+                                <Setter Property="Tag" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}" />
+                                <Style.Triggers>
+                                    <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource Self}}" Value="True">
+                                        <Setter Property="Effect">
+                                            <Setter.Value>
+                                                <DropShadowEffect
+                                                    BlurRadius="4"
+                                                    Opacity="0.8"
+                                                    ShadowDepth="1" />
+                                            </Setter.Value>
+                                        </Setter>
+                                    </DataTrigger>
+                                </Style.Triggers>
+                            </Style>
+                        </Border.Style>
+                        <Border
+                            Uid="Border_50"
+                            Background="{TemplateBinding Background}"
+                            BorderBrush="{TemplateBinding BorderBrush}"
+                            BorderThickness="{TemplateBinding BorderThickness}">
+                            <ScrollViewer
+                                Uid="ScrollViewer_9"
+                                CanContentScroll="True"
+                                Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer,
+                                                                              TypeInTargetAssembly={x:Type FrameworkElement}}}">
+                                <ItemsPresenter
+                                    Uid="ItemsPresenter_5"
+                                    KeyboardNavigation.DirectionalNavigation="Cycle"
+                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+                            </ScrollViewer>
+                        </Border>
+                    </Border>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
 </ResourceDictionary>

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

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

+ 110 - 9
PDF Office/Styles/CustomBtnStyle.xaml

@@ -21,6 +21,111 @@
     <SolidColorBrush x:Key="BlueBtn.Pressed.Background" Color="#1B2944" />
     <SolidColorBrush x:Key="Redact.Background" Color="#477EDE" />
 
+    <Style x:Key="ToggleBtnScreenAnnotationStyle" TargetType="customControl:CustomIconToggleBtn">
+        <Setter Property="Background" Value="{StaticResource Button.Static.Background}" />
+        <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}" />
+        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
+        <Setter Property="BorderThickness" Value="0" />
+        <Setter Property="HorizontalContentAlignment" Value="Center" />
+        <Setter Property="Margin" Value="4" />
+        <Setter Property="Height" Value="40" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="customControl:CustomIconToggleBtn">
+                    <Border
+                        x:Name="border"
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="Transparent"
+                        CornerRadius="4"
+                        SnapsToDevicePixels="true">
+                        <Grid
+                            Width="40"
+                            Height="40"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center">
+                            <ContentPresenter
+                                x:Name="contentPresenter"
+                                Margin="0"
+                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                                Focusable="False"
+                                RecognizesAccessKey="True"
+                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+                        </Grid>
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="True">
+                            <Setter TargetName="border" Property="Background" Value="#e2e3e5" />
+                            <Setter TargetName="border" Property="BorderBrush" Value="#CED0D4" />
+                        </Trigger>
+                        <Trigger Property="IsPressed" Value="True">
+                            <Setter TargetName="border" Property="Background" Value="#e2e3e5" />
+                            <Setter TargetName="border" Property="BorderBrush" Value="#CED0D4" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+        <Style.Triggers>
+
+            <Trigger Property="IsChecked" Value="True">
+                <Setter Property="Background" Value="#e2e3e5" />
+                <Setter Property="BorderBrush" Value="#CED0D4" />
+            </Trigger>
+            <Trigger Property="IsChecked" Value="False">
+                <Setter Property="Background" Value="Transparent" />
+                <Setter Property="BorderBrush" Value="Transparent" />
+            </Trigger>
+            <Trigger Property="IsChecked" Value="{x:Null}">
+                <Setter Property="Background" Value="Transparent" />
+            </Trigger>
+        </Style.Triggers>
+    </Style>
+
+    <Style x:Key="ToggleBtnAnnotationStyle" TargetType="customControl:CustomIconToggleBtn">
+        <Setter Property="Background" Value="Transparent" />
+        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
+        <Setter Property="BorderThickness" Value="0" />
+        <Setter Property="HorizontalContentAlignment" Value="Left" />
+        <Setter Property="VerticalContentAlignment" Value="Top" />
+        <Setter Property="Height" Value="40" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="customControl:CustomIconToggleBtn">
+                    <Border
+                        x:Name="border"
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="{TemplateBinding BorderBrush}"
+                        BorderThickness="{TemplateBinding BorderThickness}"
+                        SnapsToDevicePixels="true">
+                        <Grid>
+                            <Grid
+                                Width="40"
+                                Height="40"
+                                HorizontalAlignment="Left"
+                                VerticalAlignment="Top">
+                                <Image
+                                    x:Name="ImageIcon"
+                                    Width="20"
+                                    Height="20"
+                                    Source="{Binding Icon, RelativeSource={RelativeSource Mode=TemplatedParent}}"
+                                    Visibility="Collapsed" />
+                            </Grid>
+                            <ContentPresenter
+                                x:Name="contentPresenter"
+                                Margin="{TemplateBinding Padding}"
+                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                                Focusable="False"
+                                RecognizesAccessKey="True"
+                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+                        </Grid>
+                    </Border>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+
     <Style x:Key="ToggleBtnViewModeStyle" TargetType="customControl:CustomIconToggleBtn">
         <Setter Property="Background" Value="{StaticResource Button.Static.Background}" />
         <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}" />
@@ -71,10 +176,10 @@
                             <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Pressed.Border}" />
                         </Trigger>
                         <!--<Trigger Property="IsEnabled" Value="false">
-                            <Setter TargetName="border" Property="Background" Value="{StaticResource Button.Disabled.Background}" />
-                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Disabled.Border}" />
-                            <Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{StaticResource Button.Disabled.Foreground}" />
-                            <Setter TargetName="contentPresenter" Property="Opacity" Value="0.5" />
+                        <Setter TargetName="border" Property="Background" Value="{StaticResource Button.Disabled.Background}" />
+                        <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Disabled.Border}" />
+                        <Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{StaticResource Button.Disabled.Foreground}" />
+                        <Setter TargetName="contentPresenter" Property="Opacity" Value="0.5" />
                         </Trigger>-->
                     </ControlTemplate.Triggers>
                 </ControlTemplate>
@@ -173,7 +278,6 @@
         </Style.Triggers>
     </Style>
 
-
     <Style x:Key="BlueBtnStyle" TargetType="{x:Type Button}">
         <Setter Property="Background" Value="#1460F3" />
         <Setter Property="Template">
@@ -236,7 +340,6 @@
                             Focusable="False"
                             RecognizesAccessKey="True"
                             SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
-
                     </Border>
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsMouseOver" Value="true">
@@ -454,7 +557,6 @@
         </Setter>
     </Style>
 
-
     <Style x:Key="HomePageCompressBtn" TargetType="Button">
         <Setter Property="Background" Value="White" />
         <Setter Property="BorderBrush" Value="White" />
@@ -498,5 +600,4 @@
             </Setter.Value>
         </Setter>
     </Style>
-</ResourceDictionary>
-
+</ResourceDictionary>

Разница между файлами не показана из-за своего большого размера
+ 284 - 34
PDF Office/Styles/ExpanderStyle.xaml


+ 56 - 3
PDF Office/Styles/ListViewStyle.xaml

@@ -27,7 +27,7 @@
                                         <ColumnDefinition Width="2*" />
                                         <ColumnDefinition Width="100" />
                                     </Grid.ColumnDefinitions>
-                                    <!--以下是列表模式的列标题-->
+                                    <!--  以下是列表模式的列标题  -->
                                     <TextBlock
                                         Margin="12,0,0,6"
                                         HorizontalAlignment="Left"
@@ -48,7 +48,7 @@
                                         HorizontalAlignment="Center"
                                         VerticalAlignment="Center"
                                         FontSize="14" />
-                                    <!--列表模式的列标题的分隔线-->
+                                    <!--  列表模式的列标题的分隔线  -->
                                     <Rectangle
                                         Grid.ColumnSpan="4"
                                         Height="0"
@@ -136,7 +136,12 @@
                                 ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
                                 ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
                                 SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
-                            <Rectangle Grid.Column="1" Height="1" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Fill="#C5CBD3"/>
+                            <Rectangle
+                                Grid.Column="1"
+                                Height="1"
+                                HorizontalAlignment="Stretch"
+                                VerticalAlignment="Bottom"
+                                Fill="#C5CBD3" />
                         </Grid>
                     </Border>
                     <ControlTemplate.Triggers>
@@ -389,4 +394,52 @@
             </Setter.Value>
         </Setter>
     </Style>
+
+    <ControlTemplate x:Key="AnnotationListItemStyle" TargetType="{x:Type ListBoxItem}">
+        <Border
+            x:Name="Bd"
+            Margin="5,0,5,10"
+            Padding="5"
+            Background="#f5f5f5"
+            BorderBrush="{TemplateBinding BorderBrush}"
+            BorderThickness="{TemplateBinding BorderThickness}"
+            CornerRadius="4"
+            SnapsToDevicePixels="True">
+            <ContentPresenter
+                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                Content="{TemplateBinding Content}"
+                ContentStringFormat="{TemplateBinding ContentStringFormat}"
+                ContentTemplate="{TemplateBinding ContentTemplate}"
+                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+        </Border>
+        <ControlTemplate.Triggers>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="IsMouseOver" Value="True" />
+                </MultiTrigger.Conditions>
+                <Setter TargetName="Bd" Property="Background" Value="#EDEEF0" />
+                <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />
+            </MultiTrigger>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="Selector.IsSelectionActive" Value="False" />
+                    <Condition Property="IsSelected" Value="True" />
+                </MultiTrigger.Conditions>
+                <Setter TargetName="Bd" Property="Background" Value="#d7d8db" />
+                <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />
+            </MultiTrigger>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="Selector.IsSelectionActive" Value="True" />
+                    <Condition Property="IsSelected" Value="True" />
+                </MultiTrigger.Conditions>
+                <Setter TargetName="Bd" Property="Background" Value="#d7d8db" />
+                <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />
+            </MultiTrigger>
+            <Trigger Property="IsEnabled" Value="False">
+                <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
+            </Trigger>
+        </ControlTemplate.Triggers>
+    </ControlTemplate>
 </ResourceDictionary>

+ 4 - 4
PDF Office/Styles/PathButtonStyle.xaml

@@ -1,7 +1,7 @@
-<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-                    xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
-                    >
+<ResourceDictionary
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:customControl="clr-namespace:PDF_Office.CustomControl">
     <Style TargetType="{x:Type customControl:PathButton}">
         <Setter Property="IconOpacity" Value="1" />
         <Setter Property="IconMouseOverOpacity" Value="1" />

+ 302 - 423
PDF Office/Styles/SliderStyle.xaml

@@ -1,58 +1,61 @@
-<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-    <Style TargetType="{x:Type Slider}" x:Key="RoundThumbSlider"
-       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-       xmlns:s="clr-namespace:System;assembly=mscorlib">
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+    <Style
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:s="clr-namespace:System;assembly=mscorlib"
+        x:Key="RoundThumbSlider"
+        TargetType="{x:Type Slider}">
         <Style.Triggers>
-            <Trigger Property="Slider.Orientation"
-                 Value="Vertical">
+            <Trigger Property="Slider.Orientation" Value="Vertical">
                 <Setter Property="Control.Template">
                     <Setter.Value>
                         <ControlTemplate TargetType="{x:Type Slider}">
-                            <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
-                                BorderBrush="{TemplateBinding Border.BorderBrush}"
-                                Background="{TemplateBinding Panel.Background}"
+                            <Border
                                 Name="border"
+                                Background="{TemplateBinding Panel.Background}"
+                                BorderBrush="{TemplateBinding Border.BorderBrush}"
+                                BorderThickness="{TemplateBinding Border.BorderThickness}"
                                 SnapsToDevicePixels="True">
                                 <Grid>
                                     <Grid.ColumnDefinitions>
                                         <ColumnDefinition Width="Auto" />
-                                        <ColumnDefinition Width="Auto"
-                                                      MinWidth="{TemplateBinding FrameworkElement.MinWidth}" />
+                                        <ColumnDefinition Width="Auto" MinWidth="{TemplateBinding FrameworkElement.MinWidth}" />
                                         <ColumnDefinition Width="Auto" />
                                     </Grid.ColumnDefinitions>
-                                    <TickBar Fill="{TemplateBinding TextElement.Foreground}"
-                                         Placement="Left"
-                                         Name="TopTick"
-                                         Width="4"
-                                         Margin="0,0,2,0"
-                                         Visibility="Collapsed"
-                                         Grid.Column="0" />
-                                    <TickBar Fill="{TemplateBinding TextElement.Foreground}"
-                                         Placement="Right"
-                                         Name="BottomTick"
-                                         Width="4"
-                                         Margin="2,0,0,0"
-                                         Visibility="Collapsed"
-                                         Grid.Column="2" />
-                                    <Border BorderThickness="1"
-                                        BorderBrush="#D6D6D6"
-                                        Background="#E7EAEA"
+                                    <TickBar
+                                        Name="TopTick"
+                                        Grid.Column="0"
+                                        Width="4"
+                                        Margin="0,0,2,0"
+                                        Fill="{TemplateBinding TextElement.Foreground}"
+                                        Placement="Left"
+                                        Visibility="Collapsed" />
+                                    <TickBar
+                                        Name="BottomTick"
+                                        Grid.Column="2"
+                                        Width="4"
+                                        Margin="2,0,0,0"
+                                        Fill="{TemplateBinding TextElement.Foreground}"
+                                        Placement="Right"
+                                        Visibility="Collapsed" />
+                                    <Border
                                         Name="TrackBackground"
+                                        Grid.Column="1"
                                         Width="4"
                                         Margin="0,5"
                                         HorizontalAlignment="Center"
-                                        Grid.Column="1">
+                                        Background="#E7EAEA"
+                                        BorderBrush="#D6D6D6"
+                                        BorderThickness="1">
                                         <Canvas Margin="-1,-6">
-                                            <Rectangle Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
-                                                   Name="PART_SelectionRange"
-                                                   Width="4"
-                                                   Visibility="Hidden" />
+                                            <Rectangle
+                                                Name="PART_SelectionRange"
+                                                Width="4"
+                                                Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
+                                                Visibility="Hidden" />
                                         </Canvas>
                                     </Border>
-                                    <Track Name="PART_Track"
-                                       Grid.Column="1">
+                                    <Track Name="PART_Track" Grid.Column="1">
                                         <Track.DecreaseRepeatButton>
                                             <RepeatButton>
                                                 <RepeatButton.Command>
@@ -60,20 +63,17 @@
                                                 </RepeatButton.Command>
                                                 <RepeatButton.Style>
                                                     <Style TargetType="{x:Type RepeatButton}">
-                                                        <Setter Property="FrameworkElement.OverridesDefaultStyle"
-                                                            Value="True" />
-                                                        <Setter Property="Panel.Background"
-                                                            Value="#00FFFFFF" />
-                                                        <Setter Property="UIElement.Focusable"
-                                                            Value="False" />
-                                                        <Setter Property="KeyboardNavigation.IsTabStop"
-                                                            Value="False" />
+                                                        <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True" />
+                                                        <Setter Property="Panel.Background" Value="#00FFFFFF" />
+                                                        <Setter Property="UIElement.Focusable" Value="False" />
+                                                        <Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
                                                         <Setter Property="Control.Template">
                                                             <Setter.Value>
                                                                 <ControlTemplate TargetType="{x:Type RepeatButton}">
-                                                                    <Rectangle Fill="{TemplateBinding Panel.Background}"
-                                                                           Width="{TemplateBinding FrameworkElement.Width}"
-                                                                           Height="2" />
+                                                                    <Rectangle
+                                                                        Width="{TemplateBinding FrameworkElement.Width}"
+                                                                        Height="2"
+                                                                        Fill="{TemplateBinding Panel.Background}" />
                                                                 </ControlTemplate>
                                                             </Setter.Value>
                                                         </Setter>
@@ -82,58 +82,48 @@
                                             </RepeatButton>
                                         </Track.DecreaseRepeatButton>
                                         <Track.Thumb>
-                                            <Thumb OverridesDefaultStyle="True"
-                                               Name="Thumb"
-                                               Width="18"
-                                               Height="11"
-                                               VerticalAlignment="Top"
-                                               Focusable="False">
+                                            <Thumb
+                                                Name="Thumb"
+                                                Width="18"
+                                                Height="11"
+                                                VerticalAlignment="Top"
+                                                Focusable="False"
+                                                OverridesDefaultStyle="True">
                                                 <Thumb.Template>
                                                     <ControlTemplate TargetType="{x:Type Thumb}">
-                                                        <Grid UseLayoutRounding="True"
-                                                          HorizontalAlignment="Center"
-                                                          VerticalAlignment="Center">
+                                                        <Grid
+                                                            HorizontalAlignment="Center"
+                                                            VerticalAlignment="Center"
+                                                            UseLayoutRounding="True">
                                                             <Path
-                                              Stretch="Fill"
-                                              Fill="#477EDE"
-                                              Stroke="#477EDE"
-                                              StrokeThickness="1"
-                                              UseLayoutRounding="True"
-                                              Name="grip"
-                                              VerticalAlignment="Center"
-                                              SnapsToDevicePixels="True" >
+                                                                Name="grip"
+                                                                VerticalAlignment="Center"
+                                                                Fill="#477EDE"
+                                                                SnapsToDevicePixels="True"
+                                                                Stretch="Fill"
+                                                                Stroke="#477EDE"
+                                                                StrokeThickness="1"
+                                                                UseLayoutRounding="True">
                                                                 <Path.Data>
-                                                                    <RectangleGeometry Rect="0,0,8,16" RadiusX="4" RadiusY="4"></RectangleGeometry>
+                                                                    <RectangleGeometry
+                                                                        RadiusX="4"
+                                                                        RadiusY="4"
+                                                                        Rect="0,0,8,16" />
                                                                 </Path.Data>
                                                             </Path>
                                                         </Grid>
                                                         <ControlTemplate.Triggers>
-                                                            <Trigger Property="UIElement.IsMouseOver"
-                                                                 Value="True">
-                                                                <Setter Property="Shape.Fill"
-                                                                    TargetName="grip"
-                                                                    Value="#477EDE" />
-                                                                <Setter Property="Shape.Stroke"
-                                                                    TargetName="grip"
-                                                                    Value="#477EDE" />
+                                                            <Trigger Property="UIElement.IsMouseOver" Value="True">
+                                                                <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                                <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                                             </Trigger>
-                                                            <Trigger Property="Thumb.IsDragging"
-                                                                 Value="True">
-                                                                <Setter Property="Shape.Fill"
-                                                                    TargetName="grip"
-                                                                    Value="#477EDE" />
-                                                                <Setter Property="Shape.Stroke"
-                                                                    TargetName="grip"
-                                                                    Value="#477EDE" />
+                                                            <Trigger Property="Thumb.IsDragging" Value="True">
+                                                                <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                                <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                                             </Trigger>
-                                                            <Trigger Property="UIElement.IsEnabled"
-                                                                 Value="False">
-                                                                <Setter Property="Shape.Fill"
-                                                                    TargetName="grip"
-                                                                    Value="#477EDE" />
-                                                                <Setter Property="Shape.Stroke"
-                                                                    TargetName="grip"
-                                                                    Value="#477EDE" />
+                                                            <Trigger Property="UIElement.IsEnabled" Value="False">
+                                                                <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                                <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                                             </Trigger>
                                                         </ControlTemplate.Triggers>
                                                     </ControlTemplate>
@@ -147,20 +137,17 @@
                                                 </RepeatButton.Command>
                                                 <RepeatButton.Style>
                                                     <Style TargetType="{x:Type RepeatButton}">
-                                                        <Setter Property="FrameworkElement.OverridesDefaultStyle"
-                                                            Value="True" />
-                                                        <Setter Property="Panel.Background"
-                                                            Value="#00FFFFFF" />
-                                                        <Setter Property="UIElement.Focusable"
-                                                            Value="False" />
-                                                        <Setter Property="KeyboardNavigation.IsTabStop"
-                                                            Value="False" />
+                                                        <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True" />
+                                                        <Setter Property="Panel.Background" Value="#00FFFFFF" />
+                                                        <Setter Property="UIElement.Focusable" Value="False" />
+                                                        <Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
                                                         <Setter Property="Control.Template">
                                                             <Setter.Value>
                                                                 <ControlTemplate TargetType="{x:Type RepeatButton}">
-                                                                    <Rectangle Fill="{TemplateBinding Panel.Background}"
-                                                                           Width="{TemplateBinding FrameworkElement.Width}"
-                                                                           Height="2" />
+                                                                    <Rectangle
+                                                                        Width="{TemplateBinding FrameworkElement.Width}"
+                                                                        Height="2"
+                                                                        Fill="{TemplateBinding Panel.Background}" />
                                                                 </ControlTemplate>
                                                             </Setter.Value>
                                                         </Setter>
@@ -172,150 +159,105 @@
                                 </Grid>
                             </Border>
                             <ControlTemplate.Triggers>
-                                <Trigger Property="Slider.TickPlacement"
-                                     Value="TopLeft">
-                                    <Setter Property="UIElement.Visibility"
-                                        TargetName="TopTick"
-                                        Value="Visible" />
-                                    <Setter Property="Control.Template"
-                                        TargetName="Thumb">
+                                <Trigger Property="Slider.TickPlacement" Value="TopLeft">
+                                    <Setter TargetName="TopTick" Property="UIElement.Visibility" Value="Visible" />
+                                    <Setter TargetName="Thumb" Property="Control.Template">
                                         <Setter.Value>
                                             <ControlTemplate TargetType="{x:Type Thumb}">
-                                                <Grid UseLayoutRounding="True"
-                                                  HorizontalAlignment="Center"
-                                                  VerticalAlignment="Center">
+                                                <Grid
+                                                    HorizontalAlignment="Center"
+                                                    VerticalAlignment="Center"
+                                                    UseLayoutRounding="True">
                                                     <Path
-                                              Stretch="Fill"
-                                              Fill="#477EDE"
-                                              Stroke="#477EDE"
-                                              StrokeThickness="1"
-                                              UseLayoutRounding="True"
-                                              Name="grip"
-                                              VerticalAlignment="Center"
-                                              SnapsToDevicePixels="True" >
+                                                        Name="grip"
+                                                        VerticalAlignment="Center"
+                                                        Fill="#477EDE"
+                                                        SnapsToDevicePixels="True"
+                                                        Stretch="Fill"
+                                                        Stroke="#477EDE"
+                                                        StrokeThickness="1"
+                                                        UseLayoutRounding="True">
                                                         <Path.Data>
-                                                            <RectangleGeometry Rect="0,0,8,16" RadiusX="4" RadiusY="4"></RectangleGeometry>
+                                                            <RectangleGeometry
+                                                                RadiusX="4"
+                                                                RadiusY="4"
+                                                                Rect="0,0,8,16" />
                                                         </Path.Data>
                                                     </Path>
                                                 </Grid>
                                                 <ControlTemplate.Triggers>
-                                                    <Trigger Property="UIElement.IsMouseOver"
-                                                         Value="True">
-                                                        <Setter Property="Shape.Fill"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
-                                                        <Setter Property="Shape.Stroke"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
+                                                    <Trigger Property="UIElement.IsMouseOver" Value="True">
+                                                        <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                        <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                                     </Trigger>
-                                                    <Trigger Property="Thumb.IsDragging"
-                                                         Value="True">
-                                                        <Setter Property="Shape.Fill"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
-                                                        <Setter Property="Shape.Stroke"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
+                                                    <Trigger Property="Thumb.IsDragging" Value="True">
+                                                        <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                        <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                                     </Trigger>
-                                                    <Trigger Property="UIElement.IsEnabled"
-                                                         Value="False">
-                                                        <Setter Property="Shape.Fill"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
-                                                        <Setter Property="Shape.Stroke"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
+                                                    <Trigger Property="UIElement.IsEnabled" Value="False">
+                                                        <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                        <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                                     </Trigger>
                                                 </ControlTemplate.Triggers>
                                             </ControlTemplate>
                                         </Setter.Value>
                                     </Setter>
-                                    <Setter Property="FrameworkElement.Margin"
-                                        TargetName="TrackBackground"
-                                        Value="2,5,0,5" />
+                                    <Setter TargetName="TrackBackground" Property="FrameworkElement.Margin" Value="2,5,0,5" />
                                 </Trigger>
-                                <Trigger Property="Slider.TickPlacement"
-                                     Value="BottomRight">
-                                    <Setter Property="UIElement.Visibility"
-                                        TargetName="BottomTick"
-                                        Value="Visible" />
-                                    <Setter Property="Control.Template"
-                                        TargetName="Thumb">
+                                <Trigger Property="Slider.TickPlacement" Value="BottomRight">
+                                    <Setter TargetName="BottomTick" Property="UIElement.Visibility" Value="Visible" />
+                                    <Setter TargetName="Thumb" Property="Control.Template">
                                         <Setter.Value>
                                             <ControlTemplate TargetType="{x:Type Thumb}">
-                                                <Grid UseLayoutRounding="True"
-                                                  HorizontalAlignment="Center"
-                                                  VerticalAlignment="Center">
+                                                <Grid
+                                                    HorizontalAlignment="Center"
+                                                    VerticalAlignment="Center"
+                                                    UseLayoutRounding="True">
                                                     <Path
-                                              Stretch="Fill"
-                                              Fill="#477EDE"
-                                              Stroke="#477EDE"
-                                              StrokeThickness="1"
-                                              UseLayoutRounding="True"
-                                              Name="grip"
-                                              VerticalAlignment="Center"
-                                              SnapsToDevicePixels="True" >
+                                                        Name="grip"
+                                                        VerticalAlignment="Center"
+                                                        Fill="#477EDE"
+                                                        SnapsToDevicePixels="True"
+                                                        Stretch="Fill"
+                                                        Stroke="#477EDE"
+                                                        StrokeThickness="1"
+                                                        UseLayoutRounding="True">
                                                         <Path.Data>
-                                                            <RectangleGeometry Rect="0,0,8,16" RadiusX="4" RadiusY="4"></RectangleGeometry>
+                                                            <RectangleGeometry
+                                                                RadiusX="4"
+                                                                RadiusY="4"
+                                                                Rect="0,0,8,16" />
                                                         </Path.Data>
                                                     </Path>
                                                 </Grid>
                                                 <ControlTemplate.Triggers>
-                                                    <Trigger Property="UIElement.IsMouseOver"
-                                                         Value="True">
-                                                        <Setter Property="Shape.Fill"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
-                                                        <Setter Property="Shape.Stroke"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
+                                                    <Trigger Property="UIElement.IsMouseOver" Value="True">
+                                                        <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                        <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                                     </Trigger>
-                                                    <Trigger Property="Thumb.IsDragging"
-                                                         Value="True">
-                                                        <Setter Property="Shape.Fill"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
-                                                        <Setter Property="Shape.Stroke"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
+                                                    <Trigger Property="Thumb.IsDragging" Value="True">
+                                                        <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                        <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                                     </Trigger>
-                                                    <Trigger Property="UIElement.IsEnabled"
-                                                         Value="False">
-                                                        <Setter Property="Shape.Fill"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
-                                                        <Setter Property="Shape.Stroke"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
+                                                    <Trigger Property="UIElement.IsEnabled" Value="False">
+                                                        <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                        <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                                     </Trigger>
                                                 </ControlTemplate.Triggers>
                                             </ControlTemplate>
                                         </Setter.Value>
                                     </Setter>
-                                    <Setter Property="FrameworkElement.Margin"
-                                        TargetName="TrackBackground"
-                                        Value="0,5,2,5" />
+                                    <Setter TargetName="TrackBackground" Property="FrameworkElement.Margin" Value="0,5,2,5" />
                                 </Trigger>
-                                <Trigger Property="Slider.TickPlacement"
-                                     Value="Both">
-                                    <Setter Property="UIElement.Visibility"
-                                        TargetName="TopTick"
-                                        Value="Visible" />
-                                    <Setter Property="UIElement.Visibility"
-                                        TargetName="BottomTick"
-                                        Value="Visible" />
+                                <Trigger Property="Slider.TickPlacement" Value="Both">
+                                    <Setter TargetName="TopTick" Property="UIElement.Visibility" Value="Visible" />
+                                    <Setter TargetName="BottomTick" Property="UIElement.Visibility" Value="Visible" />
                                 </Trigger>
-                                <Trigger Property="Slider.IsSelectionRangeEnabled"
-                                     Value="True">
-                                    <Setter Property="UIElement.Visibility"
-                                        TargetName="PART_SelectionRange"
-                                        Value="Visible" />
+                                <Trigger Property="Slider.IsSelectionRangeEnabled" Value="True">
+                                    <Setter TargetName="PART_SelectionRange" Property="UIElement.Visibility" Value="Visible" />
                                 </Trigger>
-                                <Trigger Property="UIElement.IsKeyboardFocused"
-                                     Value="True">
-                                    <Setter Property="TextElement.Foreground"
-                                        TargetName="Thumb"
-                                        Value="#0000FF" />
+                                <Trigger Property="UIElement.IsKeyboardFocused" Value="True">
+                                    <Setter TargetName="Thumb" Property="TextElement.Foreground" Value="#0000FF" />
                                 </Trigger>
                             </ControlTemplate.Triggers>
                         </ControlTemplate>
@@ -323,60 +265,59 @@
                 </Setter>
             </Trigger>
         </Style.Triggers>
-        <Setter Property="Stylus.IsPressAndHoldEnabled"
-            Value="False" />
-        <Setter Property="Panel.Background"
-            Value="#00FFFFFF" />
-        <Setter Property="Border.BorderBrush"
-            Value="#00FFFFFF" />
-        <Setter Property="TextElement.Foreground"
-            Value="#E5E5E5" />
+        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
+        <Setter Property="Panel.Background" Value="#00FFFFFF" />
+        <Setter Property="Border.BorderBrush" Value="#00FFFFFF" />
+        <Setter Property="TextElement.Foreground" Value="#E5E5E5" />
         <Setter Property="Control.Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type Slider}">
-                    <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
-                        BorderBrush="{TemplateBinding Border.BorderBrush}"
-                        Background="{TemplateBinding Panel.Background}"
+                    <Border
                         Name="border"
+                        Background="{TemplateBinding Panel.Background}"
+                        BorderBrush="{TemplateBinding Border.BorderBrush}"
+                        BorderThickness="{TemplateBinding Border.BorderThickness}"
                         SnapsToDevicePixels="True">
                         <Grid>
                             <Grid.RowDefinitions>
                                 <RowDefinition Height="Auto" />
-                                <RowDefinition Height="Auto"
-                                           MinHeight="{TemplateBinding FrameworkElement.MinHeight}" />
+                                <RowDefinition Height="Auto" MinHeight="{TemplateBinding FrameworkElement.MinHeight}" />
                                 <RowDefinition Height="Auto" />
                             </Grid.RowDefinitions>
-                            <TickBar Fill="{TemplateBinding TextElement.Foreground}"
-                                 Placement="Top"
-                                 Name="TopTick"
-                                 Height="4"
-                                 Margin="0,2,0,0"
-                                 Visibility="Collapsed"
-                                 Grid.Row="0" />
-                            <TickBar Fill="{TemplateBinding TextElement.Foreground}"
-                                 Placement="Bottom"
-                                 Name="BottomTick"
-                                 Height="4"
-                                 Margin="0,0,0,2"
-                                 Visibility="Collapsed"
-                                 Grid.Row="2" />
-                            <Border BorderThickness="0"
-                                BorderBrush="#D6D6D6"
-                                Background="#FFE2E3E6"
+                            <TickBar
+                                Name="TopTick"
+                                Grid.Row="0"
+                                Height="4"
+                                Margin="0,2,0,0"
+                                Fill="{TemplateBinding TextElement.Foreground}"
+                                Placement="Top"
+                                Visibility="Collapsed" />
+                            <TickBar
+                                Name="BottomTick"
+                                Grid.Row="2"
+                                Height="4"
+                                Margin="0,0,0,2"
+                                Fill="{TemplateBinding TextElement.Foreground}"
+                                Placement="Bottom"
+                                Visibility="Collapsed" />
+                            <Border
                                 Name="TrackBackground"
+                                Grid.Row="1"
                                 Height="4"
                                 Margin="5,0"
                                 VerticalAlignment="Center"
-                                Grid.Row="1">
+                                Background="#FFE2E3E6"
+                                BorderBrush="#D6D6D6"
+                                BorderThickness="0">
                                 <Canvas Margin="-6,-1">
-                                    <Rectangle Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
-                                           Name="PART_SelectionRange"
-                                           Height="4"
-                                           Visibility="Hidden" />
+                                    <Rectangle
+                                        Name="PART_SelectionRange"
+                                        Height="4"
+                                        Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
+                                        Visibility="Hidden" />
                                 </Canvas>
                             </Border>
-                            <Track Name="PART_Track"
-                               Grid.Row="1">
+                            <Track Name="PART_Track" Grid.Row="1">
                                 <Track.DecreaseRepeatButton>
                                     <RepeatButton>
                                         <RepeatButton.Command>
@@ -384,20 +325,17 @@
                                         </RepeatButton.Command>
                                         <RepeatButton.Style>
                                             <Style TargetType="{x:Type RepeatButton}">
-                                                <Setter Property="FrameworkElement.OverridesDefaultStyle"
-                                                    Value="True" />
-                                                <Setter Property="Panel.Background"
-                                                    Value="#00FFFFFF" />
-                                                <Setter Property="UIElement.Focusable"
-                                                    Value="False" />
-                                                <Setter Property="KeyboardNavigation.IsTabStop"
-                                                    Value="False" />
+                                                <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True" />
+                                                <Setter Property="Panel.Background" Value="#00FFFFFF" />
+                                                <Setter Property="UIElement.Focusable" Value="False" />
+                                                <Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
                                                 <Setter Property="Control.Template">
                                                     <Setter.Value>
                                                         <ControlTemplate TargetType="{x:Type RepeatButton}">
-                                                            <Rectangle Fill="{TemplateBinding Panel.Background}"
-                                                                   Width="{TemplateBinding FrameworkElement.Width}"
-                                                                   Height="{TemplateBinding FrameworkElement.Height}" />
+                                                            <Rectangle
+                                                                Width="{TemplateBinding FrameworkElement.Width}"
+                                                                Height="{TemplateBinding FrameworkElement.Height}"
+                                                                Fill="{TemplateBinding Panel.Background}" />
                                                         </ControlTemplate>
                                                     </Setter.Value>
                                                 </Setter>
@@ -406,58 +344,48 @@
                                     </RepeatButton>
                                 </Track.DecreaseRepeatButton>
                                 <Track.Thumb>
-                                    <Thumb OverridesDefaultStyle="True"
-                                       Name="Thumb"
-                                       Width="8"
-                                       Height="16"
-                                       VerticalAlignment="Center"
-                                       Focusable="False">
+                                    <Thumb
+                                        Name="Thumb"
+                                        Width="8"
+                                        Height="16"
+                                        VerticalAlignment="Center"
+                                        Focusable="False"
+                                        OverridesDefaultStyle="True">
                                         <Thumb.Template>
                                             <ControlTemplate TargetType="{x:Type Thumb}">
-                                                <Grid UseLayoutRounding="True"
-                                                  HorizontalAlignment="Center"
-                                                  VerticalAlignment="Center">
+                                                <Grid
+                                                    HorizontalAlignment="Center"
+                                                    VerticalAlignment="Center"
+                                                    UseLayoutRounding="True">
                                                     <Path
-                                              Stretch="Fill"
-                                              Fill="#477EDE"
-                                              Stroke="#477EDE"
-                                              StrokeThickness="1"
-                                              UseLayoutRounding="True"
-                                              Name="grip"
-                                              VerticalAlignment="Center"
-                                              SnapsToDevicePixels="True" >
+                                                        Name="grip"
+                                                        VerticalAlignment="Center"
+                                                        Fill="#477EDE"
+                                                        SnapsToDevicePixels="True"
+                                                        Stretch="Fill"
+                                                        Stroke="#477EDE"
+                                                        StrokeThickness="1"
+                                                        UseLayoutRounding="True">
                                                         <Path.Data>
-                                                            <RectangleGeometry Rect="0,0,8,16" RadiusX="4" RadiusY="4"></RectangleGeometry>
+                                                            <RectangleGeometry
+                                                                RadiusX="4"
+                                                                RadiusY="4"
+                                                                Rect="0,0,8,16" />
                                                         </Path.Data>
                                                     </Path>
                                                 </Grid>
                                                 <ControlTemplate.Triggers>
-                                                    <Trigger Property="UIElement.IsMouseOver"
-                                                         Value="True">
-                                                        <Setter Property="Shape.Fill"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
-                                                        <Setter Property="Shape.Stroke"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
+                                                    <Trigger Property="UIElement.IsMouseOver" Value="True">
+                                                        <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                        <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                                     </Trigger>
-                                                    <Trigger Property="Thumb.IsDragging"
-                                                         Value="True">
-                                                        <Setter Property="Shape.Fill"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
-                                                        <Setter Property="Shape.Stroke"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
+                                                    <Trigger Property="Thumb.IsDragging" Value="True">
+                                                        <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                        <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                                     </Trigger>
-                                                    <Trigger Property="UIElement.IsEnabled"
-                                                         Value="False">
-                                                        <Setter Property="Shape.Fill"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
-                                                        <Setter Property="Shape.Stroke"
-                                                            TargetName="grip"
-                                                            Value="#477EDE" />
+                                                    <Trigger Property="UIElement.IsEnabled" Value="False">
+                                                        <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                        <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                                     </Trigger>
                                                 </ControlTemplate.Triggers>
                                             </ControlTemplate>
@@ -471,21 +399,17 @@
                                         </RepeatButton.Command>
                                         <RepeatButton.Style>
                                             <Style TargetType="{x:Type RepeatButton}">
-                                                <Setter Property="FrameworkElement.OverridesDefaultStyle"
-                                                    Value="True" />
-                                                <Setter Property="Panel.Background"
-                                                    Value="#00FFFFFF" />
-                                                <Setter Property="UIElement.Focusable"
-                                                    Value="False" />
-                                                <Setter Property="KeyboardNavigation.IsTabStop"
-                                                    Value="False" />
+                                                <Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True" />
+                                                <Setter Property="Panel.Background" Value="#00FFFFFF" />
+                                                <Setter Property="UIElement.Focusable" Value="False" />
+                                                <Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
                                                 <Setter Property="Control.Template">
                                                     <Setter.Value>
                                                         <ControlTemplate TargetType="{x:Type RepeatButton}">
-                                                            <Rectangle Fill="{TemplateBinding Panel.Background}"
-                                                                   Width="{TemplateBinding FrameworkElement.Width}"
-                                                                   Height="{TemplateBinding FrameworkElement.Height}"
-                                                                   />
+                                                            <Rectangle
+                                                                Width="{TemplateBinding FrameworkElement.Width}"
+                                                                Height="{TemplateBinding FrameworkElement.Height}"
+                                                                Fill="{TemplateBinding Panel.Background}" />
                                                         </ControlTemplate>
                                                     </Setter.Value>
                                                 </Setter>
@@ -497,150 +421,105 @@
                         </Grid>
                     </Border>
                     <ControlTemplate.Triggers>
-                        <Trigger Property="Slider.TickPlacement"
-                             Value="TopLeft">
-                            <Setter Property="UIElement.Visibility"
-                                TargetName="TopTick"
-                                Value="Visible" />
-                            <Setter Property="Control.Template"
-                                TargetName="Thumb">
+                        <Trigger Property="Slider.TickPlacement" Value="TopLeft">
+                            <Setter TargetName="TopTick" Property="UIElement.Visibility" Value="Visible" />
+                            <Setter TargetName="Thumb" Property="Control.Template">
                                 <Setter.Value>
                                     <ControlTemplate TargetType="{x:Type Thumb}">
-                                        <Grid UseLayoutRounding="True"
-                                          HorizontalAlignment="Center"
-                                          VerticalAlignment="Center">
+                                        <Grid
+                                            HorizontalAlignment="Center"
+                                            VerticalAlignment="Center"
+                                            UseLayoutRounding="True">
                                             <Path
-                                              Stretch="Fill"
-                                              Fill="#477EDE"
-                                              Stroke="#477EDE"
-                                              StrokeThickness="1"
-                                              UseLayoutRounding="True"
-                                              Name="grip"
-                                              VerticalAlignment="Center"
-                                              SnapsToDevicePixels="True" >
+                                                Name="grip"
+                                                VerticalAlignment="Center"
+                                                Fill="#477EDE"
+                                                SnapsToDevicePixels="True"
+                                                Stretch="Fill"
+                                                Stroke="#477EDE"
+                                                StrokeThickness="1"
+                                                UseLayoutRounding="True">
                                                 <Path.Data>
-                                                    <RectangleGeometry Rect="0,0,8,16" RadiusX="4" RadiusY="4"></RectangleGeometry>
+                                                    <RectangleGeometry
+                                                        RadiusX="4"
+                                                        RadiusY="4"
+                                                        Rect="0,0,8,16" />
                                                 </Path.Data>
                                             </Path>
                                         </Grid>
                                         <ControlTemplate.Triggers>
-                                            <Trigger Property="UIElement.IsMouseOver"
-                                                 Value="True">
-                                                <Setter Property="Shape.Fill"
-                                                    TargetName="grip"
-                                                    Value="#477EDE" />
-                                                <Setter Property="Shape.Stroke"
-                                                    TargetName="grip"
-                                                    Value="#477EDE" />
+                                            <Trigger Property="UIElement.IsMouseOver" Value="True">
+                                                <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                             </Trigger>
-                                            <Trigger Property="Thumb.IsDragging"
-                                                 Value="True">
-                                                <Setter Property="Shape.Fill"
-                                                    TargetName="grip"
-                                                    Value="#477EDE" />
-                                                <Setter Property="Shape.Stroke"
-                                                    TargetName="grip"
-                                                    Value="#477EDE" />
+                                            <Trigger Property="Thumb.IsDragging" Value="True">
+                                                <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                             </Trigger>
-                                            <Trigger Property="UIElement.IsEnabled"
-                                                 Value="False">
-                                                <Setter Property="Shape.Fill"
-                                                    TargetName="grip"
-                                                    Value="#477EDE" />
-                                                <Setter Property="Shape.Stroke"
-                                                    TargetName="grip"
-                                                    Value="#477EDE" />
+                                            <Trigger Property="UIElement.IsEnabled" Value="False">
+                                                <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                             </Trigger>
                                         </ControlTemplate.Triggers>
                                     </ControlTemplate>
                                 </Setter.Value>
                             </Setter>
-                            <Setter Property="FrameworkElement.Margin"
-                                TargetName="TrackBackground"
-                                Value="5,2,5,0" />
+                            <Setter TargetName="TrackBackground" Property="FrameworkElement.Margin" Value="5,2,5,0" />
                         </Trigger>
-                        <Trigger Property="Slider.TickPlacement"
-                             Value="BottomRight">
-                            <Setter Property="UIElement.Visibility"
-                                TargetName="BottomTick"
-                                Value="Visible" />
-                            <Setter Property="Control.Template"
-                                TargetName="Thumb">
+                        <Trigger Property="Slider.TickPlacement" Value="BottomRight">
+                            <Setter TargetName="BottomTick" Property="UIElement.Visibility" Value="Visible" />
+                            <Setter TargetName="Thumb" Property="Control.Template">
                                 <Setter.Value>
                                     <ControlTemplate TargetType="{x:Type Thumb}">
-                                        <Grid UseLayoutRounding="True"
-                                          HorizontalAlignment="Center"
-                                          VerticalAlignment="Center">
+                                        <Grid
+                                            HorizontalAlignment="Center"
+                                            VerticalAlignment="Center"
+                                            UseLayoutRounding="True">
                                             <Path
-                                              Stretch="Fill"
-                                              Fill="#477EDE"
-                                              Stroke="#477EDE"
-                                              StrokeThickness="1"
-                                              UseLayoutRounding="True"
-                                              Name="grip"
-                                              VerticalAlignment="Center"
-                                              SnapsToDevicePixels="True" >
+                                                Name="grip"
+                                                VerticalAlignment="Center"
+                                                Fill="#477EDE"
+                                                SnapsToDevicePixels="True"
+                                                Stretch="Fill"
+                                                Stroke="#477EDE"
+                                                StrokeThickness="1"
+                                                UseLayoutRounding="True">
                                                 <Path.Data>
-                                                    <RectangleGeometry Rect="0,0,8,16" RadiusX="4" RadiusY="4"></RectangleGeometry>
+                                                    <RectangleGeometry
+                                                        RadiusX="4"
+                                                        RadiusY="4"
+                                                        Rect="0,0,8,16" />
                                                 </Path.Data>
                                             </Path>
                                         </Grid>
                                         <ControlTemplate.Triggers>
-                                            <Trigger Property="UIElement.IsMouseOver"
-                                                 Value="True">
-                                                <Setter Property="Shape.Fill"
-                                                    TargetName="grip"
-                                                    Value="#477EDE" />
-                                                <Setter Property="Shape.Stroke"
-                                                    TargetName="grip"
-                                                    Value="#477EDE" />
+                                            <Trigger Property="UIElement.IsMouseOver" Value="True">
+                                                <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                             </Trigger>
-                                            <Trigger Property="Thumb.IsDragging"
-                                                 Value="True">
-                                                <Setter Property="Shape.Fill"
-                                                    TargetName="grip"
-                                                    Value="#477EDE" />
-                                                <Setter Property="Shape.Stroke"
-                                                    TargetName="grip"
-                                                    Value="#477EDE" />
+                                            <Trigger Property="Thumb.IsDragging" Value="True">
+                                                <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                             </Trigger>
-                                            <Trigger Property="UIElement.IsEnabled"
-                                                 Value="False">
-                                                <Setter Property="Shape.Fill"
-                                                    TargetName="grip"
-                                                    Value="#477EDE" />
-                                                <Setter Property="Shape.Stroke"
-                                                    TargetName="grip"
-                                                    Value="#477EDE" />
+                                            <Trigger Property="UIElement.IsEnabled" Value="False">
+                                                <Setter TargetName="grip" Property="Shape.Fill" Value="#477EDE" />
+                                                <Setter TargetName="grip" Property="Shape.Stroke" Value="#477EDE" />
                                             </Trigger>
                                         </ControlTemplate.Triggers>
                                     </ControlTemplate>
                                 </Setter.Value>
                             </Setter>
-                            <Setter Property="FrameworkElement.Margin"
-                                TargetName="TrackBackground"
-                                Value="5,0,5,2" />
+                            <Setter TargetName="TrackBackground" Property="FrameworkElement.Margin" Value="5,0,5,2" />
                         </Trigger>
-                        <Trigger Property="Slider.TickPlacement"
-                             Value="Both">
-                            <Setter Property="UIElement.Visibility"
-                                TargetName="TopTick"
-                                Value="Visible" />
-                            <Setter Property="UIElement.Visibility"
-                                TargetName="BottomTick"
-                                Value="Visible" />
+                        <Trigger Property="Slider.TickPlacement" Value="Both">
+                            <Setter TargetName="TopTick" Property="UIElement.Visibility" Value="Visible" />
+                            <Setter TargetName="BottomTick" Property="UIElement.Visibility" Value="Visible" />
                         </Trigger>
-                        <Trigger Property="Slider.IsSelectionRangeEnabled"
-                             Value="True">
-                            <Setter Property="UIElement.Visibility"
-                                TargetName="PART_SelectionRange"
-                                Value="Visible" />
+                        <Trigger Property="Slider.IsSelectionRangeEnabled" Value="True">
+                            <Setter TargetName="PART_SelectionRange" Property="UIElement.Visibility" Value="Visible" />
                         </Trigger>
-                        <Trigger Property="UIElement.IsKeyboardFocused"
-                             Value="True">
-                            <Setter Property="TextElement.Foreground"
-                                TargetName="Thumb"
-                                Value="#0000FF" />
+                        <Trigger Property="UIElement.IsKeyboardFocused" Value="True">
+                            <Setter TargetName="Thumb" Property="TextElement.Foreground" Value="#0000FF" />
                         </Trigger>
                     </ControlTemplate.Triggers>
                 </ControlTemplate>

+ 483 - 0
PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs

@@ -0,0 +1,483 @@
+using ComPDFKit.Import;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKit.PDFDocument;
+using ComPDFKit.PDFPage;
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
+using ComPDFKitViewer.PdfViewer;
+using DryIoc;
+using Microsoft.Office.Interop.Excel;
+using Microsoft.Office.Interop.Word;
+using PDF_Office.CustomControl;
+using PDF_Office.DataConvert;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.BOTA;
+using PDF_Office.Views.PropertyPanel.AnnotPanel;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Configuration;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Forms;
+using System.Windows.Markup;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using static Dropbox.Api.Files.SearchMatchType;
+using static System.Net.Mime.MediaTypeNames;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
+using Border = System.Windows.Controls.Border;
+using ListBox = System.Windows.Controls.ListBox;
+using Task = System.Threading.Tasks.Task;
+using TextBox = System.Windows.Controls.TextBox;
+
+using Winform = System.Windows.Forms;
+
+namespace PDF_Office.ViewModels.BOTA
+{
+    public class AnnotationContentViewModel : BindableBase, INavigationAware
+    {
+        private ListBox listBox;
+        private IRegionManager region;
+        private IDialogService dialogs;
+        private Visibility isEmptyPanelVisibility = Visibility.Visible;
+
+        public ViewContentViewModel ViewContentViewModel { get; set; }
+        public CPDFViewer PdfViewer { get; set; }
+
+        public Visibility IsEmptyPanelVisibility
+        {
+            get { return isEmptyPanelVisibility; }
+            set
+            {
+                SetProperty(ref isEmptyPanelVisibility, value);
+            }
+        }
+
+        private ObservableCollection<AnnotationHandlerEventArgs> annotationListItems;
+
+        public ObservableCollection<AnnotationHandlerEventArgs> AnnotationListItems
+        {
+            get { return annotationListItems; }
+            set
+            {
+                SetProperty(ref annotationListItems, value);
+            }
+        }
+
+        public DelegateCommand<object> LoadedCommand { get; set; }
+        public DelegateCommand<object> ListBoxItemPreviewMouseLeftButtonDown { get; set; }
+        public DelegateCommand<object> AddNotesCommand { get; set; }
+        public DelegateCommand<object> ScreenCommand { get; set; }
+        public DelegateCommand<object> ExportCommentsCommand { get; set; }
+        public DelegateCommand<object> DeleteCommand { get; set; }
+
+        public DelegateCommand DeleteAllCommand { get; set; }
+
+        public AnnotationContentViewModel(IRegionManager regionManager, IDialogService dialogService)
+        {
+            region = regionManager;
+            dialogs = dialogService;
+            LoadedCommand = new DelegateCommand<object>(Loaded);
+            ListBoxItemPreviewMouseLeftButtonDown = new DelegateCommand<object>(ListBoxItem_PreviewMouseLeftButtonDown);
+            AddNotesCommand = new DelegateCommand<object>(AddNotesEvent);
+            ScreenCommand = new DelegateCommand<object>(ScreenEvent);
+            ExportCommentsCommand = new DelegateCommand<object>(ExportCommentsEvent);
+            DeleteCommand = new DelegateCommand<object>(DelegateEvent);
+            DeleteAllCommand = new DelegateCommand(DeleteAllEvent);
+        }
+
+        /// <summary>
+        /// 删除所有注释
+        /// </summary>
+        private void DeleteAllEvent()
+        {
+            //调用集中删除的接口  方便一次性undo
+            Dictionary<int, List<int>> deleteLists = new Dictionary<int, List<int>>();
+            for (int i = 0; i < annotationListItems.Count; i++)
+            {
+                AnnotationHandlerEventArgs item = annotationListItems[i] as AnnotationHandlerEventArgs;
+                if (!deleteLists.ContainsKey(item.PageIndex))
+                {
+                    deleteLists.Add(item.PageIndex, new List<int>() { item.AnnotIndex });
+                }
+                else
+                {
+                    var pagelist = deleteLists[item.PageIndex];
+                    pagelist.Add(item.AnnotIndex);
+                }
+            }
+            PdfViewer.RemovePageAnnot(deleteLists);
+            annotationListItems.Clear();
+            PdfViewer.UndoManager.CanSave = true;
+        }
+
+        /// <summary>
+        /// 删除注释,单个/多个
+        /// </summary>
+        /// <param name="obj"></param>
+        private void DelegateEvent(object obj)
+        {
+            if (obj is AnnotationHandlerEventArgs annotation)
+            {
+                if (annotation != null)
+                {
+                    var result = PdfViewer.RemovePageAnnot(annotation.PageIndex, annotation.AnnotIndex);
+                    if (result)
+                    {
+                        AnnotationListItems.Remove(annotation);
+                        //记录是删除了哪些页面的注释,然后更新对应页面的注释即可
+                        UpdateAnnotListAfterDelete(annotation.PageIndex, annotation.AnnotIndex);
+                        PdfViewer.UndoManager.CanSave = true;
+                    }
+                }
+            }
+        }
+
+        private void UpdateAnnotListAfterDelete(int pageIndex, int annoteIndex)
+        {
+            var items = PdfViewer.GetAnnotCommentList(pageIndex, PdfViewer.Document);
+            for (int j = 0; j < items.Count; j++)//用修改赋值的方式  可以解决删除后表头折叠的问题
+            {
+                if (items[j].AnnotIndex >= annoteIndex)//只需要更新比删除元素索引大的注释
+                {
+                    for (int k = 0; k < AnnotationListItems.Count; k++)
+                    {
+                        //相当于将后面的索引-1
+                        if (AnnotationListItems[k].PageIndex == pageIndex &&
+                            AnnotationListItems[k].AnnotIndex == (items[j].AnnotIndex + 1) &&
+                            string.Equals(AnnotationListItems[k].MarkupContent, items[j].MarkupContent) &&
+                            string.Equals(AnnotationListItems[k].Content, items[j].Content) &&
+                            string.Equals(AnnotationListItems[k].CreateTime, items[j].CreateTime) &&
+                            string.Equals(AnnotationListItems[k].Author, items[j].Author)
+                            )
+                        {
+                            AnnotationListItems[k].AnnotHandlerEventArgs = items[j];
+                            AnnotationListItems[k].PageIndex = items[j].PageIndex;
+                            AnnotationListItems[k].AnnotIndex = items[j].AnnotIndex;
+                            AnnotationListItems[k].EventType = items[j].EventType;
+                            AnnotationListItems[k].CreateTime = items[j].CreateTime;
+                            AnnotationListItems[k].UpdateTime = items[j].UpdateTime;
+                            AnnotationListItems[k].Content = items[j].Content;
+                            AnnotationListItems[k].MarkupContent = items[j].MarkupContent;
+                            AnnotationListItems[k].Author = items[j].Author;
+                            AnnotationListItems[k].Locked = items[j].Locked;
+                            AnnotationListItems[k].ReadOnly = items[j].ReadOnly;
+                            AnnotationListItems[k].FormField = items[j].FormField;
+                            AnnotationListItems[k].Document = PdfViewer.Document;
+                        }
+                    }
+                }
+            }
+        }
+
+        private void ExportCommentsEvent(object obj)
+        {
+            if (ViewContentViewModel.CanSave)
+            {
+                ViewContentViewModel.SaveFile.Execute();
+            }
+            Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
+            dlg.Filter = "PDF|*.xfdf";
+            dlg.DefaultExt = ".xfdf";
+            dlg.FileName = PdfViewer.Document.FileName;
+            if (dlg.ShowDialog() == true)
+            {
+                string fileName = dlg.FileName;
+                var result = PdfViewer.ExportAnnotationToXFDFPath(fileName);
+                if (result)
+                {
+                    MessageBoxEx.Show("导出成功", "", Winform.MessageBoxButtons.OK);
+                }
+                else
+                {
+                    MessageBoxEx.Show("导出失败", "", Winform.MessageBoxButtons.OK, Winform.MessageBoxIcon.Error);
+                }
+            }
+        }
+
+        private void ScreenEvent(object obj)
+        {
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.AnnotationList, AnnotationListItems);
+            dialogs.ShowDialog(DialogNames.ScreenAnnotationDialog, value, e =>
+            {
+            });
+        }
+
+        private void AddNotesEvent(object obj)
+        {
+            if (obj is AnnotationHandlerEventArgs data)
+            {
+                if (data != null)
+                {
+                    if (data.EventType != AnnotArgsType.AnnotSticky)
+                    {
+                        DialogParameters value = new DialogParameters();
+                        value.Add(ParameterNames.Annotation, data);
+                        dialogs.ShowDialog(DialogNames.AddAnnotationDialog, value, e =>
+                        {
+                            if (e.Result == ButtonResult.OK && e.Parameters != null)
+                            {
+                                //PdfViewer.UndoManager.CanSave = true;
+                                //    if (e.Parameters.ContainsKey(ParameterNames.Annotation) && e.Parameters.ContainsKey(ParameterNames.AnnotEvent))
+                                //    {
+                                //        AnnotationHandlerEventArgs annotation = e.Parameters.GetValue<AnnotationHandlerEventArgs>(ParameterNames.Annotation);
+
+                                //        //AnnotAttribEvent annotEvent = e.Parameters.GetValue<AnnotAttribEvent>(ParameterNames.AnnotEvent);
+
+                                //        //annotEvent?.UpdateAttrib(AnnotAttrib.NoteText, annotation.MarkupContent);
+                                //        //annotEvent?.UpdateAnnot();
+
+                                //    }
+                            }
+                        });
+                    }
+                    //if(data.EventType == AnnotArgsType.AnnotFreeText)
+                    //{
+                    //    ListBoxItem myListBoxItem = (ListBoxItem)(listBox.ItemContainerGenerator.ContainerFromItem(data));
+                    //    TextBlock txbContent = CommonHelper.FindVisualChild<TextBlock>(myListBoxItem);
+
+                    //    TextBox txtContent = CommonHelper.FindVisualChild<TextBox>(myListBoxItem);
+                    //    txbContent.Visibility = Visibility.Collapsed;
+                    //    txtContent.Visibility = Visibility.Visible;
+                    //}
+                }
+            }
+        }
+
+        /// <summary>
+        /// listboxitem鼠标左键点击,显示分组的数据
+        /// </summary>
+        /// <param name="obj"></param>
+        private void ListBoxItem_PreviewMouseLeftButtonDown(object obj)
+        {
+            if (obj is ListBoxItem item)
+            {
+                var data = item.DataContext as AnnotationHandlerEventArgs;
+                if (data != null)
+                {
+                    PdfViewer.SelectAnnotation(data.PageIndex, data.AnnotIndex);
+                }
+            }
+        }
+
+        /// <summary>
+        /// 页面加载时
+        /// </summary>
+        /// <param name="obj"></param>
+        private void Loaded(object obj)
+        {
+            if (obj is CompositeCommandParameter composite)
+            {
+                if (composite.Parameter is ListBox listBox)
+                {
+                    this.listBox = listBox;
+                    SetGroupHeader(listBox);
+                }
+            }
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            var pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
+            var viewContentViewModel = navigationContext.Parameters[ParameterNames.ViewContentViewModel] as ViewContentViewModel;
+            if (pdfview != null && viewContentViewModel != null)
+            {
+                ViewContentViewModel = viewContentViewModel;
+                PdfViewer = pdfview;
+                AnnotationListItems = new ObservableCollection<AnnotationHandlerEventArgs>();
+                AnnotationListItems = GetDocumentAnnotionList();
+                AnnotationListItems.CollectionChanged += AnnotationListItems_CollectionChanged;
+            }
+        }
+
+        private async void SetGroupHeader(ListBox listBox)
+        {
+            //按照PageIndex,分组 排序
+            ICollectionView iCollectionView = CollectionViewSource.GetDefaultView(AnnotationListItems);
+            CreateTimeToDate createTimeToDate = new CreateTimeToDate();
+            iCollectionView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(AnnotationHandlerEventArgs.PageIndex)));
+            iCollectionView.SortDescriptions.Add(new SortDescription(nameof(AnnotationHandlerEventArgs.PageIndex), ListSortDirection.Ascending));
+            iCollectionView.SortDescriptions.Add(new SortDescription(nameof(AnnotationHandlerEventArgs.AnnotIndex), ListSortDirection.Ascending));
+            if (AnnotationListItems.Count > 0)
+            {
+                IsEmptyPanelVisibility = Visibility.Collapsed;
+                await Task.Delay(5);
+                //展开数据
+                ExpandGroupHeader(AnnotationListItems, listBox);
+            }
+            else
+            {
+                IsEmptyPanelVisibility = Visibility.Visible;
+            }
+        }
+
+        /// <summary>
+        /// 展开列表项
+        /// </summary>
+        /// <param name="annotationListItems"></param>
+        /// <param name="listBox"></param>
+        private void ExpandGroupHeader(ObservableCollection<AnnotationHandlerEventArgs> annotationListItems, ListBox listBox)
+        {
+            try
+            {
+                foreach (var item in annotationListItems)
+                {
+                    var groups = listBox.Items.Groups;
+                    for (int i = 0; i < groups.Count; i++)
+                    {
+                        var group = groups[i] as CollectionViewGroup;
+                        if (group.Items.Contains(item))
+                        {
+                            var scroller = GetScrollHost(listBox);
+                            var stackpanel = CommonHelper.FindVisualChild<StackPanel>(scroller);
+                            int count = VisualTreeHelper.GetChildrenCount(stackpanel);
+                            var groupItem = VisualTreeHelper.GetChild(stackpanel, i) as GroupItem;
+                            var g = CommonHelper.FindVisualChild<Expander>(groupItem);
+                            if (g != null)
+                            {
+                                g.IsExpanded = true;
+                            }
+                        }
+                    }
+                }
+            }
+            catch { }
+        }
+
+        private ScrollViewer GetScrollHost(ListBox listBox)
+        {
+            if (VisualTreeHelper.GetChildrenCount(listBox) > 0)
+            {
+                int s = VisualTreeHelper.GetChildrenCount(listBox);
+
+                Border border = VisualTreeHelper.GetChild(listBox, 0) as Border;
+                if (border != null)
+                {
+                    return VisualTreeHelper.GetChild(border, 0) as ScrollViewer;
+                }
+            }
+            return null;
+        }
+
+        private ObservableCollection<AnnotationHandlerEventArgs> GetDocumentAnnotionList()
+        {
+            ObservableCollection<AnnotationHandlerEventArgs> list = new ObservableCollection<AnnotationHandlerEventArgs>();
+            for (int i = 0; i < PdfViewer.Document.PageCount; i++)
+            {
+                var items = PdfViewer.GetAnnotCommentList(i, PdfViewer.Document);
+                foreach (var item in items)
+                {
+                    //原型图上,目前对波浪线的类型,在注释列表不显示
+                    if (item.EventType != AnnotArgsType.AnnotRedaction && item.EventType != AnnotArgsType.AnnotSquiggly)
+                    {
+                        AnnotationHandlerEventArgs args = new AnnotationHandlerEventArgs();
+                        if (item.EventType == AnnotArgsType.AnnotFreehand)
+                        {
+                            WriteableBitmap bitmap = GetAnnotImage(PdfViewer.Document, item.PageIndex, item.AnnotIndex);
+                            args.WriteableBitmap = bitmap;
+                        }
+                        args.AnnotHandlerEventArgs = item;
+                        args.PageIndex = item.PageIndex;
+                        args.AnnotIndex = item.AnnotIndex;
+                        args.EventType = item.EventType;
+                        args.CreateTime = item.CreateTime;
+                        args.UpdateTime = item.UpdateTime;
+                        args.Content = item.Content;
+                        args.MarkupContent = item.MarkupContent;
+                        args.Author = item.Author;
+                        args.Locked = item.Locked;
+                        args.ReadOnly = item.ReadOnly;
+                        args.FormField = item.FormField;
+                        args.Document = PdfViewer.Document;
+                        list.Add(args);
+                    }
+                }
+            }
+
+            return list;
+        }
+
+        /// <summary>
+        /// 获取手绘图案
+        /// </summary>
+        /// <param name="doc"></param>
+        /// <param name="pageIndex"></param>
+        /// <param name="annotIndex"></param>
+        /// <returns></returns>
+        public WriteableBitmap GetAnnotImage(CPDFDocument doc, int pageIndex, int annotIndex)
+        {
+            if (doc == null)
+            {
+                return null;
+            }
+            CPDFPage docPage = doc.PageAtIndex(pageIndex, false);
+            if (docPage == null)
+            {
+                return null;
+            }
+
+            List<CPDFAnnotation> docAnnots = docPage.GetAnnotations();
+            foreach (CPDFAnnotation annot in docAnnots)
+            {
+                if (docAnnots.IndexOf(annot) == annotIndex)
+                {
+                    CRect rawRect = annot.GetRect();
+                    double scaleDpi = 96.0 / 72.0;
+                    Rect paintRect = new Rect(rawRect.left * scaleDpi, rawRect.top * scaleDpi, rawRect.width() * scaleDpi, rawRect.height() * scaleDpi);
+                    int drawWidth = (int)paintRect.Width;
+                    int drawHeight = (int)paintRect.Height;
+                    byte[] bitmapArray = new byte[drawWidth * drawHeight * 4];
+
+                    annot.RenderAnnot(drawWidth, drawHeight, bitmapArray);
+                    WriteableBitmap wirteBitmap = new WriteableBitmap(drawWidth, drawHeight, 96, 96, PixelFormats.Bgra32, null);
+                    wirteBitmap.WritePixels(new Int32Rect(0, 0, drawWidth, drawHeight), bitmapArray, wirteBitmap.BackBufferStride, 0);
+                    return wirteBitmap;
+                }
+            }
+
+            return null;
+        }
+
+        private void AnnotationListItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
+        {
+            ObservableCollection<AnnotationHandlerEventArgs> obsSender = sender as ObservableCollection<AnnotationHandlerEventArgs>;
+            if (obsSender != null)
+            {
+                if (obsSender.Count < 1)
+                {
+                    IsEmptyPanelVisibility = Visibility.Visible;
+                }
+                else
+                {
+                    IsEmptyPanelVisibility = Visibility.Collapsed;
+                }
+            }
+            else
+            {
+                IsEmptyPanelVisibility = Visibility.Visible;
+            }
+        }
+    }
+}

+ 171 - 0
PDF Office/ViewModels/BOTA/AnnotationListItemViewModel.cs

@@ -0,0 +1,171 @@
+using ComPDFKitViewer.AnnotEvent;
+using PDF_Office.Helper;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace PDF_Office.ViewModels.BOTA
+{
+    internal class AnnotationListItemViewModel : BindableBase
+    {
+        private Visibility pathTxtIcoVisibility = Visibility.Collapsed;
+
+        public Visibility PathTxtIcoVisibility
+        {
+            get { return pathTxtIcoVisibility; }
+            set
+            {
+                SetProperty(ref pathTxtIcoVisibility, value);
+            }
+        }
+
+        public DelegateCommand<object> GridIcoLoadedCommand { get; set; }
+
+        public AnnotationListItemViewModel()
+        {
+            GridIcoLoadedCommand = new DelegateCommand<object>(GridIcoLoaded);
+        }
+
+        private void GridIcoLoaded(object obj)
+        {
+            if (obj is CompositeCommandParameter commandParameter)
+            {
+                if (commandParameter.EventArgs is RoutedEventArgs eventArgs && commandParameter.Parameter is object[] parameters)
+                {
+                    if ((eventArgs.Source as Grid).DataContext is AnnotHandlerEventArgs data)
+                    {
+                        TextBlock txbContext = parameters[0] as TextBlock;
+                        TextBlock txbMarkUpContent = parameters[1] as TextBlock;
+                        Grid grid = parameters[2] as Grid;
+
+                        switch (data.EventType)
+                        {
+                            case AnnotArgsType.AnnotFreeText:
+                                PathTxtIcoVisibility = Visibility.Visible;
+                                txbMarkUpContent.Foreground = new SolidColorBrush((data as FreeTextAnnotArgs).FontColor);
+                                //txtContext.FontSize = (data as FreeTextAnnotArgs).FontSize;
+                                //txtContext.FontFamily = (data as FreeTextAnnotArgs).Family;
+                                if ((data as FreeTextAnnotArgs).HasBgColor)
+                                {
+                                    txbContext.Background = new SolidColorBrush((data as FreeTextAnnotArgs).BgColor);
+                                }
+                                break;
+
+                            //case AnnotArgsType.AnnotHighlight:
+                            //    highlight.Visibility = Visibility.Visible;
+                            //    highlightcolor.Fill = new SolidColorBrush((data as TextHighlightAnnotArgs).Color);
+                            //    txtContext.Text = data.Content;
+                            //    // txtContext.Background = new SolidColorBrush((data as TextHighlightAnnotArgs).HighlightColor);
+                            //    break;
+
+                            //case AnnotArgsType.AnnotFreehand:
+                            //    freehand.Visibility = Visibility.Visible;
+                            //    freehandcolor.Fill = new SolidColorBrush((data as FreehandAnnotArgs).InkColor);
+                            //    break;
+
+                            //case AnnotArgsType.AnnotLine:
+                            //    if ((data as LineAnnotArgs).HeadLineType >= (C_LINE_TYPE)1 || (data as LineAnnotArgs).TailLineType >= (C_LINE_TYPE)1)
+                            //    {
+                            //        arrow.Visibility = Visibility.Visible;
+                            //        arrow.Fill = new SolidColorBrush((data as LineAnnotArgs).LineColor);
+                            //    }
+                            //    else
+                            //    {
+                            //        line.Stroke = new SolidColorBrush((data as LineAnnotArgs).LineColor);
+                            //        line.Visibility = Visibility.Visible;
+                            //    }
+                            //    break;
+
+                            //case AnnotArgsType.AnnotSquiggly://波浪线
+                            //    AnnotSquiggly.Visibility = Visibility.Visible;
+                            //    AnnotSquigglycolor.Stroke = new SolidColorBrush((data as TextSquigglyAnnotArgs).Color);
+                            //    txtContext.Text = data.Content;
+                            //    TextDecoration mySquiggly = new TextDecoration();
+                            //    Pen myPen = new Pen();
+                            //    myPen.Brush = new SolidColorBrush((data as TextSquigglyAnnotArgs).Color);
+                            //    myPen.Brush.Opacity = 0.8;
+                            //    myPen.Thickness = 2;
+                            //    myPen.DashStyle = DashStyles.Dash;
+                            //    mySquiggly.Pen = myPen;
+                            //    mySquiggly.PenThicknessUnit = TextDecorationUnit.FontRecommended;
+
+                            //    TextDecorationCollection myCollection = new TextDecorationCollection();
+                            //    myCollection.Add(mySquiggly);
+                            //    //txtContext.TextDecorations = myCollection;
+                            //    break;
+
+                            //case AnnotArgsType.AnnotStamp:
+                            //    stamp.Visibility = Visibility.Visible;
+                            //    break;
+
+                            //case AnnotArgsType.AnnotStrikeout://删除线
+                            //    AnnotStrikeout.Visibility = Visibility.Visible;
+                            //    AnnotStrikeoutycolor.Stroke = new SolidColorBrush((data as TextStrikeoutAnnotArgs).Color);
+                            //    AnnotStrikeoutycolor.VerticalAlignment = VerticalAlignment.Center;
+                            //    txtContext.Text = data.Content;
+
+                            //    TextDecoration myStrikeout = new TextDecoration();
+                            //    Pen myPen2 = new Pen();
+                            //    myPen2.Brush = new SolidColorBrush((data as TextStrikeoutAnnotArgs).Color);
+                            //    myPen2.Brush.Opacity = 0.8;
+                            //    myPen2.Thickness = 1;
+                            //    myStrikeout.Pen = myPen2;
+                            //    myStrikeout.PenOffset = -3;
+                            //    myStrikeout.PenThicknessUnit = TextDecorationUnit.FontRecommended;
+                            //    TextDecorationCollection myCollection2 = new TextDecorationCollection();
+                            //    myCollection2.Add(myStrikeout);
+                            //    //因为波浪线无法实现 暂时只显示文字 不显示下划线,删除线等
+                            //    //txtContext.TextDecorations = myCollection2;
+                            //    break;
+
+                            //case AnnotArgsType.AnnotSticky://便签
+                            //    sticky.Visibility = Visibility;
+                            //    sticky.Fill = new SolidColorBrush((data as StickyAnnotArgs).Color);
+                            //    break;
+
+                            //case AnnotArgsType.AnnotUnderline:
+                            //    AnnotStrikeout.Visibility = Visibility.Visible;
+                            //    AnnotStrikeoutycolor.VerticalAlignment = VerticalAlignment.Bottom;
+                            //    txtContext.Text = data.Content;
+                            //    AnnotStrikeoutycolor.Stroke = new SolidColorBrush((data as TextUnderlineAnnotArgs).Color);
+                            //    TextDecoration myUnderline = new TextDecoration();
+                            //    Pen myPen1 = new Pen();
+                            //    myPen1.Brush = new SolidColorBrush((data as TextUnderlineAnnotArgs).Color);
+                            //    myPen1.Brush.Opacity = 0.8;
+                            //    myPen1.Thickness = 2;
+                            //    myUnderline.Pen = myPen1;
+                            //    myUnderline.PenThicknessUnit = TextDecorationUnit.FontRecommended;
+                            //    TextDecorationCollection myCollection1 = new TextDecorationCollection();
+                            //    myCollection1.Add(myUnderline);
+                            //    //txtContext.TextDecorations = myCollection1;
+                            //    break;
+
+                            //case AnnotArgsType.AnnotSquare:
+                            //    rect.Visibility = Visibility.Visible;
+                            //    rect.Stroke = new SolidColorBrush((data as SquareAnnotArgs).LineColor);
+                            //    rect.Fill = new SolidColorBrush((data as SquareAnnotArgs).BgColor);
+                            //    break;
+
+                            //case AnnotArgsType.AnnotCircle:
+                            //    circle.Visibility = Visibility.Visible;
+                            //    circle.Stroke = new SolidColorBrush((data as CircleAnnotArgs).LineColor);
+                            //    circle.Fill = new SolidColorBrush((data as CircleAnnotArgs).BgColor);
+                            //    break;
+
+                            default:
+                                break;
+                        }
+                    }
+                }
+            }
+        }
+    }
+}

+ 4 - 3
PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs

@@ -67,7 +67,7 @@ namespace PDF_Office.ViewModels.BOTA
             viewNameByTabItem.Add("TabItemThumbnail", "PageEditContent");
             viewNameByTabItem.Add("TabItemOutLine", "OutLineControl");
             viewNameByTabItem.Add("TabItemBookMark", "BookmarkContent");
-            viewNameByTabItem.Add("TabItemAnnotation", "");
+            viewNameByTabItem.Add("TabItemAnnotation", "AnnotationContent");
             viewNameByTabItem.Add("TabItemSearch", "SearchContent");
             viewNameByTabItem.Add("TabItemForm", "");
             viewNameByTabItem.Add("TabItemSign", "");
@@ -81,9 +81,10 @@ namespace PDF_Office.ViewModels.BOTA
         {
             NavigationParameters param = new NavigationParameters();
             param.Add(ParameterNames.PDFViewer, pdfViewer);
-            if(currentBar== "TabItemThumbnail")
+            param.Add(ParameterNames.ViewContentViewModel, viewContentViewModel);
+            if (currentBar == "TabItemThumbnail")
             {
-                param.Add(ParameterNames.BOTAThumb,true);
+                param.Add(ParameterNames.BOTAThumb, true);
             }
             regions.RequestNavigate(BOTAContentRegionName, viewNameByTabItem[currentBar], param);
         }

+ 5 - 0
PDF Office/ViewModels/BOTA/BookmarkContentViewModel.cs

@@ -128,6 +128,10 @@ namespace PDF_Office.ViewModels.BOTA
                     IsEmptyPanelVisibility = Visibility.Collapsed;
                 }
             }
+            else
+            {
+                IsEmptyPanelVisibility = Visibility.Visible;
+            }
         }
 
         /// <summary>
@@ -293,6 +297,7 @@ namespace PDF_Office.ViewModels.BOTA
             int index = PDFViewer.CurrentIndex;
             string mark = string.Format($"第{index + 1}页");
 
+            //检测是否已存在相同数据
             var list = PDFViewer.Document.GetBookmarkList().FindAll(q => q.PageIndex == index);
 
             if (list.Count > 0)

+ 1 - 1
PDF Office/ViewModels/BOTA/OutLineControlViewModel.cs

@@ -89,7 +89,7 @@ namespace PDF_Office.ViewModels.BOTA
                     Outlinelist.Add(dto);
                 }
             }
-            PDFViewer.GetSelectedText();
+            PDFViewer.GetCreateOutLineInfo();
         }
 
         public void Updata(bool IsMoveData)

+ 197 - 0
PDF Office/ViewModels/Dialog/BOTA/AddAnnotationDialogViewModel.cs

@@ -0,0 +1,197 @@
+using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
+using Microsoft.Office.Interop.Word;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDF_Office.Model.BOTA;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Annotations;
+using System.Windows.Controls;
+using System.Windows.Markup;
+using System.Windows.Media;
+
+namespace PDF_Office.ViewModels.Dialog.BOTA
+{
+    public class AddAnnotationDialogViewModel : BindableBase, IDialogAware
+    {
+        private string title;
+
+        public string Title
+        {
+            get { return title; }
+            set { SetProperty(ref title, value); }
+        }
+
+        public event Action<IDialogResult> RequestClose;
+
+        private string markupContent;
+
+        public string MarkupContent
+        {
+            get { return markupContent; }
+            set
+            {
+                SetProperty(ref markupContent, value);
+            }
+        }
+
+        private string annotationName;
+
+        public string AnnotationName
+        {
+            get { return annotationName; }
+            set
+            {
+                SetProperty(ref annotationName, value);
+            }
+        }
+
+        public AnnotationHandlerEventArgs Annotation { get; set; }
+        public AnnotAttribEvent AnnotEvent { get; set; }
+
+        public DelegateCommand CreateCommnad { get; set; }
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand<Object> LostFocusCommand { get; set; }
+
+        public AddAnnotationDialogViewModel()
+        {
+            CancelCommand = new DelegateCommand(CancelEvent);
+            CreateCommnad = new DelegateCommand(CreateEvent);
+            LostFocusCommand = new DelegateCommand<object>(LostFocusEvent);
+        }
+
+        private void LostFocusEvent(object obj)
+        {
+            if (obj is CompositeCommandParameter composite)
+            {
+                if (composite.Parameter is TextBox textBox)
+                {
+                    Annotation.MarkupContent = textBox.Text;
+                    Annotation.AnnotHandlerEventArgs.MarkupContent = textBox.Text;
+                }
+            }
+        }
+
+        private void CreateEvent()
+        {
+            DialogParameters valuePairs = new DialogParameters();
+            valuePairs.Add(ParameterNames.Annotation, Annotation);
+            valuePairs.Add(ParameterNames.AnnotEvent, AnnotEvent);
+            RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
+        }
+
+        private void CancelEvent()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            AnnotationHandlerEventArgs annotation;
+            parameters.TryGetValue<AnnotationHandlerEventArgs>(ParameterNames.Annotation, out annotation);
+
+            string title = "1";
+
+            if (annotation != null)
+            {
+                Annotation = annotation;
+
+                Dictionary<AnnotAttrib, object> annotAttribsList = new Dictionary<AnnotAttrib, object>();
+
+                switch (annotation.EventType)
+                {
+                    case AnnotArgsType.AnnotFreeText://文本
+                        title = "文本";
+                        //FreeTextAnnotArgs freetextArgs = annotation.AnnotHandlerEventArgs as FreeTextAnnotArgs; ;
+                        //annotAttribsList[AnnotAttrib.Color] = freetextArgs.LineColor;
+                        //annotAttribsList[AnnotAttrib.FillColor] = freetextArgs.BgColor;
+                        //annotAttribsList[AnnotAttrib.Thickness] = freetextArgs.LineWidth;
+                        //annotAttribsList[AnnotAttrib.Transparency] = freetextArgs.Transparency;
+                        //annotAttribsList[AnnotAttrib.FontColor] = freetextArgs.FontColor;
+                        //annotAttribsList[AnnotAttrib.FontSize] = freetextArgs.FontSize;
+                        //annotAttribsList[AnnotAttrib.FontFamily] = freetextArgs.FontFamily;
+                        //annotAttribsList[AnnotAttrib.FontStyle] = freetextArgs.FontStyle;
+                        //annotAttribsList[AnnotAttrib.FontWeight] = freetextArgs.FontWeight;
+                        //annotAttribsList[AnnotAttrib.TextAlign] = TextAlignment.Left;
+                        //annotAttribsList[AnnotAttrib.NoteText] = freetextArgs.TextContent;
+                        //AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(freetextArgs, annotAttribsList);
+                        break;
+
+                    case AnnotArgsType.AnnotHighlight:
+                        title = "高亮";
+                        break;
+
+                    case AnnotArgsType.AnnotFreehand:
+                        title = "手绘";
+                        break;
+
+                    case AnnotArgsType.AnnotSquiggly://波浪线
+                        title = "波浪线";
+                        break;
+
+                    case AnnotArgsType.AnnotStamp:
+                        title = "图章";
+                        break;
+
+                    case AnnotArgsType.AnnotStrikeout://删除线
+                        title = "删除线";
+                        break;
+
+                    case AnnotArgsType.AnnotSticky://便签
+                        break;
+
+                    case AnnotArgsType.AnnotUnderline:
+                        title = "下划线";
+                        break;
+
+                    case AnnotArgsType.AnnotLine:
+                        if ((annotation.AnnotHandlerEventArgs as LineAnnotArgs).HeadLineType >= (C_LINE_TYPE)1 || (annotation.AnnotHandlerEventArgs as LineAnnotArgs).TailLineType >= (C_LINE_TYPE)1)
+                        {
+                            title = "箭头";
+                        }
+                        else
+                        {
+                            title = "线";
+                        }
+                        break;
+
+                    case AnnotArgsType.AnnotSquare:
+                        title = "矩形";
+                        break;
+
+                    case AnnotArgsType.AnnotCircle:
+                        title = "圆";
+                        break;
+                }
+                if (!string.IsNullOrEmpty(annotation.MarkupContent))
+                {
+                    title = title + "-" + annotation.MarkupContent;
+                }
+                Title = title;
+                MarkupContent = annotation.MarkupContent;
+                AnnotationName = "页面" + (annotation.PageIndex + 1).ToString();
+                return;
+            }
+        }
+    }
+}

+ 437 - 0
PDF Office/ViewModels/Dialog/BOTA/ScreenAnnotationDialogViewModel.cs

@@ -0,0 +1,437 @@
+using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer.AnnotEvent;
+using Dropbox.Api.Users;
+using DryIoc;
+using ImTools;
+using Microsoft.Office.Interop.Word;
+using PDF_Office.CustomControl.CompositeControl;
+using PDF_Office.Model;
+using PDF_Office.Model.BOTA;
+using Prism.Commands;
+using Prism.Common;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Annotations;
+using System.Windows.Media;
+
+namespace PDF_Office.ViewModels.Dialog.BOTA
+{
+    public class AuthorItem : BindableBase
+    {
+        private string name;
+
+        public string Name
+        {
+            get { return name; }
+            set
+            {
+                SetProperty(ref name, value);
+            }
+        }
+
+        public AuthorItem(string name)
+        {
+            Name = name;
+        }
+    }
+
+    public class Compare<T, C> : IEqualityComparer<T>
+    {
+        private Func<T, C> _getField;
+
+        public Compare(Func<T, C> getfield)
+        {
+            this._getField = getfield;
+        }
+
+        public bool Equals(T x, T y)
+        {
+            return EqualityComparer<C>.Default.Equals(_getField(x), _getField(y));
+        }
+
+        public int GetHashCode(T obj)
+        {
+            return EqualityComparer<C>.Default.GetHashCode(this._getField(obj));
+        }
+    }
+
+    public static class CommonHelper
+    {
+        /// <summary>
+        /// 自定义Distinct扩展方法
+        /// </summary>
+        /// <typeparam name="T">要去重的对象类</typeparam>
+        /// <typeparam name="C">自定义去重的字段类型</typeparam>
+        /// <param name="source">要去重的对象</param>
+        /// <param name="getfield">获取自定义去重字段的委托</param>
+        /// <returns></returns>
+        public static IEnumerable<T> MyDistinct<T, C>(this IEnumerable<T> source, Func<T, C> getfield)
+        {
+            return source.Distinct(new Compare<T, C>(getfield));
+        }
+    }
+
+    internal class ScreenAnnotationDialogViewModel : BindableBase, IDialogAware
+    {
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        #region 类型的显示隐藏
+
+        /// <summary>
+        /// 高亮字体
+        /// </summary>
+        private Visibility highlightVisibility = Visibility.Collapsed;
+
+        public Visibility HighlightVisibility
+        {
+            get { return highlightVisibility; }
+            set
+            {
+                SetProperty(ref highlightVisibility, value);
+            }
+        }
+
+        /// <summary>
+        /// 手绘
+        /// </summary>
+        private Visibility freeHandVisibility = Visibility.Collapsed;
+
+        public Visibility FreeHandVisibility
+        {
+            get { return freeHandVisibility; }
+            set
+            {
+                SetProperty(ref freeHandVisibility, value);
+            }
+        }
+
+        /// <summary>
+        /// 便签
+        /// </summary>
+        private Visibility annotStickyVisibility = Visibility.Collapsed;
+
+        public Visibility AnnotStickyVisibility
+        {
+            get { return annotStickyVisibility; }
+            set
+            {
+                SetProperty(ref annotStickyVisibility, value);
+            }
+        }
+
+        /// <summary>
+        /// 图章
+        /// </summary>
+        private Visibility annotStampVisibility = Visibility.Collapsed;
+
+        public Visibility AnnotStampVisibility
+        {
+            get { return annotStampVisibility; }
+            set
+            {
+                SetProperty(ref annotStampVisibility, value);
+            }
+        }
+
+        /// <summary>
+        /// 线
+        /// </summary>
+        private Visibility sharpLineVisibility = Visibility.Collapsed;
+
+        public Visibility SharpLineVisibility
+        {
+            get { return sharpLineVisibility; }
+            set
+            {
+                SetProperty(ref sharpLineVisibility, value);
+            }
+        }
+
+        /// <summary>
+        /// 箭头
+        /// </summary>
+        private Visibility sharpArrowVisibility = Visibility.Collapsed;
+
+        public Visibility SharpArrowVisibility
+        {
+            get { return sharpArrowVisibility; }
+            set
+            {
+                SetProperty(ref sharpArrowVisibility, value);
+            }
+        }
+
+        /// <summary>
+        /// 圆
+        /// </summary>
+        private Visibility annotCircleVisibility = Visibility.Collapsed;
+
+        public Visibility AnnotCircleVisibility
+        {
+            get { return annotCircleVisibility; }
+            set
+            {
+                SetProperty(ref annotCircleVisibility, value);
+            }
+        }
+
+        /// <summary>
+        /// 矩形
+        /// </summary>
+        private Visibility annotSquareVisibility = Visibility.Collapsed;
+
+        public Visibility AnnotSquareVisibility
+        {
+            get { return annotSquareVisibility; }
+            set
+            {
+                SetProperty(ref annotSquareVisibility, value);
+            }
+        }
+
+        /// <summary>
+        /// 文本注释
+        /// </summary>
+        private Visibility annotFreeTextVisibility = Visibility.Collapsed;
+
+        public Visibility AnnotFreeTextVisibility
+        {
+            get { return annotFreeTextVisibility; }
+            set
+            {
+                SetProperty(ref annotFreeTextVisibility, value);
+            }
+        }
+
+        /// <summary>
+        /// 删除线
+        /// </summary>
+        private Visibility annotStrikeoutVisibility = Visibility.Collapsed;
+
+        public Visibility AnnotStrikeoutVisibility
+        {
+            get { return annotStrikeoutVisibility; }
+            set
+            {
+                SetProperty(ref annotStrikeoutVisibility, value);
+            }
+        }
+
+        /// <summary>
+        /// 下划线
+        /// </summary>
+        private Visibility underLineVisibility = Visibility.Collapsed;
+
+        public Visibility UnderLineVisibility
+        {
+            get { return underLineVisibility; }
+            set
+            {
+                SetProperty(ref underLineVisibility, value);
+            }
+        }
+
+        #endregion 类型的显示隐藏
+
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand CreateCommnad { get; set; }
+
+        public ObservableCollection<AnnotationHandlerEventArgs> AnnotationListItems { get; set; }
+
+        private ObservableCollection<ColorItem> annotationColors = new ObservableCollection<ColorItem>();
+
+        public ObservableCollection<ColorItem> AnnotationColors
+        {
+            get { return annotationColors; }
+            set
+            {
+                SetProperty(ref annotationColors, value);
+            }
+        }
+
+        private ObservableCollection<AuthorItem> annotationAuthor = new ObservableCollection<AuthorItem>();
+
+        public ObservableCollection<AuthorItem> AnnotationAuthor
+        {
+            get { return annotationAuthor; }
+            set
+            {
+                SetProperty(ref annotationAuthor, value);
+            }
+        }
+
+        //private List<System.Windows.Media.Color> annotationColors = new List<System.Windows.Media.Color>();
+        //private List<string> annotationAuthor = new List<string>();
+
+        public ScreenAnnotationDialogViewModel()
+        {
+            CancelCommand = new DelegateCommand(CancelEvent);
+            CreateCommnad = new DelegateCommand(CreateEvent);
+        }
+
+        private void CreateEvent()
+        {
+            DialogParameters valuePairs = new DialogParameters();
+            //valuePairs.Add(ParameterNames.Bookmark, Bookmark);
+            RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
+        }
+
+        private void CancelEvent()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        private void SetColor(System.Windows.Media.Color color)
+        {
+            if (AnnotationColors.Count > 0)
+            {
+                for (int i = 0; i < AnnotationColors.Count; i++)
+                {
+                    System.Windows.Media.Color color1 = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(AnnotationColors[i].Color.ToString());
+                    if (color1.R == color.R && color1.G == color.G && color1.B == color.B
+                        && color1.A == color.A)
+                    {
+                        AnnotationColors.Remove(AnnotationColors[i]);
+                    }
+                }
+            }
+            AnnotationColors.Add(new ColorItem(color));
+            //var bFind = AnnotationColors.All<ColorItem>(p => p.Color == new SolidColorBrush(color));
+            //if (bFind)
+            //{
+            //    AnnotationColors.Add(new ColorItem(color));
+            //}
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            ObservableCollection<AnnotationHandlerEventArgs> list;
+            parameters.TryGetValue<ObservableCollection<AnnotationHandlerEventArgs>>(ParameterNames.AnnotationList, out list);
+            AnnotationListItems = list;
+
+            foreach (var item in AnnotationListItems)
+            {
+                AnnotationAuthor.Add(new AuthorItem(item.Author));
+
+                AnnotHandlerEventArgs data = item.AnnotHandlerEventArgs;
+
+                switch (item.EventType)
+                {
+                    case AnnotArgsType.AnnotFreeText://文本
+                        if (data is FreeTextAnnotArgs textAnnotArgs)
+                        {
+                            SetColor(textAnnotArgs.FontColor);
+                        }
+                        AnnotFreeTextVisibility = Visibility.Visible;
+                        break;
+
+                    case AnnotArgsType.AnnotHighlight://高亮
+                        if (data is TextHighlightAnnotArgs highlightAnnotArgs)
+                        {
+                            SetColor(highlightAnnotArgs.Color);
+                        }
+                        HighlightVisibility = Visibility.Visible;
+                        break;
+
+                    case AnnotArgsType.AnnotFreehand://手绘
+                        if (data is FreehandAnnotArgs freehandAnnotArgs)
+                        {
+                            SetColor(freehandAnnotArgs.InkColor);
+                        }
+                        FreeHandVisibility = Visibility.Visible;
+                        break;
+
+                    case AnnotArgsType.AnnotSquiggly://波浪线
+
+                        break;
+
+                    case AnnotArgsType.AnnotStamp://图章
+                        AnnotStampVisibility = Visibility.Visible;
+                        break;
+
+                    case AnnotArgsType.AnnotStrikeout://删除线
+                        if (data is TextStrikeoutAnnotArgs textStrikeoutAnnotArgs)
+                        {
+                            SetColor(textStrikeoutAnnotArgs.Color);
+                        }
+                        AnnotStickyVisibility = Visibility.Visible;
+                        break;
+
+                    case AnnotArgsType.AnnotSticky://便签
+                        if (data is StickyAnnotArgs stickyAnnotArgs)
+                        {
+                            SetColor(stickyAnnotArgs.Color);
+                        }
+                        AnnotStickyVisibility = Visibility.Visible;
+                        break;
+
+                    case AnnotArgsType.AnnotUnderline://下划线
+                        if (data is TextUnderlineAnnotArgs textUnderlineAnnotArgs)
+                        {
+                            SetColor(textUnderlineAnnotArgs.Color);
+                        }
+                        UnderLineVisibility = Visibility.Visible;
+                        break;
+
+                    case AnnotArgsType.AnnotLine:
+                        if ((item.AnnotHandlerEventArgs as LineAnnotArgs).HeadLineType >= (C_LINE_TYPE)1 || (item.AnnotHandlerEventArgs as LineAnnotArgs).TailLineType >= (C_LINE_TYPE)1)
+                        {
+                            //箭头
+                            SharpArrowVisibility = Visibility.Visible;
+                        }
+                        else
+                        {
+                            //线
+                            SharpLineVisibility = Visibility.Visible;
+                        }
+                        SetColor((item.AnnotHandlerEventArgs as LineAnnotArgs).LineColor);
+
+                        break;
+
+                    case AnnotArgsType.AnnotSquare://矩形
+                        if (data is SquareAnnotArgs squareAnnotArgs)
+                        {
+                            SetColor(squareAnnotArgs.BgColor);
+                            SetColor(squareAnnotArgs.LineColor);
+                        }
+                        AnnotSquareVisibility = Visibility.Visible;
+                        break;
+
+                    case AnnotArgsType.AnnotCircle://圆
+                        if (data is CircleAnnotArgs circleAnnotArgs)
+                        {
+                            SetColor(circleAnnotArgs.BgColor);
+                            SetColor(circleAnnotArgs.LineColor);
+                        }
+                        AnnotCircleVisibility = Visibility.Visible;
+                        break;
+                }
+            }
+            //AnnotationAuthor = AnnotationAuthor.MyDistinct(s => s.Name) as ObservableCollection<AuthorItem>;
+            //AnnotationColors = AnnotationColors.MyDistinct(s => s.Color) as ObservableCollection<ColorItem>;
+
+            AnnotationAuthor = new ObservableCollection<AuthorItem>(AnnotationAuthor.MyDistinct(s => s.Name));
+            //AnnotationColors = new ObservableCollection<ColorItem>(AnnotationColors.MyDistinct(s => s.Color));
+        }
+    }
+}

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

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

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

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

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

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

+ 198 - 8
PDF Office/ViewModels/PropertyPanel/AnnotPanel/CustomCreateDialogViewModel.cs

@@ -1,16 +1,20 @@
 using ComPDFKit.PDFAnnotation;
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
+using Microsoft.Win32;
 using PDF_Office.Model;
+using PDF_Office.Model.AnnotPanel;
 using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
+using System.Drawing;
 using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
@@ -28,16 +32,26 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         public DelegateCommand CreateCommnad { get; set; }
 
         public DelegateCommand UpDataDynamicCommnad { get; set; }
+        public DelegateCommand OpenImageCommnad { get; set; }
 
         public DelegateCommand<object> KeyDown { get; set; }
 
-        private BitmapSource imageSource;
-        public BitmapSource ImageSource
+        private BitmapSource textImageSource;
+        public BitmapSource TextImageSource
         {
-            get { return imageSource; }
+            get { return textImageSource; }
             set
             {
-                SetProperty(ref imageSource, value);
+                SetProperty(ref textImageSource, value);
+            }
+        }
+        private BitmapSource imagePreviewSource;
+        public BitmapSource ImagePreviewSource
+        {
+            get { return imagePreviewSource; }
+            set
+            {
+                SetProperty(ref imagePreviewSource, value);
             }
         }
         private string stampText = "Stamp Text";
@@ -73,6 +87,29 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
+        private Visibility showImageButton = Visibility.Visible;
+
+        public Visibility ShowImageButton
+        {
+            get { return showImageButton; }
+            set
+            {
+                SetProperty(ref showImageButton, value);
+            }
+        }
+
+        private int radioButtonIndex;
+
+        public int RadioButtonIndex
+        {
+            get { return radioButtonIndex; }
+            set
+            {
+                SetProperty(ref radioButtonIndex, value);
+            }
+        }
+
+
         private C_TEXTSTAMP_SHAPE shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_RECT;
 
         public C_TEXTSTAMP_SHAPE Shape
@@ -97,6 +134,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         public void SetStampStyle(int index)
         {
+            RadioButtonIndex = index;
             switch (index)
             {
                 case 1:
@@ -155,6 +193,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             CreateCommnad = new DelegateCommand(Create);
             UpDataDynamicCommnad = new DelegateCommand(UpDataStamp);
             KeyDown = new DelegateCommand<object>(PreviewKeyDown);
+            OpenImageCommnad = new DelegateCommand(OpenImage);
         }
         private void Cancel()
         {
@@ -163,7 +202,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         private void Create()
         {
-            SaveImageToPath();
+            if (Type == StampType.TEXT_STAMP)
+            {
+                SaveImageToPath();
+            }
             DialogParameters valuePairs = new DialogParameters();
             valuePairs.Add(ParameterNames.DataModel, this);
             RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
@@ -176,7 +218,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             if (!string.IsNullOrEmpty(path))
             {
                 BitmapEncoder encoder = new PngBitmapEncoder();
-                encoder.Frames.Add(BitmapFrame.Create(ImageSource));
+                encoder.Frames.Add(BitmapFrame.Create(TextImageSource));
                 path = System.IO.Path.Combine(path, name);
                 using (FileStream stream = new FileStream(path, FileMode.Create))
                 {
@@ -235,7 +277,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             {
                 PixelFormat fmt = PixelFormats.Bgra32;
                 BitmapSource bps = BitmapSource.Create(width, height, 96, 96, fmt, null, bytes, (width * fmt.BitsPerPixel + 7) / 8);
-                ImageSource = bps;
+                TextImageSource = bps;
                 StampTextDate = date;
                 StampWidth = stampWidth;
                 StampHeight = stampHeight;
@@ -243,13 +285,161 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             }
             else
             {
-                ImageSource = null;
+                TextImageSource = null;
+            }
+        }
+
+        public void OpenImage()
+        {
+            OpenFileDialog openFile = new OpenFileDialog();
+            openFile.Filter = "All Image Files(*.bmp;*.gif;*.jpeg;*.jpg;*.png;*.tiff)|*.bmp;*.gif;*.jpeg;*.jpg;*.png;*.tiff|(*.bmp)|*.bmp|" +
+                "(*.gif)|*.gif|" +
+                "(*.jpeg)|*.jpeg|" +
+                "(*.jpg)|*.jpg|" +
+                "(*.png)|*.png|" +
+                "(*.tiff)|*.tiff";
+            if (openFile.ShowDialog() == false)
+            {
+                return;
+            }
+            string path = App.CachePath.CustomStampPath;
+            string name = Guid.NewGuid().ToString();
+            if (!string.IsNullOrEmpty(path))
+            {
+                BitmapImage image = new BitmapImage(new Uri(openFile.FileName));
+                double scale = Math.Min((double)600 / image.PixelWidth, (double)600 / image.PixelHeight);
+                scale = Math.Min(scale, 1);
+                string ext = Path.GetExtension(openFile.FileName);
+                if (ext.ToUpper() == ".PNG")
+                {
+                    BitmapEncoder encoder = new PngBitmapEncoder();
+                    var targetBitmap = new TransformedBitmap(image, new ScaleTransform(scale, scale));
+                    encoder.Frames.Add(BitmapFrame.Create(targetBitmap));
+                    path = System.IO.Path.Combine(path, name);
+                    using (FileStream stream = new FileStream(path, FileMode.Create))
+                    {
+                        encoder.Save(stream);
+                    }
+                    if (!string.IsNullOrEmpty(SaveToPath))
+                    {
+                        App.CachePath.AddToDeleteFiles(SaveToPath);
+                    }
+                    SaveToPath = path;
+                    ImagePreviewSource = targetBitmap;
+                    StampWidth = targetBitmap.PixelWidth;
+                    StampHeight = targetBitmap.PixelHeight;
+                    Type = StampType.IMAGE_STAMP;
+                    ShowImageButton = Visibility.Collapsed;
+                }
+                else
+                {
+                    BitmapEncoder encoder = new JpegBitmapEncoder();
+                    TransformedBitmap targetBitmap = new TransformedBitmap(image, new ScaleTransform(scale, scale));
+                    encoder.Frames.Add(BitmapFrame.Create(targetBitmap));
+                    path = System.IO.Path.Combine(path, name);
+                    using (FileStream stream = new FileStream(path, FileMode.Create))
+                    {
+                        encoder.Save(stream);
+                    }
+                    if (!string.IsNullOrEmpty(SaveToPath))
+                    {
+                        App.CachePath.AddToDeleteFiles(SaveToPath);
+                    }
+                    SaveToPath = path;
+                    ImagePreviewSource = targetBitmap;
+                    StampWidth = targetBitmap.PixelWidth;
+                    StampHeight = targetBitmap.PixelHeight;
+                    Type = StampType.IMAGE_STAMP;
+                    ShowImageButton = Visibility.Collapsed;
+                }
+            }
+            else
+            {
+                SaveToPath = "";
             }
         }
         public void OnDialogOpened(IDialogParameters parameters)
         {
+            if (parameters != null)
+            {
+                Stamp stamp = parameters.GetValue<Stamp>(ParameterNames.DataModel);
+                if (stamp!=null)
+                {
+                    IsCheckedTime = stamp.IsCheckedTime;
+                    IsCheckedDate = stamp.IsCheckedDate;
+                    StampText = stamp.StampText;
+                    SaveToPath = stamp.SourcePath;
+                    Color = (C_TEXTSTAMP_COLOR)(int)stamp.TextColor;
+                    Shape = (C_TEXTSTAMP_SHAPE)(int)stamp.TextSharp;
+                    UpDataRadioButton(stamp.TextSharp, stamp.TextColor);
+                }
+            }
             UpDataStamp();
             return;
         }
+
+        private void UpDataRadioButton(TextStampSharp textStampSharp, TextStampColor textStampColor)
+        {
+            int index = 1;
+            switch (textStampColor)
+            {
+                case TextStampColor.TEXTSTAMP_WHITE:
+                    switch (textStampSharp)
+                    {
+                        case TextStampSharp.TEXTSTAMP_RECT:
+                            index = 2;
+                            break;
+                        case TextStampSharp.TEXTSTAMP_NONE:
+                            index = 1;
+                            break;
+                    }
+                    break;
+                case TextStampColor.TEXTSTAMP_RED:
+                    switch (textStampSharp)
+                    {
+                        case TextStampSharp.TEXTSTAMP_RECT:
+                            index = 4;
+                            break;
+                        case TextStampSharp.TEXTSTAMP_LEFT_TRIANGLE:
+                            index = 7;
+                            break;
+                        case TextStampSharp.TEXTSTAMP_RIGHT_TRIANGLE:
+                            index = 10;
+                            break;
+                    }
+                    break;
+                case TextStampColor.TEXTSTAMP_GREEN:
+                    switch (textStampSharp)
+                    {
+                        case TextStampSharp.TEXTSTAMP_RECT:
+                            index = 3;
+                            break;
+                        case TextStampSharp.TEXTSTAMP_LEFT_TRIANGLE:
+                            index = 6;
+                            break;
+                        case TextStampSharp.TEXTSTAMP_RIGHT_TRIANGLE:
+                            index = 9;
+                            break;
+                    }
+                    break;
+                case TextStampColor.TEXTSTAMP_BLUE:
+                    switch (textStampSharp)
+                    {
+                        case TextStampSharp.TEXTSTAMP_RECT:
+                            index = 5;
+                            break;
+                        case TextStampSharp.TEXTSTAMP_LEFT_TRIANGLE:
+                            index = 8;
+                            break;
+                        case TextStampSharp.TEXTSTAMP_RIGHT_TRIANGLE:
+                            index = 11;
+                            break;
+                    }
+                    break;
+                default:
+                    break;
+            }
+            RadioButtonIndex = index;
+        }
     }
 }

+ 170 - 33
PDF Office/ViewModels/PropertyPanel/AnnotPanel/StampAnnotPropertyViewModel.cs

@@ -163,24 +163,34 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             ShowDialogCommand = new DelegateCommand(ShowDialog);
             InitStandardStamp();
             UpDataDynamicStampList();
+            LoadSettings();
         }
 
+        /// <summary>
+        /// 加载缓存的自定义图章
+        /// </summary>
         private void LoadSettings()
         {
             PDFSettings.CustomStampList stamps = Settings.Default.CustomStampList;
-            for (int i = 0; i < stamps.Count; i++)
+            if (stamps != null)
             {
-                Stamp customStamp = new Stamp();
-                customStamp.Opacity = 1;
-                customStamp.Author = stamps[i].Author;
-                customStamp.StampText = stamps[i].StampText;
-                customStamp.StampTextDate = stamps[i].StampTextDate;
-                customStamp.MaxWidth = stamps[i].ImageWidth;
-                customStamp.MaxHeight = stamps[i].ImageHeight;
-                customStamp.SourcePath = stamps[i].SourcePath;
-                customStamp.Type = stamps[i].Type;
-                customStamp.TextColor = stamps[i].TextColor;
-                CustomStampList.Add(customStamp);
+                for (int i = 0; i < stamps.Count; i++)
+                {
+                    Stamp customStamp = new Stamp();
+                    customStamp.Opacity = 1;
+                    customStamp.Author = stamps[i].Author;
+                    customStamp.StampText = stamps[i].StampText;
+                    customStamp.StampTextDate = stamps[i].StampTextDate;
+                    customStamp.MaxWidth = stamps[i].ImageWidth;
+                    customStamp.MaxHeight = stamps[i].ImageHeight;
+                    customStamp.SourcePath = stamps[i].SourcePath;
+                    customStamp.Type = stamps[i].Type;
+                    customStamp.TextSharp = stamps[i].TextSharp;
+                    customStamp.TextColor = stamps[i].TextColor;
+                    customStamp.IsCheckedTime = stamps[i].IsCheckedTime;
+                    customStamp.IsCheckedDate = stamps[i].IsCheckedDate;
+                    CustomStampList.Add(customStamp);
+                }
             }
         }
 
@@ -231,8 +241,17 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             Args.StampText = stamp.StampText;
             Args.Author = stamp.Author;
             Args.Opacity = stamp.Opacity;
-            Args.MaxWidth = stamp.MaxWidth;
-            Args.MaxHeight = stamp.MaxHeight;
+            if (stamp.Type == StampType.IMAGE_STAMP)
+            {
+
+                Args.ImageWidth = stamp.MaxWidth;
+                Args.ImageHeight = stamp.MaxHeight;
+            }
+            else
+            {
+                Args.MaxWidth = stamp.MaxWidth;
+                Args.MaxHeight = stamp.MaxHeight;
+            }
             Args.StampTextDate = stamp.StampTextDate;
             Args.TextColor = stamp.TextColor;
             Args.TextSharp = stamp.TextSharp;
@@ -312,6 +331,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                 standardStamp.MaxHeight = (int)DpiHelpers.GetDpiUnrelatedNum(stampHeight / 72D * DpiHelpers.Dpi);
                 standardStamp.Type = StampType.TEXT_STAMP;
                 standardStamp.ImageSource = bps;
+                standardStamp.IsCheckedDate = true;
+                standardStamp.IsCheckedTime = true;
                 switch (DynamicColor[i])
                 {
                     case C_TEXTSTAMP_COLOR.TEXTSTAMP_WHITE:
@@ -331,6 +352,9 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
+        /// <summary>
+        /// 导出图章
+        /// </summary>
         public void SaveToPath(string FileType, Stamp Item)
         {
             SaveFileDialog saveFileDialog = new SaveFileDialog();
@@ -351,25 +375,49 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                 encoder = new PngBitmapEncoder();
             }
             encoder.Frames.Add(BitmapFrame.Create(new Uri(Item.SourcePath)));
-
-            if (FileType.ToUpper() != "PDF")
+            string path = saveFileDialog.FileName;
+            switch (FileType.ToUpper())
             {
-                string path = saveFileDialog.FileName;
-                using (FileStream stream = new FileStream(path, FileMode.Create))
-                {
-                    encoder.Save(stream);
-                }
-
-                CPDFDocument doc = CPDFDocument.CreateDocument();
-                bool tt = doc.InsertPage(0, 300, 500, path);
-                doc.WriteToFilePath("C:\\Users\\93131\\Desktop\\test\\cache\\fafdas.pdf");
-                doc.Release();
-                System.Diagnostics.Process.Start("explorer", "/select,\"" + path + "\"");
+                case "PDF":
+                    CPDFDocument newDoc = CPDFDocument.CreateDocument();
+                    BitmapFrame frame = BitmapFrame.Create(new Uri(Item.SourcePath));
+                    byte[] imageData = new byte[frame.PixelWidth * frame.PixelHeight * 4];
+                    frame.CopyPixels(imageData, frame.PixelWidth * 4, 0);
+                    newDoc.InsertPage(0, frame.PixelWidth, frame.PixelHeight, imageData, CPDFDocumentImageMode.CPDFDocumentImageModeScaleToFill);
+                    newDoc.WriteToFilePath(path);
+                    break;
+                case "PNG":
+                    using (FileStream stream = new FileStream(path, FileMode.Create))
+                    {
+                        encoder.Save(stream);
+                    }
+                    break;
+                default:
+                    break;
             }
-            else
-            {
+            System.Diagnostics.Process.Start("explorer", "/select,\"" + path + "\"");
+        }
+
+        public void DeleteStamp(Stamp stamp)
+        {
+            int index = CustomStampList.IndexOf(stamp);
+            App.CachePath.AddToDeleteFiles(stamp.SourcePath);
+            CustomStampList.RemoveAt(index);
+            PDFSettings.CustomStampList stamps = Settings.Default.CustomStampList;
+            stamps.RemoveAt(index);
+            Settings.Default.Save();
+        }
 
+        public void DeleteAll()
+        {
+            foreach (Stamp item in CustomStampList)
+            {
+                App.CachePath.AddToDeleteFiles(item.SourcePath);
             }
+            CustomStampList.Clear();
+            PDFSettings.CustomStampList stamps = Settings.Default.CustomStampList;
+            stamps.Clear();
+            Settings.Default.Save();
         }
         private void ShowDialog()
         {
@@ -379,7 +427,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     ShowDynamicPropertyDialog();
                     break;
                 case 2:
-                    ShowCustomCreateDialog();
+                    ShowCustomCreateDialog(null);
                     break;
                 default:
                     break;
@@ -411,11 +459,11 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
-        private void ShowCustomCreateDialog()
+        private void ShowCustomCreateDialog(Stamp stamp)
         {
             bool result = true;
             DialogParameters value = new DialogParameters();
-            value.Add(ParameterNames.PDFViewer, PDFViewer);
+            value.Add(ParameterNames.DataModel, stamp);
             dialogs.ShowDialog(DialogNames.CustomCreateDialog, value, e =>
             {
                 if (e.Result != ButtonResult.OK)
@@ -434,6 +482,72 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
+        public void EditorCustomStamp(Stamp stamp)
+        {
+            bool result = true;
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.DataModel, stamp);
+            dialogs.ShowDialog(DialogNames.CustomCreateDialog, value, e =>
+            {
+                if (e.Result != ButtonResult.OK)
+                {
+                    result = false;
+                }
+                CustomCreateDialogViewModel CustomVM = e.Parameters.GetValue<CustomCreateDialogViewModel>(ParameterNames.DataModel);
+                if (CustomVM != null)
+                {
+                    UpDataCustomStamp(CustomVM, stamp);
+                }
+            });
+            if (!result)
+            {
+                return;
+            }
+        }
+
+        private void UpDataCustomStamp(CustomCreateDialogViewModel viewModel, Stamp oldstamp)
+        {
+            Stamp stamp = new Stamp();
+            stamp.Author = "";
+            stamp.Opacity = 1;
+            stamp.SourcePath = viewModel.SaveToPath;
+            stamp.StampText = viewModel.StampText;
+            stamp.MaxWidth = (int)DpiHelpers.GetDpiUnrelatedNum(viewModel.StampWidth / 72D * DpiHelpers.Dpi);
+            stamp.MaxHeight = (int)DpiHelpers.GetDpiUnrelatedNum(viewModel.StampHeight / 72D * DpiHelpers.Dpi);
+            stamp.StampTextDate = viewModel.StampTextDate;
+            stamp.Type = viewModel.Type;
+            stamp.TextColor = (TextStampColor)(int)viewModel.Color;
+            stamp.TextSharp = (TextStampSharp)(int)viewModel.Shape;
+            stamp.IsCheckedDate = viewModel.IsCheckedDate;
+            stamp.IsCheckedTime = viewModel.IsCheckedTime;
+            int index= CustomStampList.IndexOf(oldstamp);
+            CustomStampList[index] = stamp;
+
+            PDFSettings.CustomStampList stamps = Settings.Default.CustomStampList;
+            if (stamps == null)
+            {
+                stamps = Settings.Default.CustomStampList = new PDFSettings.CustomStampList();
+            }
+            PDFSettings.StampAnnote annote = new PDFSettings.StampAnnote();
+            Stamp customStamp = new Stamp();
+            annote.Author = stamp.Author;
+            annote.StampText = stamp.StampText;
+            annote.StampTextDate = stamp.StampTextDate;
+            annote.ImageWidth = stamp.MaxWidth;
+            annote.ImageHeight = stamp.MaxHeight;
+            annote.SourcePath = stamp.SourcePath;
+            annote.Type = stamp.Type;
+            annote.TextSharp = stamp.TextSharp;
+            annote.TextColor = stamp.TextColor;
+            annote.IsCheckedDate = stamp.IsCheckedDate;
+            annote.IsCheckedTime = stamp.IsCheckedTime;
+            stamps[index] = annote;
+            Settings.Default.Save();
+        }
+
+        /// <summary>
+        /// 创建自定义图章,并且保存到APP缓存
+        /// </summary>
         private void CreateCustomStamp(CustomCreateDialogViewModel viewModel)
         {
             Stamp stamp = new Stamp();
@@ -441,13 +555,36 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             stamp.Opacity = 1;
             stamp.SourcePath = viewModel.SaveToPath;
             stamp.StampText = viewModel.StampText;
-            stamp.MaxWidth = (int)DpiHelpers.GetDpiUnrelatedNum(viewModel.StampWidth/ 72D * DpiHelpers.Dpi);
+            stamp.MaxWidth = (int)DpiHelpers.GetDpiUnrelatedNum(viewModel.StampWidth / 72D * DpiHelpers.Dpi);
             stamp.MaxHeight = (int)DpiHelpers.GetDpiUnrelatedNum(viewModel.StampHeight / 72D * DpiHelpers.Dpi);
             stamp.StampTextDate = viewModel.StampTextDate;
             stamp.Type = viewModel.Type;
             stamp.TextColor = (TextStampColor)(int)viewModel.Color;
             stamp.TextSharp = (TextStampSharp)(int)viewModel.Shape;
+            stamp.IsCheckedDate = viewModel.IsCheckedDate;
+            stamp.IsCheckedTime = viewModel.IsCheckedTime;
             CustomStampList.Add(stamp);
+
+            PDFSettings.CustomStampList stamps = Settings.Default.CustomStampList;
+            if (stamps == null)
+            {
+                stamps = Settings.Default.CustomStampList = new PDFSettings.CustomStampList();
+            }
+            PDFSettings.StampAnnote annote = new PDFSettings.StampAnnote();
+            Stamp customStamp = new Stamp();
+            annote.Author = stamp.Author;
+            annote.StampText = stamp.StampText;
+            annote.StampTextDate = stamp.StampTextDate;
+            annote.ImageWidth = stamp.MaxWidth;
+            annote.ImageHeight = stamp.MaxHeight;
+            annote.SourcePath = stamp.SourcePath;
+            annote.Type = stamp.Type;
+            annote.TextSharp = stamp.TextSharp;
+            annote.TextColor = stamp.TextColor;
+            annote.IsCheckedDate = stamp.IsCheckedDate;
+            annote.IsCheckedTime = stamp.IsCheckedTime;
+            stamps.Add(annote);
+            Settings.Default.Save();
         }
     }
 }

+ 1 - 0
PDF Office/ViewModels/PropertyPanel/ViewModular/ReadModeContentViewModel.cs

@@ -21,6 +21,7 @@ using TextBox = System.Windows.Controls.TextBox;
 using static System.Windows.Forms.VisualStyles.VisualStyleElement;
 using Button = System.Windows.Controls.Button;
 using System.Windows.Controls.Primitives;
+using Microsoft.Office.Interop.Word;
 
 namespace PDF_Office.ViewModels.PropertyPanel.ViewModular
 {

+ 213 - 0
PDF Office/ViewModels/PropertyPanel/ViewModular/ReadViewContentViewModel.cs

@@ -0,0 +1,213 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace PDF_Office.ViewModels.PropertyPanel.ViewModular
+{
+    public class ReadViewContentViewModel : BindableBase, INavigationAware
+    {
+        public string ReadRegionName { get; set; }
+        public string ReadModeRegionName { get; set; }
+
+        public CPDFViewer PDFViewer { get; set; }
+
+        private bool canSave;
+
+        /// <summary>
+        /// 是否可以保存
+        /// </summary>
+        public bool CanSave
+        {
+            get { return canSave; }
+            set
+            {
+                SetProperty(ref canSave, value);
+            }
+        }
+
+        private bool canUndo;
+
+        /// <summary>
+        /// 是否可以进行Undo
+        /// </summary>
+        public bool CanUndo
+        {
+            get { return canUndo; }
+            set
+            {
+                SetProperty(ref canUndo, value);
+            }
+        }
+
+        private bool canRedo;
+
+        /// <summary>
+        /// 是否可以进行Redo
+        /// </summary>
+        public bool CanRedo
+        {
+            get { return canRedo; }
+            set
+            {
+                SetProperty(ref canRedo, value);
+            }
+        }
+
+        private Visibility readModeContentVisibility = Visibility.Collapsed;
+
+        public Visibility ReadModeContentVisibility
+        {
+            get { return readModeContentVisibility; }
+            set
+            {
+                SetProperty(ref readModeContentVisibility, value);
+            }
+        }
+
+        private Visibility rectangleReadModeVisibility = Visibility.Collapsed;
+
+        public Visibility RectangleReadModeVisibility
+        {
+            get { return rectangleReadModeVisibility; }
+            set
+            {
+                SetProperty(ref rectangleReadModeVisibility, value);
+            }
+        }
+
+        public IRegionManager region;
+
+        public IDialogService dialogs;
+
+        /// <summary>
+        /// 鼠标滚轮缩放的缩放值
+        /// </summary>
+        private double[] zoomLevel = { 1.00f, 10, 25, 50, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
+
+        public DelegateCommand Load { get; set; }
+
+        public ReadViewContentViewModel(IRegionManager regionManager, IDialogService dialogService)
+        {
+            region = regionManager;
+            dialogs = dialogService;
+            ReadRegionName = RegionNames.ReadRegionName;
+            ReadModeRegionName = RegionNames.ReadModePageRegionName;
+            ReadModeContentVisibility = Visibility.Visible;
+            RectangleReadModeVisibility = Visibility.Collapsed;
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            var pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
+            if (pdfview != null)
+            {
+                PDFViewer = pdfview;
+                LoadFile();
+            }
+        }
+
+        /// <summary>
+        /// 将PDFViwer添加到Region
+        /// </summary>
+        private void LoadFile()
+        {
+            PDFViewer.MouseWheelZoomHandler += PdfViewer_MouseWheelZoomHandler;
+            PDFViewer.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+            CanSave = PDFViewer.UndoManager.CanSave;
+            CanUndo = PDFViewer.UndoManager.CanUndo;
+            CanRedo = PDFViewer.UndoManager.CanRedo;
+
+            if (region.Regions.ContainsRegionWithName(ReadRegionName))
+            {
+                if (region.Regions[ReadRegionName].Views.Contains(PDFViewer))
+                {
+                    var contentRegion = region.Regions[ReadRegionName];
+                    contentRegion.Remove(PDFViewer);
+                }
+                region.AddToRegion(ReadRegionName, PDFViewer);
+            }
+
+            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+            {
+                NavigationParameters parameters = new NavigationParameters();
+                parameters.Add(ParameterNames.PDFViewer, PDFViewer);
+                parameters.Add(ParameterNames.ViewContentViewModel, this);
+
+                region.RequestNavigate(ReadModeRegionName, "ReadModeContent", parameters);
+            }
+             ));
+        }
+
+        public void PdfViewer_MouseWheelZoomHandler(object sender, bool e)
+        {
+            double newZoom = CheckZoomLevel(PDFViewer.ZoomFactor + (e ? 0.01 : -0.01), e);
+            PDFViewer.Zoom(newZoom);
+        }
+
+        private double CheckZoomLevel(double zoom, bool IsGrowth)
+        {
+            double standardZoom = 100;
+            if (zoom <= 0.01)
+            {
+                return 0.01;
+            }
+            if (zoom >= 10)
+            {
+                return 10;
+            }
+
+            zoom *= 100;
+            for (int i = 0; i < zoomLevel.Length - 1; i++)
+            {
+                if (zoom > zoomLevel[i] && zoom <= zoomLevel[i + 1] && IsGrowth)
+                {
+                    standardZoom = zoomLevel[i + 1];
+                    break;
+                }
+                if (zoom >= zoomLevel[i] && zoom < zoomLevel[i + 1] && !IsGrowth)
+                {
+                    standardZoom = zoomLevel[i];
+                    break;
+                }
+            }
+            return standardZoom / 100;
+        }
+
+        private void UndoManager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+        {
+            //不处于页面编辑模式下时,根据PDFVIewer的undo redo状态来更新按钮状态
+            //页面编辑模式下,按钮状态根据页面编辑的undo redo来显示
+            if (e.PropertyName == "CanUndo")
+            {
+                CanUndo = PDFViewer.UndoManager.CanUndo;
+            }
+            if (e.PropertyName == "CanRedo")
+            {
+                CanRedo = PDFViewer.UndoManager.CanRedo;
+            }
+            if (e.PropertyName == "CanSave")
+            {
+                CanSave = PDFViewer.UndoManager.CanSave;
+            }
+        }
+    }
+}

+ 69 - 2
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -52,7 +52,7 @@ namespace PDF_Office.ViewModels
 
         public string ConverterBarContentRegionName { get; set; }
         public string TextEditContentRegionName { get; set; }
-        
+
         public string BackgroundContentRegionName { get; set; }
 
         /// <summary>
@@ -61,6 +61,7 @@ namespace PDF_Office.ViewModels
         public string BottomToolRegionName { get; set; }
 
         private bool _isInPageEdit = false;
+
         /// <summary>
         /// 是否处于页面编辑模式,用于执行undo redo 的具体操作
         /// </summary>
@@ -231,7 +232,6 @@ namespace PDF_Office.ViewModels
             }
         }
 
-
         private bool isPorpertyOpen = false;
 
         /// <summary>
@@ -481,9 +481,11 @@ namespace PDF_Office.ViewModels
                 case "TabItemFill":
                     ToolsBarContentVisible = Visibility.Visible;
                     break;
+
                 case "TabItemEdit":
                     TextEditToolContentVisible = Visibility.Visible;
                     break;
+
                 case "TabItemConvert":
                     ConverterBarContentVisible = Visibility.Visible;
                     break;
@@ -496,6 +498,7 @@ namespace PDF_Office.ViewModels
                 case "RedactionContent":
                     ToolContentVisible = Visibility.Visible;
                     break;
+
                 default:
                     break;
             }
@@ -577,6 +580,70 @@ namespace PDF_Office.ViewModels
             }
         }
 
+        /// <summary>
+        /// 阅读模式
+        /// </summary>
+        /// <param name="viewContent"></param>
+        public async void RbtnReadMode(ViewContent viewContent)
+        {
+            App.IsBookMode = true;
+            IsLoading = Visibility.Visible;
+            await Task.Delay(1);
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.PDFViewer, PDFViewer);
+            param.Add(ParameterNames.ViewContentViewModel, this);
+            region.RequestNavigate(ToolContentRegionName, "ReadViewContent", param);
+
+            //ShowContent(CurrentBar, true);
+            if (GridToolRow != 0)
+            {
+                GridToolRow = 0;
+            }
+
+            if (GridToolRowSpan != 4)
+            {
+                GridToolRowSpan = 4;
+            }
+            //isInPageEdit = true;
+            UpdateShowContent("TabItemPageEdit");
+            IsLoading = Visibility.Collapsed;
+        }
+
+        /// <summary>
+        /// 退出阅读模式
+        /// </summary>
+        public async void UnReadModel()
+        {
+            App.IsBookMode = false;
+            IsLoading = Visibility.Visible;
+            await Task.Delay(1);
+            //region.AddToRegion(ViwerRegionName, PDFViewer);
+
+            if (region.Regions.ContainsRegionWithName(ViwerRegionName))
+            {
+                if (region.Regions[ViwerRegionName].Views.Contains(PDFViewer))
+                {
+                    var contentRegion = region.Regions[ViwerRegionName];
+                    contentRegion.Remove(PDFViewer);
+                }
+                region.AddToRegion(ViwerRegionName, PDFViewer);
+            }
+            if (string.IsNullOrEmpty(CurrentBar) || CurrentBar.Equals("TabItemPageEdit", StringComparison.OrdinalIgnoreCase))
+            {
+                EnterSelectedBar("TabItemAnnotation");
+            }
+            else
+            {
+                EnterSelectedBar(CurrentBar);
+            }
+
+            //isInPageEdit = false;
+            //ShowContent(CurrentBar, false);
+            //isInPageEdit = false;
+
+            IsLoading = Visibility.Collapsed;
+        }
+
         #region PDFViewer鼠标滚轮缩放事件
 
         public void PdfViewer_MouseWheelZoomHandler(object sender, bool e)

Разница между файлами не показана из-за своего большого размера
+ 301 - 0
PDF Office/Views/BOTA/AnnotationContent.xaml


+ 239 - 0
PDF Office/Views/BOTA/AnnotationContent.xaml.cs

@@ -0,0 +1,239 @@
+using ComPDFKitViewer.AnnotEvent;
+using PDF_Office.DataConvert;
+using PDF_Office.Helper;
+using PDF_Office.Model.BOTA;
+using PDF_Office.ViewModels.BOTA;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Forms;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
+using ListBox = System.Windows.Controls.ListBox;
+using MenuItem = System.Windows.Controls.MenuItem;
+using UserControl = System.Windows.Controls.UserControl;
+
+namespace PDF_Office.Views.BOTA
+{
+    /// <summary>
+    /// AnnotationContent.xaml 的交互逻辑
+    /// </summary>
+    public partial class AnnotationContent : UserControl
+    {
+        private AnnotationContentViewModel viewModel;
+
+        public AnnotationContent()
+        {
+            InitializeComponent();
+            viewModel = this.DataContext as AnnotationContentViewModel;
+        }
+
+        private void ListBoxItem_PreviewMouseDown(object sender, MouseButtonEventArgs e)
+        {
+            if (e.ClickCount == 1)
+            {
+                if (Mouse.LeftButton == e.ButtonState)
+                {
+                    viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute(sender);
+                }
+                else if (Mouse.RightButton == e.ButtonState)
+                {
+                    var pos = e.GetPosition(AnnotationList);
+
+                    var result = VisualTreeHelper.HitTest(AnnotationList, pos);
+                    if (result != null)
+                    {
+                        ListBoxItem myListBoxItem = sender as System.Windows.Controls.ListBoxItem;
+                        MenuItem copyText = myListBoxItem.ContextMenu.Items[0] as MenuItem;
+                        MenuItem export = myListBoxItem.ContextMenu.Items[1] as MenuItem;
+                        if (AnnotationList.SelectedItems.Count > 1)
+                        {
+                            export.IsEnabled = false;
+                            copyText.IsEnabled = false;
+                        }
+                        else
+                        {
+                            viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute(sender);
+                            if (myListBoxItem.DataContext is AnnotationHandlerEventArgs annotation)
+                            {
+                                if (annotation.EventType == AnnotArgsType.AnnotFreeText)
+                                {
+                                    copyText.IsEnabled = true;
+                                }
+                                else
+                                {
+                                    copyText.IsEnabled = false;
+                                }
+                            }
+                            export.IsEnabled = true;
+                            export.Command = viewModel.ExportCommentsCommand;
+                        }
+                    }
+                }
+            }
+            //else if (e.ClickCount == 2)
+            //{
+            //    viewModel.DoubleClikCommand.Execute(sender);
+            //}
+        }
+
+        private void AnnotationList_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            //AnnotationList.ContextMenu.IsEnabled = false;
+        }
+
+        private async void MenuExpandAll_Click(object sender, RoutedEventArgs e)
+        {
+            SetAllExpander(true);
+            await Task.Delay(1);
+            for (int i = 0; i < AnnotationList.Items.Count; i++)
+            {
+                ListBoxItem item = AnnotationList.ItemContainerGenerator.ContainerFromIndex(i) as ListBoxItem;
+                ToggleButton button = GetExpandButton(item);
+                if (button != null && button.Visibility == Visibility.Visible)
+                {
+                    button.IsChecked = true;
+                }
+            }
+        }
+
+        private void MenuCollapseAll_Click(object sender, RoutedEventArgs e)
+        {
+            for (int i = 0; i < AnnotationList.Items.Count; i++)
+            {
+                ListBoxItem item = AnnotationList.ItemContainerGenerator.ContainerFromIndex(i) as ListBoxItem;
+                ToggleButton button = GetExpandButton(item);
+                if (button != null && button.Visibility == Visibility.Visible)
+                {
+                    button.IsChecked = false;
+                }
+            }
+            SetAllExpander(false);
+        }
+
+        private void SetAllExpander(bool isexpand)
+        {
+            AnnotationList.Dispatcher.Invoke(() =>
+            {
+                //开启虚拟化之后 全部展开和折叠会有问题
+                var scroller = GetScrollHost(AnnotationList);
+                var stackpanel = CommonHelper.FindVisualChild<StackPanel>(scroller);
+                int count = VisualTreeHelper.GetChildrenCount(stackpanel);
+                for (int i = 0; i < count; i++)
+                {
+                    var item = VisualTreeHelper.GetChild(stackpanel, i) as GroupItem;
+                    var g = CommonHelper.FindVisualChild<Expander>(item);
+                    if (g != null)
+                        g.IsExpanded = isexpand;
+                }
+            });
+        }
+
+        private ScrollViewer GetScrollHost(ListBox listBox)
+        {
+            if (VisualTreeHelper.GetChildrenCount(listBox) > 0)
+            {
+                int s = VisualTreeHelper.GetChildrenCount(listBox);
+
+                Border border = VisualTreeHelper.GetChild(listBox, 0) as Border;
+                if (border != null)
+                {
+                    return VisualTreeHelper.GetChild(border, 0) as ScrollViewer;
+                }
+            }
+            return null;
+        }
+
+        private ToggleButton GetExpandButton(ListBoxItem item)
+        {
+            if (item == null) return null;
+            Border border = VisualTreeHelper.GetChild(item, 0) as Border;
+            var btn = CommonHelper.FindVisualChild<ToggleButton>(border);
+            return btn;
+        }
+
+        private void MenuTimeRightSort_Click(object sender, RoutedEventArgs e)
+        {
+            ICollectionView v = CollectionViewSource.GetDefaultView(AnnotationList.ItemsSource);
+            CreateTimeToDate createTimeToDate = new CreateTimeToDate();
+            v.GroupDescriptions.Clear();
+            v.GroupDescriptions.Add(new PropertyGroupDescription(nameof(AnnotHandlerEventArgs.CreateTime), createTimeToDate));
+
+            v.SortDescriptions.Clear();
+            v.SortDescriptions.Add(new SortDescription(nameof(AnnotHandlerEventArgs.CreateTime), ListSortDirection.Ascending));
+            v.SortDescriptions.Add(new SortDescription(nameof(AnnotHandlerEventArgs.AnnotIndex), ListSortDirection.Ascending));
+        }
+
+        private void MenuTimeBackSort_Click(object sender, RoutedEventArgs e)
+        {
+            ICollectionView v = CollectionViewSource.GetDefaultView(AnnotationList.ItemsSource);
+            CreateTimeToDate createTimeToDate = new CreateTimeToDate();
+            v.GroupDescriptions.Clear();
+            v.GroupDescriptions.Add(new PropertyGroupDescription(nameof(AnnotHandlerEventArgs.CreateTime), createTimeToDate));
+            v.SortDescriptions.Clear();
+            v.SortDescriptions.Add(new SortDescription(nameof(AnnotHandlerEventArgs.CreateTime), ListSortDirection.Descending));
+            v.SortDescriptions.Add(new SortDescription(nameof(AnnotHandlerEventArgs.AnnotIndex), ListSortDirection.Descending));
+        }
+
+        private void MenuPageSort_Click(object sender, RoutedEventArgs e)
+        {
+            ICollectionView v = CollectionViewSource.GetDefaultView(AnnotationList.ItemsSource);
+            v.GroupDescriptions.Clear();
+            v.GroupDescriptions.Add(new PropertyGroupDescription(nameof(AnnotHandlerEventArgs.PageIndex)));
+
+            v.SortDescriptions.Clear();
+            v.SortDescriptions.Add(new SortDescription(nameof(AnnotHandlerEventArgs.PageIndex), ListSortDirection.Ascending));
+            v.SortDescriptions.Add(new SortDescription(nameof(AnnotHandlerEventArgs.AnnotIndex), ListSortDirection.Ascending));
+        }
+
+        private void MenuItemCopyText_Click(object sender, RoutedEventArgs e)
+        {
+            if (AnnotationList.SelectedItems.Count == 1)
+            {
+                if (AnnotationList.SelectedItem is AnnotationHandlerEventArgs annotation)
+                {
+                    if (annotation.EventType == AnnotArgsType.AnnotFreeText)
+                    {
+                        StringBuilder Copystr = new StringBuilder();
+                        Copystr.Append(annotation.Content);
+                        System.Windows.Clipboard.SetText(Copystr.ToString());
+                        CustomControl.MessageBoxEx.Show("数据复制成功");
+                    }
+                }
+            }
+        }
+
+        private void MenuItemDelete_Click(object sender, RoutedEventArgs e)
+        {
+            List<int> pagelist = new List<int>();
+            for (int i = 0; i < AnnotationList.SelectedItems.Count; i++)
+            {
+                AnnotationHandlerEventArgs annotation = AnnotationList.SelectedItems[i] as AnnotationHandlerEventArgs;
+                pagelist.Add(AnnotationList.Items.IndexOf(annotation));
+            }
+            pagelist.Sort();
+            for (int i = 0; i < pagelist.Count; i++)
+            {
+                AnnotationHandlerEventArgs annotation = AnnotationList.Items[pagelist[pagelist.Count - i - 1]] as AnnotationHandlerEventArgs;
+                if (annotation == null)
+                {
+                    continue;
+                }
+
+                viewModel.DeleteCommand.Execute(annotation);
+            }
+        }
+    }
+}

Разница между файлами не показана из-за своего большого размера
+ 351 - 0
PDF Office/Views/BOTA/AnnotationListItem.xaml


+ 208 - 0
PDF Office/Views/BOTA/AnnotationListItem.xaml.cs

@@ -0,0 +1,208 @@
+using ComPDFKit.Import;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKit.PDFDocument;
+using ComPDFKit.PDFPage;
+using ComPDFKitViewer.AnnotEvent;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Helper;
+using PDF_Office.Model.BOTA;
+using PDF_Office.ViewModels.BOTA;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.BOTA
+{
+    /// <summary>
+    /// AnnotationListItem.xaml 的交互逻辑
+    /// </summary>
+    public partial class AnnotationListItem : UserControl
+    {
+        //private Brush strikeoutColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00));
+        public AnnotationListItem()
+        {
+            InitializeComponent();
+        }
+
+        private void GridIco_Loaded(object sender, RoutedEventArgs e)
+        {
+            Grid grid = e.Source as Grid;
+            var args = grid.DataContext as AnnotationHandlerEventArgs;
+            AnnotHandlerEventArgs data = args.AnnotHandlerEventArgs;
+            if (data == null)
+            {
+                return;
+            }
+
+            switch (data.EventType)
+            {
+                case AnnotArgsType.AnnotFreeText:
+                    BtnAnnotFreeText.Visibility = Visibility.Visible;
+                    TxbMarkUpContent.Foreground = new SolidColorBrush((data as FreeTextAnnotArgs).FontColor);
+                    break;
+
+                case AnnotArgsType.AnnotHighlight:
+                    BtnHighlight.Visibility = Visibility.Visible;
+                    PathHighlight.Fill = new SolidColorBrush((data as TextHighlightAnnotArgs).Color);
+                    //TxbContext.Text = data.Content;
+                    if (!string.IsNullOrEmpty(TxbContext.Text))
+                    {
+                        TxbContext.Background = new SolidColorBrush((data as TextHighlightAnnotArgs).Color);
+                    }
+
+                    break;
+
+                case AnnotArgsType.AnnotFreehand:
+                    BtnFreeHand.Visibility = Visibility.Visible;
+                    PathFreehand.Fill = new SolidColorBrush((data as FreehandAnnotArgs).InkColor);
+                    ImageContext.Visibility = Visibility.Visible;
+
+                    TxbContext.Visibility = Visibility.Collapsed;
+
+                    //var encoder = new PngBitmapEncoder();
+                    //encoder.Frames.Add(BitmapFrame.Create((BitmapSource)ImageContext.Source));
+                    //FileStream file = new FileStream(String.Format($@"C:\Users\oyxh\Desktop\images\PDFText\{data.AnnotIndex}.png"), FileMode.Create);
+                    //encoder.Save(file);
+                    //file.Close();
+
+                    break;
+
+                case AnnotArgsType.AnnotSquiggly://波浪线
+                    AnnotSquiggly.Visibility = Visibility.Visible;
+                    AnnotSquigglycolor.Stroke = new SolidColorBrush((data as TextSquigglyAnnotArgs).Color);
+
+                    #region TO DO
+
+                    //TextDecoration mySquiggly = new TextDecoration();
+                    //Pen myPen = new Pen();
+                    //myPen.Brush = new SolidColorBrush((data as TextSquigglyAnnotArgs).Color);
+                    //myPen.Brush.Opacity = 0.8;
+                    //myPen.Thickness = 2;
+                    //myPen.DashStyle = DashStyles.Dash;
+                    //mySquiggly.Pen = myPen;
+                    //mySquiggly.PenThicknessUnit = TextDecorationUnit.FontRecommended;
+
+                    //TextDecorationCollection myCollection = new TextDecorationCollection();
+                    //myCollection.Add(mySquiggly);
+                    //TxbContext.TextDecorations = myCollection;
+
+                    #endregion TO DO
+
+                    break;
+
+                case AnnotArgsType.AnnotStamp:
+                    BtnAnnotStamp.Visibility = Visibility.Visible;
+                    break;
+
+                case AnnotArgsType.AnnotStrikeout://删除线
+                    BtnAnnotStrikeout.Visibility = Visibility.Visible;
+
+                    PathStrikeoutyColor.Fill = new SolidColorBrush((data as TextStrikeoutAnnotArgs).Color);
+
+                    #region to do
+
+                    //TextDecoration myStrikeout = new TextDecoration();
+                    //Pen myPen2 = new Pen();
+                    //myPen2.Brush = new SolidColorBrush((data as TextStrikeoutAnnotArgs).Color);
+                    //myPen2.Brush.Opacity = 0.8;
+                    //myPen2.Thickness = 1;
+                    //myStrikeout.Pen = myPen2;
+                    //myStrikeout.PenOffset = -3;
+                    //myStrikeout.PenThicknessUnit = TextDecorationUnit.FontRecommended;
+                    //TextDecorationCollection myCollection2 = new TextDecorationCollection();
+                    //myCollection2.Add(myStrikeout);
+                    //因为波浪线无法实现 暂时只显示文字 不显示下划线,删除线等
+                    //TxbContext.TextDecorations = myCollection2;
+
+                    #endregion to do
+
+                    break;
+
+                case AnnotArgsType.AnnotSticky://便签
+                    BtnAnnotSticky.Visibility = Visibility;
+                    PathSticky.Fill = new SolidColorBrush((data as StickyAnnotArgs).Color);
+                    break;
+
+                case AnnotArgsType.AnnotUnderline:
+                    BtnUnderLine.Visibility = Visibility.Visible;
+                    RectangleUnderline.Fill = new SolidColorBrush((data as TextUnderlineAnnotArgs).Color);
+
+                    #region TO DO
+
+                    //TextDecoration myUnderline = new TextDecoration();
+                    //Pen myPen1 = new Pen();
+                    //myPen1.Brush = new SolidColorBrush((data as TextUnderlineAnnotArgs).Color);
+                    //myPen1.Brush.Opacity = 0.8;
+                    //myPen1.Thickness = 2;
+                    //myUnderline.Pen = myPen1;
+                    //myUnderline.PenThicknessUnit = TextDecorationUnit.FontRecommended;
+                    //TextDecorationCollection myCollection1 = new TextDecorationCollection();
+                    //myCollection1.Add(myUnderline);
+                    //TxbContext.TextDecorations = myCollection1;
+
+                    #endregion TO DO
+
+                    break;
+
+                case AnnotArgsType.AnnotLine:
+                    if ((data as LineAnnotArgs).HeadLineType >= (C_LINE_TYPE)1 || (data as LineAnnotArgs).TailLineType >= (C_LINE_TYPE)1)
+                    {
+                        BtnSharpArrow.Visibility = Visibility.Visible;
+                        PathArrow.Fill = new SolidColorBrush((data as LineAnnotArgs).LineColor);
+                    }
+                    else
+                    {
+                        PathSharpLine.Fill = new SolidColorBrush((data as LineAnnotArgs).LineColor);
+                        BtnSharpLine.Visibility = Visibility.Visible;
+                    }
+                    ///对于形状注释等只有Note 的处理
+                    if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
+                    {
+                        TxbMarkUpContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
+                        TxbContext.Text = "";
+                    }
+                    break;
+
+                case AnnotArgsType.AnnotSquare:
+                    BtnAnnotSquare.Visibility = Visibility.Visible;
+                    RectAnnotSquare.Stroke = new SolidColorBrush((data as SquareAnnotArgs).LineColor);
+                    RectAnnotSquare.Fill = new SolidColorBrush((data as SquareAnnotArgs).BgColor);
+                    ///对于形状注释等只有Note 的处理
+                    if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
+                    {
+                        TxbMarkUpContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
+                        TxbContext.Text = "";
+                    }
+                    break;
+
+                case AnnotArgsType.AnnotCircle:
+                    BtnAnnotCircle.Visibility = Visibility.Visible;
+                    EllipseCircle.Stroke = new SolidColorBrush((data as CircleAnnotArgs).LineColor);
+                    EllipseCircle.Fill = new SolidColorBrush((data as CircleAnnotArgs).BgColor);
+                    ///对于形状注释等只有Note 的处理
+                    if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
+                    {
+                        TxbMarkUpContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
+                        TxbContext.Text = "";
+                    }
+                    break;
+
+                default:
+                    break;
+            }
+        }
+    }
+}

+ 27 - 15
PDF Office/Views/BOTA/BookmarkContent.xaml

@@ -20,6 +20,7 @@
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
                 <ResourceDictionary Source="pack://application:,,,/Styles/ListViewStyle.xaml" />
+                <ResourceDictionary Source="pack://application:,,,/Styles/ButtonStyle.xaml" />
             </ResourceDictionary.MergedDictionaries>
 
             <convert:BoolToVisible x:Key="BoolToVisibleConvert" />
@@ -37,11 +38,20 @@
                             <ColumnDefinition Width="10*" />
                             <ColumnDefinition Width="90*" />
                         </Grid.ColumnDefinitions>
-                        <Image
-                            Grid.Column="0"
-                            Width="16"
-                            Height="16"
-                            Source="pack://application:,,,/Resources/BOTA/empty_bookmark.png" />
+                        <!--<Image
+                        Grid.Column="0"
+                        Width="16"
+                        Height="16"
+                        Source="pack://application:,,,/Resources/BOTA/empty_bookmark.png" />-->
+                        <Path Grid.Column="0"
+                              Width="16"
+                              Height="16" Data="M3 3.47368C3 2.65979 3.65979 2 4.47368 2H11.5263C12.3402 2 13 2.65979 13 3.47368V14.3044C13 14.9486 12.2314 15.2826 11.7604 14.843L8.50276 11.8026C8.21966 11.5384 7.78034 11.5384 7.49724 11.8026L4.2396 14.843C3.7686 15.2826 3 14.9486 3 14.3044V3.47368Z" Fill="#94989C">
+                            <Path.RenderTransform>
+                                <TransformGroup>
+                                    <TranslateTransform Y="-3" />
+                                </TransformGroup>
+                            </Path.RenderTransform>
+                        </Path>
                         <TextBox
                             Name="TxtTitleInput"
                             Grid.Column="1"
@@ -73,18 +83,12 @@
                 x:Key="ContextMenu"
                 DataContext="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Self}}"
                 FontSize="14">
-                <MenuItem
-                    Click="MenuItemRename_Click"
-                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.DataContext}"
-                    Header="重命名" />
+                <MenuItem Click="MenuItemRename_Click" Header="重命名" />
                 <MenuItem
                     Command="{Binding DataContext.EditPageIndexCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
                     CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.DataContext}"
                     Header="更改目标位置" />
-                <MenuItem
-                    Click="MenuItemDeleteCommand_Click"
-                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.DataContext}"
-                    Header="删除" />
+                <MenuItem Click="MenuItemDeleteCommand_Click" Header="删除" />
             </ContextMenu>
         </ResourceDictionary>
     </UserControl.Resources>
@@ -107,10 +111,18 @@
                 Width="40"
                 Height="40"
                 Margin="0,0,0,0"
+                Style="{StaticResource PageEditToolBtn}"
                 HorizontalAlignment="Right"
                 Command="{Binding AddBookmarkCommand}"
-                CommandParameter="{Binding ElementName=BookMarkListView}"
-                Content="添加" />
+                CommandParameter="{Binding ElementName=BookMarkListView}">
+                <Path Data="M13.5 8C13.5 11.0376 11.0376 13.5 8 13.5C4.96243 13.5 2.5 11.0376 2.5 8C2.5 4.96243 4.96243 2.5 8 2.5C11.0376 2.5 13.5 4.96243 13.5 8ZM15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM7.25005 4.80003V7.25003H4.80005V8.75003H7.25005V11.2H8.75005V8.75003H11.2V7.25003H8.75005V4.80003H7.25005Z" Fill="#616469">
+                    <Path.RenderTransform>
+                        <TransformGroup>
+                            <TranslateTransform Y="-3" />
+                        </TransformGroup>
+                    </Path.RenderTransform>
+                </Path>
+            </Button>
         </Grid>
         <Grid Grid.Row="1">
             <ListView

Разница между файлами не показана из-за своего большого размера
+ 307 - 0
PDF Office/Views/Dialog/BOTA/AddAnnotationDialog.xaml


+ 28 - 0
PDF Office/Views/Dialog/BOTA/AddAnnotationDialog.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Dialog.BOTA
+{
+    /// <summary>
+    /// AddAnnotationDialog.xaml 的交互逻辑
+    /// </summary>
+    public partial class AddAnnotationDialog : UserControl
+    {
+        public AddAnnotationDialog()
+        {
+            InitializeComponent();
+        }
+    }
+}

Разница между файлами не показана из-за своего большого размера
+ 448 - 0
PDF Office/Views/Dialog/BOTA/ScreenAnnotationDialog.xaml


+ 28 - 0
PDF Office/Views/Dialog/BOTA/ScreenAnnotationDialog.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Dialog.BOTA
+{
+    /// <summary>
+    /// ScreenAnnotationDialog.xaml 的交互逻辑
+    /// </summary>
+    public partial class ScreenAnnotationDialog : UserControl
+    {
+        public ScreenAnnotationDialog()
+        {
+            InitializeComponent();
+        }
+    }
+}

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

@@ -0,0 +1,43 @@
+<UserControl x:Class="PDF_Office.Views.HomePanel.PDFTools.PDFToolExpendItem"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:PDF_Office.Views.HomePanel.PDFTools"
+             xmlns:convert="clr-namespace:PDF_Office.DataConvert"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <UserControl.Resources>
+    </UserControl.Resources>
+    <Grid  Margin="1,1,1,1" Background="White">
+        <Border x:Name="BorderExtend" Height="108"  Background="White">
+
+            <Grid>
+                <Grid Margin="10">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                        <ColumnDefinition Width="*"></ColumnDefinition>
+                    </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="auto"></RowDefinition>
+                        <RowDefinition Height="*"></RowDefinition>
+                    </Grid.RowDefinitions>
+                    <Image VerticalAlignment="Top" Source="{Binding Image}" HorizontalAlignment="Center" Width="28" Height="28" Margin="5,10,5,5" />
+
+                    <TextBlock  Name="TxbTitle" Grid.Column="1" Text="{Binding Title}" 
+                                    FontSize="14" FontWeight="SemiBold" Foreground="Black"
+                                    VerticalAlignment="Top" Margin="0,15,0,0"></TextBlock>
+
+
+                    <StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1"  Margin="6,0,6,0">
+                        <Grid>
+                            <TextBlock Name="ToolInfoBlock" Text="{Binding TitleInfo}"
+                                       Foreground="#666666" LineHeight="16"  FontSize="12"  TextWrapping="Wrap" VerticalAlignment="Center" Margin="0,8,0,0"></TextBlock>
+                        </Grid>
+
+                    </StackPanel>
+                </Grid>
+            </Grid>
+        </Border>
+    </Grid>
+</UserControl>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 93 - 107
PDF Office/Views/HomePanel/RecentFiles/RecentFilesContent.xaml

@@ -1,8 +1,8 @@
 <UserControl x:Class="PDF_Office.Views.HomePanel.RecentFiles.RecentFilesContent"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              xmlns:local="clr-namespace:PDF_Office.Views.HomePanel.RecentFiles"
              xmlns:customControl ="clr-namespace:PDF_Office.CustomControl"
              xmlns:DataConvert ="clr-namespace:PDF_Office.DataConvert"
@@ -14,28 +14,27 @@
     <UserControl.Resources>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
-                <ResourceDictionary Source="../../../Styles/ListViewStyle.xaml"/>
-                <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml"/>
-                <ResourceDictionary Source="../../../Styles/RadioButtonStyle.xaml"/>
-                <ResourceDictionary Source="../../../Styles/ButtonStyle.xaml"/>
+                <ResourceDictionary Source="../../../Styles/ListViewStyle.xaml" />
+                <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml" />
+                <ResourceDictionary Source="../../../Styles/RadioButtonStyle.xaml" />
+                <ResourceDictionary Source="../../../Styles/ButtonStyle.xaml" />
             </ResourceDictionary.MergedDictionaries>
-            <DataConvert:BoolToVisible x:Key="BoolToVisible"/>
-            <DataConvert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert"/>
-            <DataConvert:InvertBoolConvert x:Key="InvertBoolConvert"/>
+            <DataConvert:BoolToVisible x:Key="BoolToVisible" />
+            <DataConvert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert" />
+            <DataConvert:InvertBoolConvert x:Key="InvertBoolConvert" />
 
             <DataTemplate x:Key="listviewItem">
                 <local:DocItemListViewControl HorizontalAlignment="Stretch"
                                               OpenFileItemHandler ="DocItemListViewControl_OpenFileItemHandler"
-                                              DeleteItemHandler="DocItemListViewControl_DeleteItemHandler"
-                                              />
+                                              DeleteItemHandler="DocItemListViewControl_DeleteItemHandler" />
             </DataTemplate>
 
             <DataTemplate x:Key="gridviewItem">
-                <local:DocItemControl HorizontalAlignment="Stretch"/>
+                <local:DocItemControl HorizontalAlignment="Stretch" />
             </DataTemplate>
 
             <ItemsPanelTemplate x:Key="listPanel">
-                <StackPanel Orientation="Vertical"/>
+                <StackPanel Orientation="Vertical" />
             </ItemsPanelTemplate>
 
             <ItemsPanelTemplate x:Key="gridPanel">
@@ -46,70 +45,67 @@
                          Opened="ContextMenu_Opened">
                 <ContextMenu.ItemContainerStyle>
                     <Style TargetType="MenuItem">
-                        <Setter Property="Padding" Value="0,7,0,7"/>
-                        <Setter Property="VerticalContentAlignment" Value="Center"/>
+                        <Setter Property="Padding" Value="0,7,0,7" />
+                        <Setter Property="VerticalContentAlignment" Value="Center" />
                     </Style>
                 </ContextMenu.ItemContainerStyle>
                 <MenuItem Name="FilePathMenuItem" Header="打开文件路径" IsEnabled="True" Click="FilePathMenuItem_Click">
                     <MenuItem.Icon>
                         <Path Fill="Black"
-                                              Data="M5.24031 1.5H0.5V14.5H15.5V4H7.24031L5.24031 1.5ZM1.5 13.5V2.5H4.75969L6.75969 5H14.5V13.5H1.5ZM4 7.5H12V6.5H4V7.5Z">
+                              Data="M5.24031 1.5H0.5V14.5H15.5V4H7.24031L5.24031 1.5ZM1.5 13.5V2.5H4.75969L6.75969 5H14.5V13.5H1.5ZM4 7.5H12V6.5H4V7.5Z">
                             <Path.RenderTransform>
-                                <TranslateTransform X="3.0000" Y="0"/>
+                                <TranslateTransform X="3.0000" Y="0" />
                             </Path.RenderTransform>
                         </Path>
                     </MenuItem.Icon>
                 </MenuItem>
-                
+
                 <MenuItem Name="DeleteMenuItem" Header="从最近列表删除" IsEnabled="True" Click="DeleteMenuItem_Click">
                     <MenuItem.Icon>
                         <Path Fill="Black" Data="M9 0H3V2H0V3H1V14H11V3H12V2H9V0ZM2 13V3H3H4H8H9H10V13H2ZM8 2V1H4V2H8ZM4 12V4H3V12H4ZM6.5 4V12H5.5V4H6.5ZM9 12V4H8V12H9Z">
                             <Path.RenderTransform>
-                                <TranslateTransform X="5.0000" Y="0"/>
+                                <TranslateTransform X="5.0000" Y="0" />
                             </Path.RenderTransform>
                         </Path>
                     </MenuItem.Icon>
                 </MenuItem>
-
             </ContextMenu>
 
             <Style x:Key="SubFilesListViewItemStyle" BasedOn="{StaticResource FilesListViewItemStyle}" TargetType="{x:Type ListViewItem}">
-                <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
-                <Setter Property="HorizontalContentAlignment" Value="Center"/>
-                <Setter Property="Margin" Value="12,0,0,0"/>
+                <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}" />
+                <Setter Property="HorizontalContentAlignment" Value="Center" />
+                <Setter Property="Margin" Value="12,0,0,0" />
                 <EventSetter Event="PreviewMouseRightButtonDown"
-                             Handler="ListViewItem_PreviewMouseRightButtonDown"/>
+                             Handler="ListViewItem_PreviewMouseRightButtonDown" />
                 <EventSetter Event="PreviewMouseDoubleClick"
                              Handler="RecentFilesList_PreviewMouseDoubleClick">
                 </EventSetter>
             </Style>
 
             <Style x:Key="HomeGridViewItemStyle" BasedOn="{StaticResource FilesGridItemStyle}" TargetType="{x:Type ListViewItem}">
-                <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
-                <Setter Property="HorizontalContentAlignment" Value="Center"/>
+                <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}" />
+                <Setter Property="HorizontalContentAlignment" Value="Center" />
                 <EventSetter Event="PreviewMouseRightButtonDown"
-                             Handler="ListViewItem_PreviewMouseRightButtonDown"/>
+                             Handler="ListViewItem_PreviewMouseRightButtonDown" />
                 <EventSetter Event="PreviewMouseDoubleClick"
-                             Handler="RecentFilesList_PreviewMouseDoubleClick"/>
+                             Handler="RecentFilesList_PreviewMouseDoubleClick" />
             </Style>
-
         </ResourceDictionary>
-
     </UserControl.Resources>
 
     <Grid>
         <Grid>
             <Grid.RowDefinitions>
-                <RowDefinition Height="Auto"/>
-                <RowDefinition Height="Auto"/>
+                <RowDefinition Height="Auto" />
+                <RowDefinition Height="Auto" />
                 <RowDefinition />
             </Grid.RowDefinitions>
             <Grid x:Name="GridRecentFilesTile" Margin="32,38,0,13">
-                <TextBlock x:Name="TxbRecentlyTile" Text="Recent" HorizontalAlignment="Left" FontWeight="Semibold" FontSize="20" Padding="0,6,0,0" Margin="0,0,0,0"/>
+                <TextBlock x:Name="TxbRecentlyTile" Text="Recent" HorizontalAlignment="Left" FontWeight="Semibold" FontSize="20" Padding="0,6,0,0" Margin="0,0,0,0" />
                 <StackPanel x:Name="PnlRightBtns" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,0,0" Orientation="Horizontal" HorizontalAlignment="Right">
                     <Border  Background="#EEF2F3" Height="30" CornerRadius="4" Padding="1,0,1,0">
                         <StackPanel Orientation="Horizontal">
-                            <RadioButton x:Name="BtnListMode" GroupName="Mode" Tag="ListMode" Width="40" Height="28" Foreground="#333333" 
+                            <RadioButton x:Name="BtnListMode" GroupName="Mode" Tag="ListMode" Width="40" Height="28" Foreground="#333333"
                                          HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
                                          IsChecked="{Binding IsListMode,Mode=OneTime}"
                                          Style="{StaticResource ListModeRadioBtnStyle}">
@@ -120,14 +116,14 @@
                                 </Grid>
                                 <i:Interaction.Triggers>
                                     <i:EventTrigger EventName="Checked">
-                                        <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnListMode,Path =Tag}"/>
+                                        <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnListMode,Path =Tag}" />
                                     </i:EventTrigger>
                                 </i:Interaction.Triggers>
                             </RadioButton>
 
                             <RadioButton x:Name="BtnGridMode" GroupName="Mode" Tag="GridMode" Width="40" Height="28" Foreground="#6B869C"
                                          HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
-                                        IsChecked="{Binding IsListMode,Converter={StaticResource InvertBoolConvert},Mode=OneTime}"
+                                         IsChecked="{Binding IsListMode,Converter={StaticResource InvertBoolConvert},Mode=OneTime}"
                                          Style="{StaticResource ListModeRadioBtnStyle}">
                                 <Grid  Margin="-5,0,0,0" HorizontalAlignment="Center">
                                     <Grid.RowDefinitions>
@@ -135,108 +131,98 @@
                                         <RowDefinition />
                                     </Grid.RowDefinitions>
                                     <Grid.ColumnDefinitions>
-                                        <ColumnDefinition/>
-                                        <ColumnDefinition/>
+                                        <ColumnDefinition />
+                                        <ColumnDefinition />
                                     </Grid.ColumnDefinitions>
-                                    <Rectangle Grid.Row="0" Grid.Column="0" Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round"/>
-                                    <Rectangle Grid.Row="0" Grid.Column="1"  Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round"/>
-                                    <Rectangle Grid.Row="1" Grid.Column="0"  Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round"/>
-                                    <Rectangle Grid.Row="1" Grid.Column="1"  Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round"/>
+                                    <Rectangle Grid.Row="0" Grid.Column="0" Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round" />
+                                    <Rectangle Grid.Row="0" Grid.Column="1"  Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round" />
+                                    <Rectangle Grid.Row="1" Grid.Column="0"  Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round" />
+                                    <Rectangle Grid.Row="1" Grid.Column="1"  Margin="1" Width="5" Height="5" StrokeThickness="1.5" Stroke="{Binding ElementName=BtnGridMode,Path=Foreground}" StrokeDashCap="Round" />
                                 </Grid>
                                 <i:Interaction.Triggers>
                                     <i:EventTrigger EventName="Checked">
-                                        <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnGridMode,Path =Tag}"/>
+                                        <i:InvokeCommandAction Command="{Binding ListModeCheckedCommand}" CommandParameter="{Binding ElementName=BtnGridMode,Path =Tag}" />
                                     </i:EventTrigger>
                                 </i:Interaction.Triggers>
                             </RadioButton>
                         </StackPanel>
                     </Border>
-                    
-                    <Separator  Margin="1 0 1 0" Width="1" Height="16" BorderBrush="#1A000000" BorderThickness="1"/>
 
-                    <Button x:Name="BtnDelete" Margin="0" Padding="0,0,0,0" MaxHeight="40" Width="28" Height="28" Background="Transparent" BorderThickness="0" 
+                    <Separator  Margin="1 0 1 0" Width="1" Height="16" BorderBrush="#1A000000" BorderThickness="1" />
+
+                    <Button x:Name="BtnDelete" Margin="0" Padding="0,0,0,0" MaxHeight="40" Width="28" Height="28" Background="Transparent" BorderThickness="0"
                             IsEnabled="{Binding IsEmpty,Converter={StaticResource InvertBoolConvert},Mode=OneWay}"
                             Command="{Binding RemoveFilesFromContainerCommand}" CommandParameter="{Binding ElementName=RecentFilesList,Path=SelectedItems}"
-                         Style="{StaticResource OnlyContentBtn}" Foreground="#6B6F7D"
-                            >
+                            Style="{StaticResource OnlyContentBtn}" Foreground="#6B6F7D">
                         <Grid Width="20" Height="20">
-                            <Path Data="M8 2H12" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round"/>
-                            <Path Data="M5 5V17H15V5" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round"/>
-                            <Path Data="M17 5H3" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round"/>
-                            <Path Data="M10 9V13" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round"/>
+                            <Path Data="M8 2H12" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round" />
+                            <Path Data="M5 5V17H15V5" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round" />
+                            <Path Data="M17 5H3" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round" />
+                            <Path Data="M10 9V13" Stroke="{Binding ElementName=BtnDelete,Path=Foreground}" StrokeThickness="2" StrokeDashCap="Round" />
                         </Grid>
                     </Button>
-
                 </StackPanel>
-
             </Grid>
 
-                <Grid  Grid.Row="2" Visibility="{Binding IsEmpty,Converter={StaticResource InvertBoolToVisibleConvert}}">
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="799*"/>
-                        <ColumnDefinition Width="*"/>
-                    </Grid.ColumnDefinitions>
+            <Grid  Grid.Row="2" Visibility="{Binding IsEmpty,Converter={StaticResource InvertBoolToVisibleConvert}}">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="799*" />
+                    <ColumnDefinition Width="*" />
+                </Grid.ColumnDefinitions>
                 <Border Visibility="{Binding IsListMode,Converter={StaticResource BoolToVisible}}">
-                    <ListView x:Name="RecentFilesList" 
-                      ItemsSource="{Binding RecentFilesGroup}"
-                      Margin="32,0,0,0"
-                      VirtualizingPanel.IsVirtualizing="True" 
-                      VirtualizingPanel.CacheLengthUnit="Page"
-                      VirtualizingPanel.CacheLength="1"
-                      VirtualizingPanel.ScrollUnit="Pixel"
-                      ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                      ScrollViewer.VerticalScrollBarVisibility="Auto"
-                      Background="Transparent" BorderThickness="0" 
-                      Padding="0,0,0,0" MinHeight="216" MinWidth="380" 
-                      SelectionMode="Multiple"
-                      ItemContainerStyle="{StaticResource SubFilesListViewItemStyle}"
-                      Style="{StaticResource FilesListViewStyle}"
-                      ItemTemplate="{StaticResource listviewItem}"
-                     ItemsPanel="{StaticResource listPanel}" Grid.ColumnSpan="2"
-                     >
+                    <ListView x:Name="RecentFilesList"
+                              ItemsSource="{Binding RecentFilesGroup}"
+                              Margin="32,0,0,0"
+                              VirtualizingPanel.IsVirtualizing="True"
+                              VirtualizingPanel.CacheLengthUnit="Page"
+                              VirtualizingPanel.CacheLength="1"
+                              VirtualizingPanel.ScrollUnit="Pixel"
+                              ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                              ScrollViewer.VerticalScrollBarVisibility="Auto"
+                              Background="Transparent" BorderThickness="0"
+                              Padding="0,0,0,0" MinHeight="216" MinWidth="380"
+                              SelectionMode="Multiple"
+                              ItemContainerStyle="{StaticResource SubFilesListViewItemStyle}"
+                              Style="{StaticResource FilesListViewStyle}"
+                              ItemTemplate="{StaticResource listviewItem}"
+                              ItemsPanel="{StaticResource listPanel}" Grid.ColumnSpan="2">
                     </ListView>
                 </Border>
-                   
 
-                    <ListView x:Name="GridRecentFilesList" 
-                      Visibility="{Binding IsListMode,Converter={StaticResource InvertBoolToVisibleConvert}}"
-                      ItemsSource="{Binding RecentFilesGroup}"   
-                      Margin="32,0,0,0"
-                      VirtualizingPanel.IsVirtualizing="True" 
-                      VirtualizingPanel.CacheLengthUnit="Page"
-                      VirtualizingPanel.CacheLength="1"
-                      VirtualizingPanel.ScrollUnit="Pixel"
-                      ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                      ScrollViewer.VerticalScrollBarVisibility="Auto"
-                      Background="Transparent" BorderThickness="0" 
-                      Padding="0,0,0,0" MinHeight="216" MinWidth="380" 
-                      SelectionMode="Multiple"
-                      ItemContainerStyle="{StaticResource HomeGridViewItemStyle}"
-                      Style="{StaticResource FilesGridViewStyle}"
-                      ItemTemplate="{StaticResource gridviewItem}"
-                     ItemsPanel="{StaticResource gridPanel}" Grid.ColumnSpan="2"
-                     >
-                    </ListView>
-
-                </Grid>
+                <ListView x:Name="GridRecentFilesList"
+                          Visibility="{Binding IsListMode,Converter={StaticResource InvertBoolToVisibleConvert}}"
+                          ItemsSource="{Binding RecentFilesGroup}"
+                          Margin="32,0,0,0"
+                          VirtualizingPanel.IsVirtualizing="True"
+                          VirtualizingPanel.CacheLengthUnit="Page"
+                          VirtualizingPanel.CacheLength="1"
+                          VirtualizingPanel.ScrollUnit="Pixel"
+                          ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                          ScrollViewer.VerticalScrollBarVisibility="Auto"
+                          Background="Transparent" BorderThickness="0"
+                          Padding="0,0,0,0" MinHeight="216" MinWidth="380"
+                          SelectionMode="Multiple"
+                          ItemContainerStyle="{StaticResource HomeGridViewItemStyle}"
+                          Style="{StaticResource FilesGridViewStyle}"
+                          ItemTemplate="{StaticResource gridviewItem}"
+                          ItemsPanel="{StaticResource gridPanel}" Grid.ColumnSpan="2">
+                </ListView>
+            </Grid>
 
-            <StackPanel x:Name="BlankContentPanel" Grid.Row="1" Grid.RowSpan="2"  HorizontalAlignment="Center" VerticalAlignment="Center" 
+            <StackPanel x:Name="BlankContentPanel" Grid.Row="1" Grid.RowSpan="2"  HorizontalAlignment="Center" VerticalAlignment="Center"
                         Visibility="{Binding IsEmpty,Converter={StaticResource BoolToVisible}}">
-                <!--<Image Source="../../Resources/Image/Home/empty_recent2x.png" Width="140" Height="140" Stretch="Uniform" VerticalAlignment="Center"/>-->
+                <!--<Image Source="../../Resources/Image/Home/empty_recent2x.png" Width="140" Height="140" Stretch="Uniform" VerticalAlignment="Center" />-->
                 <TextBlock x:Name="NoFilesText" Text="No documents" TextAlignment="Center"  HorizontalAlignment="Center" FontSize="16" LineHeight="22" Foreground="#FF333333" FontFamily="Segoe UI" />
                 <StackPanel Orientation="Horizontal" Margin="0,12,0,0">
-                    <TextBlock x:Name="clickFileText" Text="Drop documents here or click the '" Foreground="#FF999999" VerticalAlignment="Center" FontSize="14"/>
+                    <TextBlock x:Name="clickFileText" Text="Drop documents here or click the '" Foreground="#FF999999" VerticalAlignment="Center" FontSize="14" />
                     <TextBlock  Margin="2,0,2,0" VerticalAlignment="Center" FontSize="15">
                         <Hyperlink  Command="{Binding OpenFilesCommand}">
-                            <TextBlock x:Name="OpenFilesLinkText" Text="Open Files"/>
+                            <TextBlock x:Name="OpenFilesLinkText" Text="Open Files" />
                         </Hyperlink>
                     </TextBlock>
-                    <TextBlock x:Name="dropFileText" Text="' button in the Sidebar" Foreground="#FF999999" VerticalAlignment="Center" FontSize="14"/>
+                    <TextBlock x:Name="dropFileText" Text="' button in the Sidebar" Foreground="#FF999999" VerticalAlignment="Center" FontSize="14" />
                 </StackPanel>
-
             </StackPanel>
-
         </Grid>
     </Grid>
-
-</UserControl>
+</UserControl>

+ 122 - 17
PDF Office/Views/PropertyPanel/AnnotPanel/CustomCreateDialog.xaml

@@ -1,16 +1,22 @@
 <UserControl x:Class="PDF_Office.Views.PropertyPanel.AnnotPanel.CustomCreateDialog"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:customcontrol="clr-namespace:PDF_Office.CustomControl"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel" xmlns:cus="clr-namespace:PDF_Office.CustomControl" xmlns:annotpanel="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" d:DataContext="{d:DesignInstance Type=annotpanel:CustomCreateDialogViewModel}"
+             xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel" xmlns:cus="clr-namespace:PDF_Office.CustomControl" xmlns:annotpanel="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:dataconvert="clr-namespace:PDF_Office.DataConvert" d:DataContext="{d:DesignInstance Type=annotpanel:CustomCreateDialogViewModel}"
              mc:Ignorable="d" >
 
+    <UserControl.Resources>
+        <PathGeometry x:Key="Ic_AddButtonPath" Figures="M8.5,2.5 L8.5,7.5 L13.5,7.5 L13.5,8.5 L8.5,8.5 L8.5,13.5 L7.5,13.5 L7.5,8.5 L2.5,8.5 L2.5,7.5 L7.5,7.5 L7.5,2.5 L8.5,2.5 Z"/>
+        <dataconvert:UnVisivleConvert x:Key="UnVisivleConvert"/>
+        <dataconvert:IntAndTagToBoolMultiBinding x:Key="IntAndTagToBoolMultiBinding"/>
+    </UserControl.Resources>
     <cus:DialogContent Header="新建图章">
         <cus:DialogContent.Content>
-            <TabControl Grid.Row="1" Name="StampTabControl"  HorizontalAlignment="Center" HorizontalContentAlignment="Center" Style="{StaticResource TabControlWithUnderLineStyle}">
+            <TabControl Grid.Row="1" Name="StampTabControl" SelectedIndex="2"  HorizontalAlignment="Center" HorizontalContentAlignment="Center" Style="{StaticResource TabControlWithUnderLineStyle}">
                 <TabItem x:Name="文字图章"
-                        Header="Standard"
+                        Header="文字图章"
                         FontFamily="Segoe UI" Foreground="#FF666666"
                         HorizontalContentAlignment="Center"
                         FontSize="16"
@@ -24,7 +30,7 @@
                             <RowDefinition Height="*"/>
                             <RowDefinition Height="*"/>
                         </Grid.RowDefinitions>
-                        <Image Height="50" Source="{Binding ImageSource}"/>
+                        <Image Height="50" Source="{Binding TextImageSource}"/>
                         <TextBox Grid.Row="1" Text="{Binding StampText,Mode=TwoWay}" TextChanged="TextBox_TextChanged">
                             <i:Interaction.Triggers>
                                 <i:EventTrigger EventName="LostFocus">
@@ -37,17 +43,94 @@
                         </TextBox>
                         <Grid Grid.Row="2">
                             <StackPanel Orientation="Horizontal">
-                                <RadioButton Tag="1" Checked="RadioButton_Checked"/>
-                                <RadioButton Tag="2" Checked="RadioButton_Checked"/>
-                                <RadioButton Tag="3" Checked="RadioButton_Checked"/>
-                                <RadioButton Tag="4" Checked="RadioButton_Checked"/>
-                                <RadioButton Tag="5" Checked="RadioButton_Checked"/>
-                                <RadioButton Tag="6" Checked="RadioButton_Checked"/>
-                                <RadioButton Tag="7" Checked="RadioButton_Checked"/>
-                                <RadioButton Tag="8" Checked="RadioButton_Checked"/>
-                                <RadioButton Tag="9" Checked="RadioButton_Checked"/>
-                                <RadioButton Tag="10" Checked="RadioButton_Checked"/>
-                                <RadioButton Tag="11" Checked="RadioButton_Checked"/>
+                                <RadioButton Tag="1" Checked="RadioButton_Checked" >
+                                    <RadioButton.IsChecked>
+                                        <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
+                                            <Binding Source="1"/>
+                                            <Binding Path="RadioButtonIndex"/>
+                                        </MultiBinding>
+                                    </RadioButton.IsChecked>
+                                </RadioButton>
+                                <RadioButton Tag="2" Checked="RadioButton_Checked">
+                                    <RadioButton.IsChecked>
+                                        <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
+                                            <Binding Source="2"/>
+                                            <Binding Path="RadioButtonIndex"/>
+                                        </MultiBinding>
+                                    </RadioButton.IsChecked>
+                                </RadioButton>
+                                <RadioButton Tag="3" Checked="RadioButton_Checked">
+                                    <RadioButton.IsChecked>
+                                        <MultiBinding  Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
+                                            <Binding Source="3"/>
+                                            <Binding Path="RadioButtonIndex"/>
+                                        </MultiBinding>
+                                    </RadioButton.IsChecked>
+                                </RadioButton>
+                                <RadioButton Tag="4" Checked="RadioButton_Checked">
+                                    <RadioButton.IsChecked>
+                                        <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
+                                            <Binding Source="4"/>
+                                            <Binding Path="RadioButtonIndex"/>
+                                        </MultiBinding>
+                                    </RadioButton.IsChecked>
+                                </RadioButton>
+                                <RadioButton Tag="5" Checked="RadioButton_Checked">
+                                    <RadioButton.IsChecked>
+                                        <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
+                                            <Binding Source="5"/>
+                                            <Binding Path="RadioButtonIndex"/>
+                                        </MultiBinding>
+                                    </RadioButton.IsChecked>
+                                </RadioButton>
+                                <RadioButton Tag="6" Checked="RadioButton_Checked">
+                                    <RadioButton.IsChecked>
+                                        <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
+                                            <Binding Source="6"/>
+                                            <Binding Path="RadioButtonIndex"/>
+                                        </MultiBinding>
+                                    </RadioButton.IsChecked>
+                                </RadioButton>
+                                <RadioButton Tag="7" Checked="RadioButton_Checked">
+                                    <RadioButton.IsChecked>
+                                        <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
+                                            <Binding Source="7"/>
+                                            <Binding Path="RadioButtonIndex"/>
+                                        </MultiBinding>
+                                    </RadioButton.IsChecked>
+                                </RadioButton>
+                                <RadioButton Tag="8" Checked="RadioButton_Checked">
+                                    <RadioButton.IsChecked>
+                                        <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
+                                            <Binding Source="8"/>
+                                            <Binding Path="RadioButtonIndex"/>
+                                        </MultiBinding>
+                                    </RadioButton.IsChecked>
+                                </RadioButton>
+                                <RadioButton Tag="9" Checked="RadioButton_Checked">
+                                    <RadioButton.IsChecked>
+                                        <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
+                                            <Binding Source="9"/>
+                                            <Binding Path="RadioButtonIndex"/>
+                                        </MultiBinding>
+                                    </RadioButton.IsChecked>
+                                </RadioButton>
+                                <RadioButton Tag="10" Checked="RadioButton_Checked">
+                                    <RadioButton.IsChecked>
+                                        <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding }" Mode="OneWay">
+                                            <Binding Source="10"/>
+                                            <Binding Path="RadioButtonIndex"/>
+                                        </MultiBinding>
+                                    </RadioButton.IsChecked>
+                                </RadioButton>
+                                <RadioButton Tag="11" Checked="RadioButton_Checked">
+                                    <RadioButton.IsChecked>
+                                        <MultiBinding Converter="{StaticResource IntAndTagToBoolMultiBinding}" Mode="OneWay">
+                                            <Binding Source="11"/>
+                                            <Binding Path="RadioButtonIndex"/>
+                                        </MultiBinding>
+                                    </RadioButton.IsChecked>
+                                </RadioButton>
                             </StackPanel>
                         </Grid>
                         <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center">
@@ -57,12 +140,34 @@
                     </Grid>
                 </TabItem>
                 <TabItem  x:Name="图片图章"
-                        Header="Dynamic"
+                        Header="图片图章"
                         FontFamily="Segoe UI" Foreground="#FF666666"
                         HorizontalContentAlignment="Center"
                         FontSize="16"
                         Width="86">
-                    <Image/>
+                    <Grid>
+                        <customcontrol:PathButton
+                        x:Name="BtnAdd"
+                        Height="24" Width="24"  IconHeight="20"  IconWidth="20" 
+                        Icon="{StaticResource Ic_AddButtonPath}"  IconFill="Red"
+                        IconPress="{StaticResource Ic_AddButtonPath}" IconPressFill="#C04CF8"
+                        IconMouseOver="{StaticResource Ic_AddButtonPath}" IconMouseOverFill="#C04CF8" Visibility="{Binding ShowImageButton}"  Command="{Binding OpenImageCommnad}"/>
+                        <Grid Visibility="{Binding ElementName=BtnAdd,Path=Visibility,Converter={StaticResource UnVisivleConvert}}">
+                            <Grid.RowDefinitions>
+                                <RowDefinition Height="24"/>
+                                <RowDefinition Height="*"/>
+                            </Grid.RowDefinitions>
+                            <Image Grid.RowSpan="2" Width="200" Height="200" Source="{Binding ImagePreviewSource}" />
+
+                            <customcontrol:PathButton
+                            x:Name="BtnReAdd"
+                            HorizontalAlignment="Right" VerticalAlignment="Top"
+                            Height="24" Width="24"  IconHeight="20"  IconWidth="20" 
+                            Icon="{StaticResource Ic_AddButtonPath}"  IconFill="Red"
+                            IconPress="{StaticResource Ic_AddButtonPath}" IconPressFill="#C04CF8"
+                            IconMouseOver="{StaticResource Ic_AddButtonPath}" IconMouseOverFill="#C04CF8" Command="{Binding OpenImageCommnad}"/>
+                        </Grid>
+                    </Grid>
                 </TabItem>
             </TabControl>
         </cus:DialogContent.Content>

+ 2 - 1
PDF Office/Views/PropertyPanel/AnnotPanel/CustomCreateDialog.xaml.cs

@@ -1,4 +1,5 @@
-using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
+using PDF_Office.Helper;
+using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
 using System;
 using System.Collections.Generic;
 using System.Linq;

+ 290 - 96
PDF Office/Views/PropertyPanel/AnnotPanel/SharpsAnnotProperty.xaml

@@ -1,34 +1,36 @@
-<UserControl x:Class="PDF_Office.Views.PropertyPanel.AnnotPanel.SharpsAnnotProperty"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel"
-             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
-             xmlns:CompositeControl="clr-namespace:PDF_Office.CustomControl.CompositeControl"
-             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
-             xmlns:prism="http://prismlibrary.com/"             
-             prism:ViewModelLocator.AutoWireViewModel="True"
-             xmlns:Convert="clr-namespace:PDF_Office.DataConvert"
-              xmlns:DashConvert="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel"
-             mc:Ignorable="d" 
-             d:DesignHeight="450" d:DesignWidth="800">
+<UserControl
+    x:Class="PDF_Office.Views.PropertyPanel.AnnotPanel.SharpsAnnotProperty"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:CompositeControl="clr-namespace:PDF_Office.CustomControl.CompositeControl"
+    xmlns:Convert="clr-namespace:PDF_Office.DataConvert"
+    xmlns:DashConvert="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+    xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    mc:Ignorable="d">
     <UserControl.Resources>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
-                <ResourceDictionary Source="../../../Styles/SliderStyle.xaml"></ResourceDictionary>
-                <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml"/>
+                <ResourceDictionary Source="../../../Styles/SliderStyle.xaml" />
+                <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml" />
             </ResourceDictionary.MergedDictionaries>
-            <Convert:ColorToBrushConverter x:Key="ColorToBrushConvert"></Convert:ColorToBrushConverter>
-            <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert"/>
-            <DashConvert:DashStyleConverter x:Key="DashStyleConverter"/>
+            <Convert:ColorToBrushConverter x:Key="ColorToBrushConvert" />
+            <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert" />
+            <DashConvert:DashStyleConverter x:Key="DashStyleConverter" />
 
             <Style x:Key="line1Style" TargetType="{x:Type Line}">
                 <Setter Property="Visibility">
                     <Setter.Value>
                         <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
-                            <Binding ElementName="SharpRectBtn" Path="IsChecked"/>
-                            <Binding ElementName="SharpCircleBtn" Path="IsChecked"/>
+                            <Binding ElementName="SharpRectBtn" Path="IsChecked" />
+                            <Binding ElementName="SharpCircleBtn" Path="IsChecked" />
                         </MultiBinding>
                     </Setter.Value>
                 </Setter>
@@ -37,8 +39,8 @@
                 <Setter Property="Visibility">
                     <Setter.Value>
                         <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
-                            <Binding ElementName="SharpCircleBtn" Path="IsChecked"/>
-                            <Binding ElementName="SharpArrowBtn" Path="IsChecked"/>
+                            <Binding ElementName="SharpCircleBtn" Path="IsChecked" />
+                            <Binding ElementName="SharpArrowBtn" Path="IsChecked" />
                         </MultiBinding>
                     </Setter.Value>
                 </Setter>
@@ -47,8 +49,8 @@
                 <Setter Property="Visibility">
                     <Setter.Value>
                         <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
-                            <Binding ElementName="SharpArrowBtn" Path="IsChecked"/>
-                            <Binding ElementName="SharpLineBtn" Path="IsChecked"/>
+                            <Binding ElementName="SharpArrowBtn" Path="IsChecked" />
+                            <Binding ElementName="SharpLineBtn" Path="IsChecked" />
                         </MultiBinding>
                     </Setter.Value>
                 </Setter>
@@ -58,62 +60,169 @@
     </UserControl.Resources>
     <Grid Background="#F3F3F3">
         <StackPanel>
-            <TextBlock Name="AnnotTypeTitle" Text="{Binding AnnotTypeTitle}" FontFamily="SegoeUI" FontWeight="Bold" FontSize="18" LineHeight="24" HorizontalAlignment="Left" Margin="10,8,0,0" />
-            <Border Width="228" Height="100" BorderThickness="1" CornerRadius="2" BorderBrush="#DDDDDD" Background="White" Margin="0,8,0,0">
+            <TextBlock
+                Name="AnnotTypeTitle"
+                Margin="10,8,0,0"
+                HorizontalAlignment="Left"
+                FontFamily="SegoeUI"
+                FontSize="18"
+                FontWeight="Bold"
+                LineHeight="24"
+                Text="{Binding AnnotTypeTitle}" />
+            <Border
+                Width="228"
+                Height="100"
+                Margin="0,8,0,0"
+                Background="White"
+                BorderBrush="#DDDDDD"
+                BorderThickness="1"
+                CornerRadius="2">
                 <Grid>
-                    <Path Name="SharpPath" Opacity="{Binding FillOpacity}" StrokeThickness="{Binding LineWidth}"  Data="{Binding DataPath}"
+                    <Path
+                        Name="SharpPath"
+                        Width="36"
+                        Height="36"
+                        HorizontalAlignment="Center"
+                        VerticalAlignment="Center"
+                        Data="{Binding DataPath}"
+                        Fill="{Binding FillColor}"
+                        Opacity="{Binding FillOpacity}"
                         Stroke="{Binding SelectColor}"
-                        Fill="{Binding FillColor}" StrokeStartLineCap="Flat"
-                         StrokeDashArray="{Binding Dash,Converter={StaticResource DashStyleConverter}}"
-                        Width="36" Height="36" HorizontalAlignment="Center" VerticalAlignment="Center">
-                        <!--,Converter={StaticResource ColorToBrushConvert}-->
+                        StrokeDashArray="{Binding Dash, Converter={StaticResource DashStyleConverter}}"
+                        StrokeStartLineCap="Flat"
+                        StrokeThickness="{Binding LineWidth}">
+                        <!--  ,Converter={StaticResource ColorToBrushConvert}  -->
                     </Path>
                 </Grid>
             </Border>
 
 
-            <Border Width="162" Height="32" Margin="0,12,0,0" BorderThickness="1" BorderBrush="#FFE2E3E6">
+            <Border
+                Width="162"
+                Height="32"
+                Margin="0,12,0,0"
+                BorderBrush="#FFE2E3E6"
+                BorderThickness="1">
                 <Grid Name="ToolGrid">
                     <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="40.5"></ColumnDefinition>
-                        <ColumnDefinition Width="40.5"></ColumnDefinition>
-                        <ColumnDefinition Width="40.5"></ColumnDefinition>
-                        <ColumnDefinition Width="40.5"></ColumnDefinition>
+                        <ColumnDefinition Width="40.5" />
+                        <ColumnDefinition Width="40.5" />
+                        <ColumnDefinition Width="40.5" />
+                        <ColumnDefinition Width="40.5" />
                     </Grid.ColumnDefinitions>
 
 
-                    <ToggleButton Name="SharpRectBtn" Tag="Rect" Width="40.5" Background="Transparent" BorderThickness="0" Click="SharpsBtn_Click" 
-                                  Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpRectBtn,Path=Tag}">
-                        <Rectangle HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" Stroke="#273C62"></Rectangle>
+                    <ToggleButton
+                        Name="SharpRectBtn"
+                        Width="40.5"
+                        Background="Transparent"
+                        BorderThickness="0"
+                        Click="SharpsBtn_Click"
+                        Command="{Binding SharpsTypeCommand}"
+                        CommandParameter="{Binding ElementName=SharpRectBtn, Path=Tag}"
+                        Tag="Rect">
+                        <Rectangle
+                            Width="16"
+                            Height="16"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            Stroke="#273C62" />
                     </ToggleButton>
 
-                    <Line Name="line1" HorizontalAlignment="Left"  VerticalAlignment="Center" Grid.Column="1" X1="0" Y1="0" X2="0" Y2="16" StrokeThickness="1" Stroke="#33000000">
+                    <Line
+                        Name="line1"
+                        Grid.Column="1"
+                        HorizontalAlignment="Left"
+                        VerticalAlignment="Center"
+                        Stroke="#33000000"
+                        StrokeThickness="1"
+                        X1="0"
+                        X2="0"
+                        Y1="0"
+                        Y2="16" />
 
-                    </Line>
-
-                    <ToggleButton Name="SharpCircleBtn" Width="40.5" Tag="Circle" Grid.Column="1" Background="Transparent"  BorderThickness="0"  Margin="0,0,0,0" Click="SharpsBtn_Click"
-                                  Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpCircleBtn,Path=Tag}"
-                                  >
-                        <Ellipse Width="16" Height="16" Stroke="#273C62" HorizontalAlignment="Center" VerticalAlignment="Center"  ></Ellipse>
+                    <ToggleButton
+                        Name="SharpCircleBtn"
+                        Grid.Column="1"
+                        Width="40.5"
+                        Margin="0,0,0,0"
+                        Background="Transparent"
+                        BorderThickness="0"
+                        Click="SharpsBtn_Click"
+                        Command="{Binding SharpsTypeCommand}"
+                        CommandParameter="{Binding ElementName=SharpCircleBtn, Path=Tag}"
+                        Tag="Circle">
+                        <Ellipse
+                            Width="16"
+                            Height="16"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            Stroke="#273C62" />
                     </ToggleButton>
 
 
-                    <Line Name="line2" HorizontalAlignment="Left" Style="{StaticResource line2Style}" VerticalAlignment="Center" Grid.Column="2" X1="0" Y1="0" X2="0" Y2="16" StrokeThickness="1" Stroke="#33000000"></Line>
-                    <ToggleButton Name="SharpArrowBtn" Width="40.5" Tag="Arrow" Grid.Column="2" Background="Transparent"  BorderThickness="0" Click="SharpsBtn_Click"
-                                    Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpArrowBtn,Path=Tag}"
-                                  >
-                        <Path HorizontalAlignment="Center" VerticalAlignment="Center"  Fill="#273C62" Width="16" Height="16">
+                    <Line
+                        Name="line2"
+                        Grid.Column="2"
+                        HorizontalAlignment="Left"
+                        VerticalAlignment="Center"
+                        Stroke="#33000000"
+                        StrokeThickness="1"
+                        Style="{StaticResource line2Style}"
+                        X1="0"
+                        X2="0"
+                        Y1="0"
+                        Y2="16" />
+                    <ToggleButton
+                        Name="SharpArrowBtn"
+                        Grid.Column="2"
+                        Width="40.5"
+                        Background="Transparent"
+                        BorderThickness="0"
+                        Click="SharpsBtn_Click"
+                        Command="{Binding SharpsTypeCommand}"
+                        CommandParameter="{Binding ElementName=SharpArrowBtn, Path=Tag}"
+                        Tag="Arrow">
+                        <Path
+                            Width="16"
+                            Height="16"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            Fill="#273C62">
                             <Path.Data>
                                 M13.4,2.6 L13.4,8 L12.2,8 L12.1997359,4.648 L2.02426407,14.8242641 L1.17573593,13.9757359 L11.3517359,3.799 L8,3.8 L8,2.6 L13.4,2.6 Z
                             </Path.Data>
                         </Path>
                     </ToggleButton>
 
-                    <Line x:Name="line3" HorizontalAlignment="Left" Style="{StaticResource line3Style}" VerticalAlignment="Center" Grid.Column="3" X1="0" Y1="0" X2="0" Y2="16" StrokeThickness="1" Stroke="#33000000"></Line>
-                    <ToggleButton Name="SharpLineBtn" Width="40.5" Tag="Line" Grid.Column="3" Background="Transparent"  BorderThickness="0" Click="SharpsBtn_Click"
-                                   Command="{Binding SharpsTypeCommand}" CommandParameter="{Binding ElementName=SharpLineBtn,Path=Tag}"
-                                  >
-                        <Polygon Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="#273C62">
+                    <Line
+                        x:Name="line3"
+                        Grid.Column="3"
+                        HorizontalAlignment="Left"
+                        VerticalAlignment="Center"
+                        Stroke="#33000000"
+                        StrokeThickness="1"
+                        Style="{StaticResource line3Style}"
+                        X1="0"
+                        X2="0"
+                        Y1="0"
+                        Y2="16" />
+                    <ToggleButton
+                        Name="SharpLineBtn"
+                        Grid.Column="3"
+                        Width="40.5"
+                        Background="Transparent"
+                        BorderThickness="0"
+                        Click="SharpsBtn_Click"
+                        Command="{Binding SharpsTypeCommand}"
+                        CommandParameter="{Binding ElementName=SharpLineBtn, Path=Tag}"
+                        Tag="Line">
+                        <Polygon
+                            Width="16"
+                            Height="16"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            Fill="#273C62">
                             <Polygon.Points>
                                 13.1757359 1.97573593 14.0242641 2.82426407 2.82426407 14.0242641 1.97573593 13.1757359
                             </Polygon.Points>
@@ -124,22 +233,22 @@
             </Border>
 
 
-            <Grid Margin="0,18,0,0" x:Name="GridFill">
+            <Grid x:Name="GridFill" Margin="0,18,0,0">
                 <Grid.RowDefinitions>
-                    <RowDefinition Height="auto"/>
-                    <RowDefinition/>
+                    <RowDefinition Height="auto" />
+                    <RowDefinition />
                 </Grid.RowDefinitions>
-                <CompositeControl:SlidContent x:Name="layerFill" HorizontalAlignment="Right"/>
-                <CompositeControl:ColorContent Grid.Row="1" x:Name="cusFillColor"/>
+                <CompositeControl:SlidContent x:Name="layerFill" HorizontalAlignment="Right" />
+                <CompositeControl:ColorContent x:Name="cusFillColor" Grid.Row="1" />
             </Grid>
 
             <Grid Margin="0,18,0,0">
                 <Grid.RowDefinitions>
-                    <RowDefinition Height="auto"/>
-                    <RowDefinition/>
+                    <RowDefinition Height="auto" />
+                    <RowDefinition />
                 </Grid.RowDefinitions>
-                <CompositeControl:SlidContent x:Name="layerThick" HorizontalAlignment="Right"/>
-                <CompositeControl:ColorContent Grid.Row="1" x:Name="cusColor"/>
+                <CompositeControl:SlidContent x:Name="layerThick" HorizontalAlignment="Right" />
+                <CompositeControl:ColorContent x:Name="cusColor" Grid.Row="1" />
 
             </Grid>
 
@@ -147,59 +256,144 @@
 
             <Grid>
                 <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                    <ColumnDefinition Width="*" />
+                    <ColumnDefinition Width="auto" />
                 </Grid.ColumnDefinitions>
-                <Slider Name="BorderSlider" VerticalAlignment="Center" Value="{Binding LineWidth}" Margin="12,0,4,0"  Minimum="1" Maximum="12" IsSelectionRangeEnabled="True" IsMoveToPointEnabled="True"
-                    Style="{StaticResource RoundThumbSlider}"  TickFrequency="1" IsSnapToTickEnabled="True" >
+                <Slider
+                    Name="BorderSlider"
+                    Margin="12,0,4,0"
+                    VerticalAlignment="Center"
+                    IsMoveToPointEnabled="True"
+                    IsSelectionRangeEnabled="True"
+                    IsSnapToTickEnabled="True"
+                    Maximum="12"
+                    Minimum="1"
+                    Style="{StaticResource RoundThumbSlider}"
+                    TickFrequency="1"
+                    Value="{Binding LineWidth}">
                     <Slider.Resources>
                         <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
                         <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
                     </Slider.Resources>
                 </Slider>
 
-                <Border Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="0,0,12,0"  BorderThickness="0">
+                <Border
+                    Grid.Column="1"
+                    Width="80"
+                    Height="32"
+                    Margin="0,0,12,0"
+                    BorderBrush="#E2E3E6"
+                    BorderThickness="0">
                     <Grid>
-                        <ComboBox Name="BorderDropBox" BorderThickness="1" Padding="10 10 0 0" Background="Transparent" BorderBrush="#FFE2E3E6" >
+                        <ComboBox
+                            Name="BorderDropBox"
+                            Padding="10,10,0,0"
+                            Background="Transparent"
+                            BorderBrush="#FFE2E3E6"
+                            BorderThickness="1">
                             <ComboBox.ItemContainerStyle>
                                 <Style TargetType="{x:Type ComboBoxItem}">
-                                    <Setter Property="Padding" Value="10 0 0 0"/>
+                                    <Setter Property="Padding" Value="10,0,0,0" />
                                 </Style>
                             </ComboBox.ItemContainerStyle>
-                            <ComboBoxItem Content="1" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                
-                            </ComboBoxItem>
-                            <ComboBoxItem Content="3" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
-                            <ComboBoxItem Content="6" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
-                            <ComboBoxItem Content="9" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
-                            <ComboBoxItem Content="12" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
+                            <ComboBoxItem
+                                Height="32"
+                                VerticalContentAlignment="Center"
+                                Content="1"
+                                Template="{StaticResource comboxitem}" />
+                            <ComboBoxItem
+                                Height="32"
+                                VerticalContentAlignment="Center"
+                                Content="3"
+                                Template="{StaticResource comboxitem}" />
+                            <ComboBoxItem
+                                Height="32"
+                                VerticalContentAlignment="Center"
+                                Content="6"
+                                Template="{StaticResource comboxitem}" />
+                            <ComboBoxItem
+                                Height="32"
+                                VerticalContentAlignment="Center"
+                                Content="9"
+                                Template="{StaticResource comboxitem}" />
+                            <ComboBoxItem
+                                Height="32"
+                                VerticalContentAlignment="Center"
+                                Content="12"
+                                Template="{StaticResource comboxitem}" />
                             <i:Interaction.Triggers>
                                 <i:EventTrigger EventName="SelectionChanged">
-                                    <i:InvokeCommandAction Command="{Binding ThicknessChangedCommand}" CommandParameter="{Binding ElementName=BorderDropBox,Path=SelectedItem}"/>
+                                    <i:InvokeCommandAction Command="{Binding ThicknessChangedCommand}" CommandParameter="{Binding ElementName=BorderDropBox, Path=SelectedItem}" />
                                 </i:EventTrigger>
                             </i:Interaction.Triggers>
                         </ComboBox>
-                        <TextBox FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Margin="10,0,35,0" IsReadOnly="True"
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" Text="{Binding ElementName=BorderSlider,Path=Value}">
-                        </TextBox>
+                        <TextBox
+                            Height="20"
+                            Margin="10,0,35,0"
+                            VerticalAlignment="Center"
+                            Background="White"
+                            BorderThickness="0"
+                            FontFamily="Segoe UI"
+                            FontSize="14"
+                            IsReadOnly="True"
+                            Text="{Binding ElementName=BorderSlider, Path=Value}"
+                            TextAlignment="Left" />
                     </Grid>
                 </Border>
             </Grid>
 
 
-            <StackPanel x:Name="PnlLineStyle" Orientation="Horizontal" Margin="0,20,0,0">
-                <cus:CustomIconToggleBtn x:Name="BtnSolidLine" Tag="Solid" Width="110" Height="32" Click="BtnLineStyle_Click"
-                                         Command="{Binding LineStyleCommand}" CommandParameter="{Binding ElementName=BtnSolidLine,Path=Tag}"
-                                              Style="{StaticResource ToggleBtnViewModeStyle}">
-                    <Border BorderBrush="Black" BorderThickness="1" Padding="8,0,8,0" Width="108" Height="30">
-                        <Line X1="10" Y1="15" X2="260" Y2="15" Stroke="Black" StrokeThickness="2" />
+            <StackPanel
+                x:Name="PnlLineStyle"
+                Margin="0,20,0,0"
+                Orientation="Horizontal">
+                <cus:CustomIconToggleBtn
+                    x:Name="BtnSolidLine"
+                    Width="110"
+                    Height="32"
+                    Click="BtnLineStyle_Click"
+                    Command="{Binding LineStyleCommand}"
+                    CommandParameter="{Binding ElementName=BtnSolidLine, Path=Tag}"
+                    Style="{StaticResource ToggleBtnViewModeStyle}"
+                    Tag="Solid">
+                    <Border
+                        Width="108"
+                        Height="30"
+                        Padding="8,0,8,0"
+                        BorderBrush="Black"
+                        BorderThickness="1">
+                        <Line
+                            Stroke="Black"
+                            StrokeThickness="2"
+                            X1="10"
+                            X2="260"
+                            Y1="15"
+                            Y2="15" />
                     </Border>
                 </cus:CustomIconToggleBtn>
-                <cus:CustomIconToggleBtn x:Name="BtnDottedLine" Tag="Dotted" Width="110" Height="32"
-                                         Command="{Binding LineStyleCommand}" CommandParameter="{Binding ElementName=BtnDottedLine,Path=Tag}"
-                                              Style="{StaticResource ToggleBtnViewModeStyle}" Click="BtnLineStyle_Click">
-                    <Border BorderBrush="Black" BorderThickness="1" Padding="8,0,8,0" Width="108" Height="30" >
-                        <Line X1="10" Y1="15" X2="260" Y2="15" Stroke="Black" StrokeThickness="2" StrokeDashArray="2"/>
+                <cus:CustomIconToggleBtn
+                    x:Name="BtnDottedLine"
+                    Width="110"
+                    Height="32"
+                    Click="BtnLineStyle_Click"
+                    Command="{Binding LineStyleCommand}"
+                    CommandParameter="{Binding ElementName=BtnDottedLine, Path=Tag}"
+                    Style="{StaticResource ToggleBtnViewModeStyle}"
+                    Tag="Dotted">
+                    <Border
+                        Width="108"
+                        Height="30"
+                        Padding="8,0,8,0"
+                        BorderBrush="Black"
+                        BorderThickness="1">
+                        <Line
+                            Stroke="Black"
+                            StrokeDashArray="2"
+                            StrokeThickness="2"
+                            X1="10"
+                            X2="260"
+                            Y1="15"
+                            Y2="15" />
                     </Border>
                 </cus:CustomIconToggleBtn>
             </StackPanel>

+ 14 - 2
PDF Office/Views/PropertyPanel/AnnotPanel/StampAnnotProperty.xaml

@@ -53,7 +53,6 @@
                                     <ContextMenu>
                                         <MenuItem Header="导出图章">
                                             <MenuItem x:Name="SavePNG" Header="PNG" Tag="PNG" Click="Save_Click"/>
-                                            <MenuItem x:Name="SaveJPG" Header="JPG" Tag="JPG" Click="Save_Click"/>
                                             <MenuItem x:Name="SavePDF" Header="PDF" Tag="PDF" Click="Save_Click"/>
                                         </MenuItem>
                                     </ContextMenu>
@@ -113,7 +112,20 @@
                              >
                     <ListBox.ItemTemplate>
                         <HierarchicalDataTemplate  DataType="{x:Type model:Stamp}" >
-                            <Image Source="{Binding SourcePath}"/>
+                            <Grid>
+                                <Grid.ContextMenu>
+                                    <ContextMenu>
+                                        <MenuItem x:Name="Delete" Header="删除图章" Click="Delete_Click"/>
+                                        <MenuItem x:Name="DeleteAll" Header="删除全部图章" Click="DeleteAll_Click"/>
+                                        <MenuItem Header="导出图章">
+                                            <MenuItem x:Name="SavePNG" Header="PNG" Tag="PNG" Click="Save_Click"/>
+                                            <MenuItem x:Name="SavePDF" Header="PDF" Tag="PDF" Click="Save_Click"/>
+                                        </MenuItem>
+                                        <MenuItem Header="编辑文字图章" Click="Editor_Click"/>
+                                    </ContextMenu>
+                                </Grid.ContextMenu>
+                                <Image Source="{Binding SourcePath}"/>
+                            </Grid>
                         </HierarchicalDataTemplate>
                     </ListBox.ItemTemplate>
 

+ 17 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/StampAnnotProperty.xaml.cs

@@ -42,5 +42,22 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             MenuItem item = sender as MenuItem;
             (DataContext as StampAnnotPropertyViewModel).SaveToPath(item.Tag.ToString(), item.DataContext as Stamp);
         }
+
+        private void Delete_Click(object sender, RoutedEventArgs e)
+        {
+            MenuItem item = sender as MenuItem;
+            (DataContext as StampAnnotPropertyViewModel).DeleteStamp(item.DataContext as Stamp);
+        }
+
+        private void DeleteAll_Click(object sender, RoutedEventArgs e)
+        {
+            (DataContext as StampAnnotPropertyViewModel).DeleteAll();
+        }
+
+        private void Editor_Click(object sender, RoutedEventArgs e)
+        {
+            MenuItem item = sender as MenuItem;
+            (DataContext as StampAnnotPropertyViewModel).EditorCustomStamp(item.DataContext as Stamp);
+        }
     }
 }

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

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

+ 53 - 0
PDF Office/Views/PropertyPanel/ViewModular/ReadViewContent.xaml

@@ -0,0 +1,53 @@
+<UserControl
+    x:Class="PDF_Office.Views.PropertyPanel.ViewModular.ReadViewContent"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:Viewer="clr-namespace:ComPDFKitViewer.PdfViewer;assembly=ComPDFKit.Viewer"
+    xmlns:convert="clr-namespace:PDF_Office.DataConvert"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+    xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.ViewModular"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    xmlns:viewmodels="clr-namespace:PDF_Office.ViewModels.PropertyPanel.ViewModular"
+    d:DataContext="{d:DesignInstance Type=viewmodels:ReadViewContentViewModel}"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    KeyDown="UserControl_KeyDown"
+    mc:Ignorable="d">
+    <i:Interaction.Triggers>
+        <i:EventTrigger EventName="Loaded">
+            <prism:InvokeCommandAction Command="{Binding Load}" />
+        </i:EventTrigger>
+    </i:Interaction.Triggers>
+    <Grid>
+        <ContentControl
+            x:Name="PDFViewerContent"
+            HorizontalAlignment="Stretch"
+            prism:RegionManager.RegionName="{Binding ReadRegionName}" />
+        <!--阅读模式下的页面控件-->
+        <ContentControl
+            x:Name="ReadModeContent"
+            Height="44"
+            Margin="0,0,0,5"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Bottom"
+            prism:RegionManager.RegionName="{Binding ReadModeRegionName}"
+            MouseEnter="RectangleReadMode_MouseEnter"
+            MouseLeave="ReadModeContent_MouseLeave"
+            Visibility="{Binding ReadModeContentVisibility}" />
+
+        <Rectangle
+            x:Name="RectangleReadMode"
+            Width="{Binding ActualWidth, ElementName=ReadModeContent, Mode=OneWay}"
+            Height="44"
+            Margin="0,0,0,5"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Bottom"
+            Fill="Transparent"
+            MouseEnter="RectangleReadMode_MouseEnter"
+            Visibility="{Binding RectangleReadModeVisibility}" />
+    </Grid>
+</UserControl>

+ 63 - 0
PDF Office/Views/PropertyPanel/ViewModular/ReadViewContent.xaml.cs

@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+
+namespace PDF_Office.Views.PropertyPanel.ViewModular
+{
+    /// <summary>
+    /// ReadViewContent.xaml 的交互逻辑
+    /// </summary>
+    public partial class ReadViewContent : UserControl
+    {
+        public ReadViewContent()
+        {
+            InitializeComponent();
+        }
+
+        /// <summary>
+        /// 鼠标移动到控件范围时显示控件
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void RectangleReadMode_MouseEnter(object sender, MouseEventArgs e)
+        {
+            Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(delegate
+            {
+                if (App.IsBookMode)
+                {
+                    this.ReadModeContent.Visibility = Visibility.Visible;
+                    this.RectangleReadMode.Visibility = Visibility.Collapsed;
+                }
+            }));
+        }
+
+        /// <summary>
+        /// 鼠标移开页面控件,三秒后隐藏该控件
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private async void ReadModeContent_MouseLeave(object sender, MouseEventArgs e)
+        {
+            await System.Threading.Tasks.Task.Delay(3000);
+            //Thread.Sleep(3000);
+            this.ReadModeContent.Visibility = Visibility.Collapsed;
+            this.RectangleReadMode.Visibility = Visibility.Visible;
+        }
+
+        private void UserControl_KeyDown(object sender, KeyEventArgs e)
+        {
+        }
+    }
+}

+ 3 - 3
PDF Office/Views/PropertyPanel/ViewModular/ViewModularContent.xaml.cs

@@ -41,10 +41,10 @@ namespace PDF_Office.Views.PropertyPanel.ViewModular
                 {
                     if (main.ContentMain.Content is ViewContent viewContent)
                     {
-                        viewContent.RbtnReadMode_Click(sender, e);
-
+                        //viewContent.RbtnReadMode(sender, e);
+                        ViewContentViewModel model = viewContent.DataContext as ViewContentViewModel;
+                        model.RbtnReadMode(viewContent);
                     }
-
                 }
             }
         }

+ 4 - 34
PDF Office/Views/ViewContent.xaml

@@ -172,11 +172,8 @@
             </TabControl>
         </Grid>
 
-        <!--底部工具栏-->
-        <ContentControl
-            Grid.Row="3"
-            prism:RegionManager.RegionName="{Binding BottomToolRegionName}"
-            Visibility="{Binding IsReadMode}" />
+        <!--  底部工具栏  -->
+        <ContentControl Grid.Row="3" prism:RegionManager.RegionName="{Binding BottomToolRegionName}" />
 
         <!--  专门用来显示菜单二级工具栏  -->
         <!--  调整工具栏的显示图层,方便阅读模式处理  -->
@@ -226,7 +223,7 @@
                 </ColumnDefinition>
             </Grid.ColumnDefinitions>
 
-            <ContentControl prism:RegionManager.RegionName="{Binding BOTARegionName}" Visibility="{Binding IsReadMode}" />
+            <ContentControl prism:RegionManager.RegionName="{Binding BOTARegionName}" />
             <GridSplitter
                 Grid.Column="1"
                 Width="12"
@@ -239,34 +236,8 @@
                 HorizontalAlignment="Stretch"
                 prism:RegionManager.RegionName="{Binding ViwerRegionName}" />
             <ScrollViewer Grid.Column="4" VerticalScrollBarVisibility="Auto">
-                <ContentControl prism:RegionManager.RegionName="{Binding PropertyRegionName}" Visibility="{Binding IsReadMode}" />
+                <ContentControl prism:RegionManager.RegionName="{Binding PropertyRegionName}" />
             </ScrollViewer>
-            <!--  阅读模式下的页面控件  -->
-            <ContentControl
-                x:Name="ReadModeContent"
-                Grid.Column="0"
-                Grid.ColumnSpan="5"
-                Height="44"
-                Margin="0,0,0,5"
-                HorizontalAlignment="Center"
-                VerticalAlignment="Bottom"
-                prism:RegionManager.RegionName="{Binding ReadModeRegionName}"
-                MouseEnter="RectangleReadMode_MouseEnter"
-                MouseLeave="ReadModeContent_MouseLeave"
-                Visibility="Collapsed" />
-
-            <Rectangle
-                x:Name="RectangleReadMode"
-                Grid.Column="0"
-                Grid.ColumnSpan="5"
-                Width="{Binding ActualWidth, ElementName=ReadModeContent, Mode=OneWay}"
-                Height="44"
-                Margin="0,0,0,5"
-                HorizontalAlignment="Center"
-                VerticalAlignment="Bottom"
-                Fill="Transparent"
-                MouseEnter="RectangleReadMode_MouseEnter"
-                Visibility="Collapsed" />
         </Grid>
 
         <!--  用于显示页面编辑、水印、背景、标记密文等功能的区域  -->
@@ -277,6 +248,5 @@
             prism:RegionManager.RegionName="{Binding ToolContentRegionName}"
             Visibility="{Binding ToolContentVisible}" />
         <cus:LoadingControl Grid.RowSpan="3" Visibility="{Binding IsLoading}" />
-
     </Grid>
 </UserControl>

+ 7 - 93
PDF Office/Views/ViewContent.xaml.cs

@@ -1,8 +1,12 @@
 using ComPDFKitViewer;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
 using PDF_Office.ViewModels;
 using PDF_Office.Views.PropertyPanel.ViewModular;
+using Prism.Regions;
 using System;
 using System.Threading;
+using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
@@ -24,67 +28,6 @@ namespace PDF_Office.Views
             viewModel = (ViewContentViewModel)this.DataContext;
         }
 
-        /// <summary>
-        /// 阅读模式
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        public void RbtnReadMode_Click(object sender, RoutedEventArgs e)
-        {
-            if (viewModel != null)
-            {
-                App.IsBookMode = true;
-                SetReadMode(true);
-            }
-        }
-
-        /// <summary>
-        /// 设置阅读模式下的控件
-        /// </summary>
-        /// <param name="isBookMode"></param>
-        private void SetReadMode(bool isBookMode)
-        {
-            if (isBookMode)
-            {
-                viewModel.IsReadMode = Visibility.Collapsed;
-                viewModel.IsPropertyOpen = false;
-                //viewModel.ToolContentVisible = Visibility.Collapsed;
-                //viewModel.ToolsBarContentVisible = Visibility.Collapsed;
-                //viewModel.ConverterBarContentVisible = Visibility.Collapsed;
-                this.ReadModeContent.Visibility = Visibility.Visible;
-                this.RectangleReadMode.Visibility = Visibility.Collapsed;
-                Grid.SetColumn(this.PDFViewerContent, 0);
-                Grid.SetColumnSpan(this.PDFViewerContent, 4);
-                Grid.SetRow(this.DocumentView, 0);
-                Grid.SetRowSpan(this.DocumentView, 4);
-            }
-            else
-            {
-                viewModel.IsReadMode = Visibility.Visible;
-                viewModel.IsPropertyOpen = true;
-                //if (viewModel.CurrentBar == "TabItemConvert")
-                //{
-                //    viewModel.ConverterBarContentVisible = Visibility.Visible;
-                //}
-                //else if (viewModel.CurrentBar == "TabItemPageEdit")
-                //{
-                //    viewModel.ToolContentVisible = Visibility.Visible;
-                //}
-                //else
-                //{
-                //    viewModel.ToolsBarContentVisible = Visibility.Visible;
-                //}
-                //viewModel.ToolContentVisible = Visibility.Visible;
-
-                this.ReadModeContent.Visibility = Visibility.Collapsed;
-                this.RectangleReadMode.Visibility = Visibility.Visible;
-                Grid.SetColumn(this.PDFViewerContent, 2);
-                Grid.SetColumnSpan(this.PDFViewerContent, 1);
-                Grid.SetRow(this.DocumentView, 2);
-                Grid.SetRowSpan(this.DocumentView, 1);
-            }
-        }
-
         /// <summary>
         /// 退出阅读模式
         /// </summary>
@@ -96,40 +39,11 @@ namespace PDF_Office.Views
             {
                 if (viewModel != null)
                 {
-                    App.IsBookMode = false;
-                    SetReadMode(false);
+                    //App.IsBookMode = false;
+                    //SetReadMode(false);
+                    viewModel.UnReadModel();
                 }
             }
         }
-
-        /// <summary>
-        /// 鼠标移开页面控件,三秒后隐藏该控件
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private async void ReadModeContent_MouseLeave(object sender, RoutedEventArgs e)
-        {
-            await System.Threading.Tasks.Task.Delay(3000);
-            //Thread.Sleep(3000);
-            this.ReadModeContent.Visibility = Visibility.Collapsed;
-            this.RectangleReadMode.Visibility = Visibility.Visible;
-        }
-
-        /// <summary>
-        /// 鼠标移动到控件范围时显示控件
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void RectangleReadMode_MouseEnter(object sender, MouseEventArgs e)
-        {
-            Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(delegate
-            {
-                if (App.IsBookMode)
-                {
-                    this.ReadModeContent.Visibility = Visibility.Visible;
-                    this.RectangleReadMode.Visibility = Visibility.Collapsed;
-                }
-            }));
-        }
     }
 }

+ 2 - 0
PDFSettings/CustomStampList.cs

@@ -27,5 +27,7 @@ namespace PDFSettings
         public TextStampSharp TextSharp;
         public TextStampColor TextColor;
         public string ImageType;
+        public bool IsCheckedDate;
+        public bool IsCheckedTime;
     }
 }