فهرست منبع

compdfkit(win) - 完善注释项目

weixiangjie 1 سال پیش
والد
کامیت
1698ca06fd

+ 1 - 1
Demo/Examples/Annotations/MainWindow.xaml

@@ -121,7 +121,7 @@
 
                 <ComboBox Name="ModeComboBox" Style="{StaticResource ComboBoxStyle1}" Width="120" Height="26" Grid.Column="1" HorizontalAlignment="Center" FontSize="14" Foreground="#001A4E" SelectionChanged="ComboBox_SelectionChanged">
                     <ComboBoxItem IsSelected="True" Tag="Viewer">Viewer</ComboBoxItem>
-                    <ComboBoxItem IsSelected="True" Tag="Annotation">Annotation</ComboBoxItem>
+                    <ComboBoxItem  Tag="Annotation">Annotation</ComboBoxItem>
                 </ComboBox>
 
                 <StackPanel Orientation="Horizontal" Grid.Column="2">

+ 112 - 70
Demo/Examples/Annotations/MainWindow.xaml.cs

@@ -18,6 +18,8 @@ using System.Windows.Controls;
 using System.Windows.Controls.Primitives;
 using System.Windows.Input;
 using System.Windows.Media.Imaging;
+using Compdfkit_Tools.PDFView;
+
 namespace AnnotationViewControl
 {
     /// <summary>
@@ -25,10 +27,14 @@ namespace AnnotationViewControl
     /// </summary>
     public partial class MainWindow: Window, INotifyPropertyChanged
     {
+        private string currentMode = "Annotation";
+        private CPDFDisplaySettingsControl displaySettingsControl = new CPDFDisplaySettingsControl();
+        private RegularViewerControl regularViewerControl = new RegularViewerControl();
         private PDFViewControl pdfViewer;
         private PDFViewControl passwordViewer;
         private AnnotationControl annotationControl = new AnnotationControl();
         private CPDFBOTABarControl botaBarControl = new CPDFBOTABarControl(BOTATools.Thumbnail | BOTATools.Outline | BOTATools.Bookmark | BOTATools.Search | BOTATools.Annotation);
+        private PanelState panelState = PanelState.GetInstance();
         
         private bool _canSave = false;
         public bool CanSave
@@ -42,6 +48,42 @@ namespace AnnotationViewControl
             }
         }
         
+        public bool LeftToolPanelButtonIsChecked
+        {
+            get => panelState.IsLeftPanelExpand;
+            set
+            {
+                panelState.IsLeftPanelExpand = value;
+                OnPropertyChanged();
+            }
+        }
+
+        public bool RightToolPanelButtonIsChecked
+        {
+            get
+            {
+                return (panelState.RightPanel == PanelState.RightPanelState.PropertyPanel);
+            }
+            set
+            {
+                panelState.RightPanel = (value) ? PanelState.RightPanelState.PropertyPanel : PanelState.RightPanelState.None;
+                OnPropertyChanged();
+            }
+        }
+
+        public bool ViewSettingBtnIsChecked
+        {
+            get
+            {
+                return (panelState.RightPanel == PanelState.RightPanelState.ViewSettings);
+            }
+            set
+            {
+                panelState.RightPanel = (value) ? PanelState.RightPanelState.ViewSettings : PanelState.RightPanelState.None;
+                OnPropertyChanged();
+            }
+        }
+        
         public MainWindow()
         {
             InitializeComponent();
@@ -66,7 +108,7 @@ namespace AnnotationViewControl
             pdfViewer.PDFView.InfoChanged += PdfViewer_InfoChanged;
             PDFGrid.Child = annotationControl;
             
-            annotationControl.PdfViewControl = pdfViewer;
+            annotationControl.PDFViewControl = pdfViewer;
             annotationControl.InitWithPDFViewer(pdfViewer.PDFView);
             InitialPDFViewControl();
 
@@ -75,23 +117,23 @@ namespace AnnotationViewControl
             annotationControl.OnAnnotEditHandler -= PdfAnnotationControl_RefreshAnnotList;
             annotationControl.OnAnnotEditHandler += PdfAnnotationControl_RefreshAnnotList;
             
-            annotationControl.PdfViewControl.PDFView.SetFormFieldHighlight(true);
+            annotationControl.PDFViewControl.PDFView.SetFormFieldHighlight(true);
             PasswordUI.Closed -= PasswordUI_Closed;
             PasswordUI.Canceled -= PasswordUI_Canceled;
             PasswordUI.Confirmed -= PasswordUI_Confirmed;
             PasswordUI.Closed += PasswordUI_Closed;
             PasswordUI.Canceled += PasswordUI_Canceled;
             PasswordUI.Confirmed += PasswordUI_Confirmed;
-
-            annotationControl.PdfViewControl.PDFView.ChangeFitMode(FitMode.FitWidth);
-            CPDFSaclingControl.InitWithPDFViewer(annotationControl.PdfViewControl.PDFView);
-            CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(annotationControl.PdfViewControl.PDFView.ZoomFactor * 100)));
+            ModeComboBox.SelectedIndex = 1;
+            annotationControl.PDFViewControl.PDFView.ChangeFitMode(FitMode.FitWidth);
+            CPDFSaclingControl.InitWithPDFViewer(annotationControl.PDFViewControl.PDFView);
+            CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(annotationControl.PDFViewControl.PDFView.ZoomFactor * 100)));
 
             ViewSettingBtn.IsChecked = false;
