소스 검색

页面编辑-右键选中优化

OYXH\oyxh 1 년 전
부모
커밋
3e9b43e7a9
2개의 변경된 파일12개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 6
      PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs
  2. 6 0
      PDF Office/Views/PageEdit/PageEditContent.xaml.cs

+ 6 - 6
PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs

@@ -342,7 +342,7 @@ namespace PDF_Master.ViewModels.PageEdit
         public bool IsMouseRightButtonDown
         {
             get { return isMouseRightButtonDown; }
-            set { isMouseRightButtonDown = value; }
+            set { SetProperty(ref isMouseRightButtonDown, value); }
         }
 
         /// <summary>
@@ -661,11 +661,11 @@ namespace PDF_Master.ViewModels.PageEdit
 
             SplitCommand = new DelegateCommand(SplitCommandEvent);
             InsertCommand = new DelegateCommand<object>(InsertCommandEvent);
-            ReplaceCommand = new DelegateCommand(ReplaceCommandEvent, CanFileCommandExcute).ObservesProperty(() => IsMouseRightButtonDown);
-            ExtractCommand = new DelegateCommand(ExtractCommandEvent, CanFileCommandExcute).ObservesProperty(() => IsMouseRightButtonDown);
-            DeleteCommand = new DelegateCommand(DeleteCommandEvent, CanFileCommandExcute).ObservesProperty(() => IsMouseRightButtonDown);
-            LeftRotateCommand = new DelegateCommand(LeftRotateCommandEvent, CanFileCommandExcute).ObservesProperty(() => IsMouseRightButtonDown);
-            RightRotateCommand = new DelegateCommand(RightRotateCommandEvent, CanFileCommandExcute).ObservesProperty(() => IsMouseRightButtonDown);
+            ReplaceCommand = new DelegateCommand(ReplaceCommandEvent, CanFileCommandExcute).ObservesProperty(() => ListSelectedIndex);
+            ExtractCommand = new DelegateCommand(ExtractCommandEvent, CanFileCommandExcute).ObservesProperty(() => ListSelectedIndex);
+            DeleteCommand = new DelegateCommand(DeleteCommandEvent, CanFileCommandExcute).ObservesProperty(() => ListSelectedIndex);
+            LeftRotateCommand = new DelegateCommand(LeftRotateCommandEvent, CanFileCommandExcute).ObservesProperty(() => ListSelectedIndex);
+            RightRotateCommand = new DelegateCommand(RightRotateCommandEvent, CanFileCommandExcute).ObservesProperty(() => ListSelectedIndex);
             ReverseCommand = new DelegateCommand(ReverseCommandEvent, CanReverseFileCommandExcute).ObservesProperty(() => IsMultiSelected);
             ZoomInCommand = new DelegateCommand(ZoomInCommandEvent, CanZoomIn).ObservesProperty(() => ZoomIndex);
             ZoomOutCommand = new DelegateCommand(ZoomOutCommandEvent, CanZoomOut).ObservesProperty(() => ZoomIndex);

+ 6 - 0
PDF Office/Views/PageEdit/PageEditContent.xaml.cs

@@ -606,6 +606,10 @@ namespace PDF_Master.Views.PageEdit
         /// <param name="e"></param>
         private void ListPageEdit_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
+            viewModel.IsMouseRightButtonDown = false;
+            viewModel.RightSelectedIndex = -1;
+            viewModel.RightSelectedIndexs.Clear();
+
             var pos = e.GetPosition(ListPageEdit);
             HitTestResult result = VisualTreeHelper.HitTest(ListPageEdit, pos);
             if (result == null)
@@ -1109,8 +1113,10 @@ namespace PDF_Master.Views.PageEdit
                 }
                 else
                 {
+                    
                     if (viewModel.RightSelectedIndex != viewModel.ListSelectedIndex)
                     {
+                        viewModel.ListSelectedIndex = viewModel.RightSelectedIndex;
                         viewModel.ListSelectedIndex = -1;
                     }