-            botaBarControl.InitWithPDFViewer(annotationControl.PdfViewControl.PDFView);
+            botaBarControl.InitWithPDFViewer(annotationControl.PDFViewControl.PDFView);
             botaBarControl.SelectBotaTool(BOTATools.Thumbnail);
             annotationControl.SetBOTAContainer(botaBarControl);
-            annotationControl.InitialPDFViewControl(annotationControl.PdfViewControl);
+            annotationControl.InitialPDFViewControl(annotationControl.PDFViewControl);
         }
 
         private void PdfAnnotationControl_RefreshAnnotList(object sender, EventArgs e)
@@ -151,6 +193,18 @@ namespace AnnotationViewControl
             pdfViewer = new PDFViewControl();
             LoadDefaultDocument();
         }
+        
+        private void LoadCustomControl()
+        {
+            regularViewerControl.PdfViewControl = pdfViewer;
+            regularViewerControl.InitWithPDFViewer(pdfViewer.PDFView);
+            regularViewerControl.PdfViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
+            regularViewerControl.SetBOTAContainer(null);
+            regularViewerControl.SetBOTAContainer(botaBarControl);
+            regularViewerControl.SetDisplaySettingsControl(displaySettingsControl);
+            PDFGrid.Child = regularViewerControl;
+
+        }
         #endregion
         
         #region Annotation
@@ -186,7 +240,7 @@ namespace AnnotationViewControl
         private void OpenFile()
         {
             string filePath = CommonHelper.GetExistedPathOrEmpty();
-            if (!string.IsNullOrEmpty(filePath) && annotationControl.PdfViewControl != null)
+            if (!string.IsNullOrEmpty(filePath) && annotationControl.PDFViewControl != null)
             {
                 if (pdfViewer.PDFView != null && pdfViewer.PDFView.Document != null)
                 {
@@ -227,37 +281,63 @@ namespace AnnotationViewControl
 
         private void LeftToolPanelButton_Click(object sender, RoutedEventArgs e)
         {
-            ToggleButton expandBtn = sender as ToggleButton;
-            if (expandBtn != null)
-            {
-                bool isExpand = expandBtn.IsChecked == true;
-                annotationControl.ExpandLeftPanel(isExpand);
-            }
+            panelState.IsLeftPanelExpand = (sender as ToggleButton).IsChecked == true;
         }
 
         private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             var item = (sender as ComboBox).SelectedItem as ComboBoxItem;
-            if ((string)item.Content == "Viewer")
+            if (item.Content as string == currentMode)
             {
-                annotationControl.ClearAllToolState();
-                annotationControl.SetToolBarContainerVisibility(Visibility.Collapsed);
-                annotationControl.ExpandRightPropertyPanel(null, Visibility.Collapsed);
-                annotationControl.PDFAnnotationControl.AnnotationCancel();
+                return;
+            }
+            LeftToolPanelButtonIsChecked = false;
+            LeftToolPanelButton.IsChecked = false;
+            ViewSettingBtnIsChecked = false;
+            if(ViewSettingBtn != null)
+                ViewSettingBtn.IsChecked = false;
+            if(RightPanelButton != null)
                 RightPanelButton.IsChecked = false;
-                if (annotationControl.PdfViewControl != null && annotationControl.PdfViewControl.PDFView != null)
+            RightToolPanelButtonIsChecked = false;
+            
+            if (currentMode == "Viewer")
+            {
+                regularViewerControl.ClearViewerControl();
+                regularViewerControl.IsActive = false;
+            }
+            else if (currentMode == "Annotation")
+            {
+                annotationControl.ClearViewerControl();
+                annotationControl.IsActive = false;
+            }
+
+            if (item.Content as string == "Viewer")
+            {
+                regularViewerControl.IsActive = true;
+                if (regularViewerControl.PdfViewControl != null && regularViewerControl.PdfViewControl.PDFView != null)
                 {
-                    annotationControl.PdfViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
+                    PDFGrid.Child = regularViewerControl;
+                    regularViewerControl.PdfViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
+                    regularViewerControl.PdfViewControl = pdfViewer;
+                    regularViewerControl.InitWithPDFViewer(pdfViewer.PDFView);
+                    regularViewerControl.SetBOTAContainer(botaBarControl);
+                    regularViewerControl.SetDisplaySettingsControl(displaySettingsControl);
                 }
             }
-            else if ((string)item.Content == "Annotation")
+            else if (item.Content as string == "Annotation")
             {
-                annotationControl.SetToolBarContainerVisibility(Visibility.Visible);
-                if (annotationControl.PdfViewControl != null && annotationControl.PdfViewControl.PDFView != null)
+                annotationControl.IsActive = true;
+                if (annotationControl.PDFViewControl != null && annotationControl.PDFViewControl.PDFView != null)
                 {
-                    annotationControl.PdfViewControl.PDFView.SetMouseMode(MouseModes.PanTool);
+                    PDFGrid.Child = annotationControl;
+                    annotationControl.PDFViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
+                    annotationControl.PDFViewControl = pdfViewer;
+                    annotationControl.InitWithPDFViewer(pdfViewer.PDFView);
+                    annotationControl.SetBOTAContainer(botaBarControl);
+                    annotationControl.SetDisplaySettingsControl(displaySettingsControl);
                 }
             }
+            currentMode = item.Content as string;
         }
 
         private void PageInfoBtn_Click(object sender, RoutedEventArgs e)
@@ -270,32 +350,16 @@ namespace AnnotationViewControl
 
         private void ViewSettingBtn_Click(object sender, RoutedEventArgs e)
         {
-            ShowViewSettings();
+            panelState.RightPanel =
+                ((sender as ToggleButton).IsChecked == true) ?
+                    PanelState.RightPanelState.ViewSettings : PanelState.RightPanelState.None;
         }
 
-        private void ShowViewSettings()
-        {
-            if (ViewSettingBtn != null)
-            {
-                if (ViewSettingBtn.IsChecked == true)
-                {
-                    CPDFDisplaySettingsControl displayPanel = new CPDFDisplaySettingsControl();
-                    displayPanel.InitWithPDFViewer(annotationControl.PdfViewControl.PDFView);
-                    annotationControl.SetViewSettings(Visibility.Visible, displayPanel); 
-                    if ((bool)RightPanelButton.IsChecked)
-                    {
-                        RightPanelButton.IsChecked = false;
-                    }
-                }
-                else
-                {
-                    annotationControl.SetViewSettings(Visibility.Collapsed); 
-                }
-            }
-        }
         private void RightPanelButton_Click(object sender, RoutedEventArgs e)
         {
-            ControlRightPanel();
+            panelState.RightPanel =
+                ((sender as ToggleButton).IsChecked == true) ?
+                    PanelState.RightPanelState.PropertyPanel : PanelState.RightPanelState.None;
         }
 
         private void ExpandSearchBtn_Click(object sender, RoutedEventArgs e)
@@ -303,28 +367,6 @@ namespace AnnotationViewControl
             annotationControl.ExpandLeftPanel(true);
             botaBarControl.SelectBotaTool(BOTATools.Search);
         }
-        
-        private void ControlRightPanel()
-        { 
-            if (RightPanelButton != null)
-            {
-                if (RightPanelButton.IsChecked == true)
-                {
-                    if (annotationControl.PDFAnnotationControl != null)
-                    {
-                        annotationControl.ExpandRightPropertyPanel(annotationControl.PDFAnnotationControl, Visibility.Visible);
-                        if ((bool)ViewSettingBtn.IsChecked)
-                        {
-                            ViewSettingBtn.IsChecked = false;
-                        }
-                    }
-                }
-                else
-                {
-                    annotationControl.ExpandRightPropertyPanel(null, Visibility.Collapsed);
-                }
-            }
-        }
 
         #region Save file
         /// <summary>

+ 68 - 67
Demo/Examples/Compdfkit_Tools/Annotation/AnnotationControl/AnnotationControl.xaml.cs

@@ -23,7 +23,7 @@ namespace Compdfkit_Tools.PDFControl
     {
         #region Property
         private bool isFirstLoad = true;
-        public PDFViewControl PdfViewControl = new PDFViewControl();
+        public PDFViewControl PDFViewControl = new PDFViewControl();
         public CPDFAnnotationControl PDFAnnotationControl = null;
         private bool _isActive = false;
         public bool IsActive
@@ -50,9 +50,9 @@ namespace Compdfkit_Tools.PDFControl
         {
             get
             {
-                if (PdfViewControl != null && PdfViewControl.PDFView != null)
+                if (PDFViewControl != null && PDFViewControl.PDFView != null)
                 {
-                    return PdfViewControl.PDFView.UndoManager.CanUndo;
+                    return PDFViewControl.PDFView.UndoManager.CanUndo;
                 }
                 return false;
             }
@@ -62,9 +62,9 @@ namespace Compdfkit_Tools.PDFControl
         {
             get
             {
-                if (PdfViewControl != null && PdfViewControl.PDFView != null)
+                if (PDFViewControl != null && PDFViewControl.PDFView != null)
                 {
-                    return PdfViewControl.PDFView.UndoManager.CanRedo;
+                    return PDFViewControl.PDFView.UndoManager.CanRedo;
                 }
 
                 return false;
@@ -75,9 +75,9 @@ namespace Compdfkit_Tools.PDFControl
         {
             get
             {
-                if (PdfViewControl != null && PdfViewControl.PDFView != null)
+                if (PDFViewControl != null && PDFViewControl.PDFView != null)
                 {
-                    return PdfViewControl.PDFView.UndoManager.CanSave;
+                    return PDFViewControl.PDFView.UndoManager.CanSave;
                 }
 
                 return false;
@@ -104,6 +104,7 @@ namespace Compdfkit_Tools.PDFControl
                     CPDFAnnotationType.Audio
             };
             AnnotationBarControl.InitAnnotationBar(annotationProperties);
+            panelState.PropertyChanged -= PanelState_PropertyChanged;
             panelState.PropertyChanged += PanelState_PropertyChanged;
         }
 
@@ -133,8 +134,8 @@ namespace Compdfkit_Tools.PDFControl
         #region Init PDFViewer
         public void InitWithPDFViewer(CPDFViewer pdfViewer)
         {
-            PdfViewControl.PDFView = pdfViewer;
-            PDFGrid.Child = PdfViewControl;
+            PDFViewControl.PDFView = pdfViewer;
+            PDFGrid.Child = PDFViewControl;
             FloatPageTool.InitWithPDFViewer(pdfViewer);
         }
 
@@ -163,13 +164,13 @@ namespace Compdfkit_Tools.PDFControl
 
         private void UserControl_Loaded(object sender, RoutedEventArgs e)
         {
-            InitialPDFViewControl(PdfViewControl);
-            PdfViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
+            InitialPDFViewControl(PDFViewControl);
+            PDFViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
         }
 
         private void UserControl_Unloaded(object sender, RoutedEventArgs e)
         {
-            PdfViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
+            PDFViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
         }
 
 
@@ -198,18 +199,18 @@ namespace Compdfkit_Tools.PDFControl
             ExpandRightPropertyPanel(null, Visibility.Collapsed);
             PDFAnnotationControl.ClearAnnotationBar -= PdfAnnotationControl_ClearAnnotationBar;
             PDFAnnotationControl.ClearAnnotationBar += PdfAnnotationControl_ClearAnnotationBar;
-            PdfViewControl.PDFView.AnnotEditHandler -= PDFView_AnnotEditHandler;
-            PdfViewControl.PDFView.AnnotEditHandler += PDFView_AnnotEditHandler;
-            PdfViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
-            PdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
-            PdfViewControl.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
-            PdfViewControl.PDFView.AnnotActiveHandler += PDFView_AnnotActiveHandler;
+            PDFViewControl.PDFView.AnnotEditHandler -= PDFView_AnnotEditHandler;
+            PDFViewControl.PDFView.AnnotEditHandler += PDFView_AnnotEditHandler;
+            PDFViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
+            PDFViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+            PDFViewControl.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
+            PDFViewControl.PDFView.AnnotActiveHandler += PDFView_AnnotActiveHandler;
         }
 
         public void UnloadEvent()
         {
-            PdfViewControl.PDFView.AnnotEditHandler -= PDFView_AnnotEditHandler;
-            PdfViewControl.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
+            PDFViewControl.PDFView.AnnotEditHandler -= PDFView_AnnotEditHandler;
+            PDFViewControl.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
             //panelState.PropertyChanged -= PanelState_PropertyChanged;
         }
 
@@ -294,15 +295,15 @@ namespace Compdfkit_Tools.PDFControl
                             highLightMenu.Click += (o, p) =>
                             {
                                 TextHighlightAnnotArgs highLightArgs = new TextHighlightAnnotArgs();
-                                MouseModes oldMode = PdfViewControl.PDFView.MouseMode;
+                                MouseModes oldMode = PDFViewControl.PDFView.MouseMode;
 
                                 if (PDFAnnotationControl != null)
                                 {
                                     highLightArgs.Color = System.Windows.Media.Colors.Red;
                                     highLightArgs.Transparency = 1;
-                                    PdfViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
-                                    PdfViewControl.PDFView.SetToolParam(highLightArgs);
-                                    PdfViewControl.PDFView.SetMouseMode(oldMode);
+                                    PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
+                                    PDFViewControl.PDFView.SetToolParam(highLightArgs);
+                                    PDFViewControl.PDFView.SetMouseMode(oldMode);
                                 }
 
                             };
@@ -314,15 +315,15 @@ namespace Compdfkit_Tools.PDFControl
                             underlineMenu.Click += (o, p) =>
                             {
                                 TextUnderlineAnnotArgs underlineArgs = new TextUnderlineAnnotArgs();
-                                MouseModes oldMode = PdfViewControl.PDFView.MouseMode;
+                                MouseModes oldMode = PDFViewControl.PDFView.MouseMode;
 
                                 if (PDFAnnotationControl != null)
                                 {
                                     underlineArgs.Color = System.Windows.Media.Colors.Red;
                                     underlineArgs.Transparency = 1;
-                                    PdfViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
-                                    PdfViewControl.PDFView.SetToolParam(underlineArgs);
-                                    PdfViewControl.PDFView.SetMouseMode(oldMode);
+                                    PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
+                                    PDFViewControl.PDFView.SetToolParam(underlineArgs);
+                                    PDFViewControl.PDFView.SetMouseMode(oldMode);
                                 }
                             };
 
@@ -333,15 +334,15 @@ namespace Compdfkit_Tools.PDFControl
                             strikeOutMenu.Click += (o, p) =>
                             {
                                 TextStrikeoutAnnotArgs strikeoutAnnotArgs = new TextStrikeoutAnnotArgs();
-                                MouseModes oldMode = PdfViewControl.PDFView.MouseMode;
+                                MouseModes oldMode = PDFViewControl.PDFView.MouseMode;
 
                                 if (PDFAnnotationControl != null)
                                 {
                                     strikeoutAnnotArgs.Color = System.Windows.Media.Colors.Red;
                                     strikeoutAnnotArgs.Transparency = 1;
-                                    PdfViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
-                                    PdfViewControl.PDFView.SetToolParam(strikeoutAnnotArgs);
-                                    PdfViewControl.PDFView.SetMouseMode(oldMode);
+                                    PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
+                                    PDFViewControl.PDFView.SetToolParam(strikeoutAnnotArgs);
+                                    PDFViewControl.PDFView.SetMouseMode(oldMode);
                                 }
                             };
 
@@ -352,15 +353,15 @@ namespace Compdfkit_Tools.PDFControl
                             SquiggleMenu.Click += (o, p) =>
                             {
                                 TextSquigglyAnnotArgs squigglyAnnotArgs = new TextSquigglyAnnotArgs();
-                                MouseModes oldMode = PdfViewControl.PDFView.MouseMode;
+                                MouseModes oldMode = PDFViewControl.PDFView.MouseMode;
 
                                 if (PDFAnnotationControl != null)
                                 {
                                     squigglyAnnotArgs.Color = System.Windows.Media.Colors.Red;
                                     squigglyAnnotArgs.Transparency = 1;
-                                    PdfViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
-                                    PdfViewControl.PDFView.SetToolParam(squigglyAnnotArgs);
-                                    PdfViewControl.PDFView.SetMouseMode(oldMode);
+                                    PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
+                                    PDFViewControl.PDFView.SetToolParam(squigglyAnnotArgs);
+                                    PDFViewControl.PDFView.SetMouseMode(oldMode);
                                 }
                             };
 
@@ -378,9 +379,9 @@ namespace Compdfkit_Tools.PDFControl
                             fitWidthMenu.Header = "Automatically Resize";
                             fitWidthMenu.Click += (o, p) =>
                             {
-                                if (PdfViewControl != null)
+                                if (PDFViewControl != null)
                                 {
-                                    PdfViewControl.PDFView?.ChangeFitMode(FitMode.FitWidth);
+                                    PDFViewControl.PDFView?.ChangeFitMode(FitMode.FitWidth);
                                 }
                             };
 
@@ -390,9 +391,9 @@ namespace Compdfkit_Tools.PDFControl
                             fitSizeMenu.Header = "Actual Size";
                             fitSizeMenu.Click += (o, p) =>
                             {
-                                if (PdfViewControl != null)
+                                if (PDFViewControl != null)
                                 {
-                                    PdfViewControl.PDFView?.ChangeFitMode(FitMode.FitSize);
+                                    PDFViewControl.PDFView?.ChangeFitMode(FitMode.FitSize);
                                 }
                             };
 
@@ -402,10 +403,10 @@ namespace Compdfkit_Tools.PDFControl
                             zoomInMenu.Header = "Zoom In";
                             zoomInMenu.Click += (o, p) =>
                             {
-                                if (PdfViewControl != null)
+                                if (PDFViewControl != null)
                                 {
-                                    double newZoom = CheckZoomLevel(PdfViewControl.PDFView.ZoomFactor + 0.01, true);
-                                    PdfViewControl.PDFView?.Zoom(newZoom);
+                                    double newZoom = CheckZoomLevel(PDFViewControl.PDFView.ZoomFactor + 0.01, true);
+                                    PDFViewControl.PDFView?.Zoom(newZoom);
                                 }
                             };
 
@@ -415,10 +416,10 @@ namespace Compdfkit_Tools.PDFControl
                             zoomOutMenu.Header = "Zoom Out";
                             zoomOutMenu.Click += (o, p) =>
                             {
-                                if (PdfViewControl != null)
+                                if (PDFViewControl != null)
                                 {
-                                    double newZoom = CheckZoomLevel(PdfViewControl.PDFView.ZoomFactor - 0.01, false);
-                                    PdfViewControl.PDFView?.Zoom(newZoom);
+                                    double newZoom = CheckZoomLevel(PDFViewControl.PDFView.ZoomFactor - 0.01, false);
+                                    PDFViewControl.PDFView?.Zoom(newZoom);
                                 }
                             };
 
@@ -429,9 +430,9 @@ namespace Compdfkit_Tools.PDFControl
                             singleView.Header = "Single Page";
                             singleView.Click += (o, p) =>
                             {
-                                if (PdfViewControl != null)
+                                if (PDFViewControl != null)
                                 {
-                                    PdfViewControl.PDFView?.ChangeViewMode(ViewMode.Single);
+                                    PDFViewControl.PDFView?.ChangeViewMode(ViewMode.Single);
                                 }
                             };
 
@@ -441,9 +442,9 @@ namespace Compdfkit_Tools.PDFControl
                             singleContinuousView.Header = "Single Page Continuous";
                             singleContinuousView.Click += (o, p) =>
                             {
-                                if (PdfViewControl != null)
+                                if (PDFViewControl != null)
                                 {
-                                    PdfViewControl.PDFView?.ChangeViewMode(ViewMode.SingleContinuous);
+                                    PDFViewControl.PDFView?.ChangeViewMode(ViewMode.SingleContinuous);
                                 }
                             };
 
@@ -453,9 +454,9 @@ namespace Compdfkit_Tools.PDFControl
                             doubleView.Header = "Two Pages";
                             doubleView.Click += (o, p) =>
                             {
-                                if (PdfViewControl != null)
+                                if (PDFViewControl != null)
                                 {
-                                    PdfViewControl.PDFView?.ChangeViewMode(ViewMode.Double);
+                                    PDFViewControl.PDFView?.ChangeViewMode(ViewMode.Double);
                                 }
                             };
 
@@ -465,9 +466,9 @@ namespace Compdfkit_Tools.PDFControl
                             doubleContinuousView.Header = "Two Pages Continuous";
                             doubleContinuousView.Click += (o, p) =>
                             {
-                                if (PdfViewControl != null)
+                                if (PDFViewControl != null)
                                 {
-                                    PdfViewControl.PDFView?.ChangeViewMode(ViewMode.DoubleContinuous);
+                                    PDFViewControl.PDFView?.ChangeViewMode(ViewMode.DoubleContinuous);
                                 }
                             };
 
@@ -477,9 +478,9 @@ namespace Compdfkit_Tools.PDFControl
                             resetFormMenu.Header = "Reset Forms";
                             resetFormMenu.Click += (o, p) =>
                             {
-                                if (PdfViewControl != null)
+                                if (PDFViewControl != null)
                                 {
-                                    PdfViewControl.PDFView?.ResetForm(null);
+                                    PDFViewControl.PDFView?.ResetForm(null);
                                 }
                             };
                             e.PopupMenu.Items.Add(new Separator());
@@ -490,7 +491,7 @@ namespace Compdfkit_Tools.PDFControl
 
                     else if (e.CommandTarget == TargetType.ImageSelection)
                     {
-                        if (PdfViewControl != null && PdfViewControl.PDFView != null && PdfViewControl.PDFView.GetSelectImageCount() > 0)
+                        if (PDFViewControl != null && PDFViewControl.PDFView != null && PDFViewControl.PDFView.GetSelectImageCount() > 0)
                         {
                             e.Handle = true;
                             e.PopupMenu = new ContextMenu();
@@ -528,7 +529,7 @@ namespace Compdfkit_Tools.PDFControl
         {
             try
             {
-                Dictionary<int, List<Bitmap>> imageDict = PdfViewControl.PDFView?.GetSelectedImages();
+                Dictionary<int, List<Bitmap>> imageDict = PDFViewControl.PDFView?.GetSelectedImages();
 
                 if (imageDict != null && imageDict.Count > 0)
                 {
@@ -566,7 +567,7 @@ namespace Compdfkit_Tools.PDFControl
                 string openPath = choosePath;
                 try
                 {
-                    Dictionary<int, List<Bitmap>> imageDict = PdfViewControl.PDFView?.GetSelectedImages();
+                    Dictionary<int, List<Bitmap>> imageDict = PDFViewControl.PDFView?.GetSelectedImages();
 
                     if (imageDict != null && imageDict.Count > 0)
                     {
@@ -640,17 +641,17 @@ namespace Compdfkit_Tools.PDFControl
 
         private void UndoButton_Click(object sender, RoutedEventArgs e)
         {
-            if (PdfViewControl != null && PdfViewControl.PDFView != null)
+            if (PDFViewControl != null && PDFViewControl.PDFView != null)
             {
-                PdfViewControl.PDFView.UndoManager?.Undo();
+                PDFViewControl.PDFView.UndoManager?.Undo();
             }
         }
 
         private void RedoButton_Click(object sender, RoutedEventArgs e)
         {
-            if (PdfViewControl != null && PdfViewControl.PDFView != null)
+            if (PDFViewControl != null && PDFViewControl.PDFView != null)
             {
-                PdfViewControl.PDFView.UndoManager?.Redo();
+                PDFViewControl.PDFView.UndoManager?.Redo();
             }
         }
 
@@ -705,17 +706,17 @@ namespace Compdfkit_Tools.PDFControl
 
         private void CommandBinding_Executed_Undo(object sender, ExecutedRoutedEventArgs e)
         {
-            if (PdfViewControl != null && PdfViewControl.PDFView != null && CanUndo)
+            if (PDFViewControl != null && PDFViewControl.PDFView != null && CanUndo)
             {
-                PdfViewControl.PDFView.UndoManager?.Undo();
+                PDFViewControl.PDFView.UndoManager?.Undo();
             }
         }
 
         private void CommandBinding_Executed_Redo(object sender, ExecutedRoutedEventArgs e)
         {
-            if (PdfViewControl != null && PdfViewControl.PDFView != null && CanRedo)
+            if (PDFViewControl != null && PDFViewControl.PDFView != null && CanRedo)
             {
-                PdfViewControl.PDFView.UndoManager?.Redo();
+                PDFViewControl.PDFView.UndoManager?.Redo();
             }
         }
 

+ 5 - 5
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -361,18 +361,18 @@ namespace PDFViewer
             {
                 annotationControl.IsActive = true;
                 annotationControl.SetToolBarContainerVisibility(Visibility.Visible);
-                if (annotationControl.PdfViewControl != null && annotationControl.PdfViewControl.PDFView != null)
+                if (annotationControl.PDFViewControl != null && annotationControl.PDFViewControl.PDFView != null)
                 {
                     PDFGrid.Child = annotationControl;
-                    annotationControl.PdfViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
-                    annotationControl.PdfViewControl.PDFView.SetToolParam(new AnnotHandlerEventArgs());
-                    annotationControl.PdfViewControl = pdfViewer;
+                    annotationControl.PDFViewControl.PDFView.SetMouseMode(MouseModes.AnnotCreate);
+                    annotationControl.PDFViewControl.PDFView.SetToolParam(new AnnotHandlerEventArgs());
+                    annotationControl.PDFViewControl = pdfViewer;
                     annotationControl.InitWithPDFViewer(pdfViewer.PDFView);
                     annotationControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
                     annotationControl.OnCanSaveChanged += ControlOnCanSaveChanged;
                     annotationControl.OnAnnotEditHandler -= PdfFormControlRefreshAnnotList;
                     annotationControl.OnAnnotEditHandler += PdfFormControlRefreshAnnotList;
-                    annotationControl.InitialPDFViewControl(annotationControl.PdfViewControl);
+                    annotationControl.InitialPDFViewControl(annotationControl.PDFViewControl);
                     annotationControl.SetBOTAContainer(botaBarControl);
                     annotationControl.SetDisplaySettingsControl(displaySettingsControl);
                 }