Przeglądaj źródła

综合-修复页面编辑部分bug

ZhouJieSheng 2 lat temu
rodzic
commit
989ecd3567

+ 11 - 9
PDF Office/App.xaml

@@ -3,6 +3,7 @@
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"
+    xmlns:cus="clr-namespace:PDF_Master.CustomControl"
     xmlns:local="clr-namespace:PDF_Master"
     xmlns:prism="http://prismlibrary.com/"
     xmlns:sys="clr-namespace:System;assembly=mscorlib">
@@ -521,7 +522,7 @@
                                     <Setter TargetName="arrow" Property="Fill" Value="{StaticResource color.icon.arrow.gray.dis}" />
                                     <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource color.field.bg.dis}" />
                                     <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource color.field.border.dis}" />
-                                    
+
                                 </Trigger>
                             </ControlTemplate.Triggers>
                         </ControlTemplate>
@@ -607,7 +608,7 @@
                         <Setter TargetName="dropDownBorder" Property="Height" Value="95" />
                     </Trigger>
                     <Trigger Property="IsEnabled" Value="false">
-                        <Setter  Property="Foreground" Value="{StaticResource color.field.text.dis}"/>
+                        <Setter Property="Foreground" Value="{StaticResource color.field.text.dis}" />
                     </Trigger>
                     <MultiTrigger>
                         <MultiTrigger.Conditions>
@@ -696,15 +697,16 @@
                         Style="{StaticResource ComboBoxToggleButton}" />
                     <Border
                         x:Name="border"
-                        Margin="3 1 8 1"
+                        Margin="3,1,8,1"
                         Background="{StaticResource TextBox.Static.Background}">
-                        <TextBox
+                        <cus:TextBoxEx
                             x:Name="PART_EditableTextBox"
-                            Margin="{TemplateBinding Padding}"
-                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
-                            VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
+                            Padding="0"
+                            ShowClose="False"
+                            VerticalAlignment="Center"
                             IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
-                            Style="{StaticResource ComboBoxEditableTextBox}" />
+                            PlaceholderText="1,3-5"
+                            Style="{StaticResource InnerTextBox}" />
                     </Border>
                 </Grid>
                 <ControlTemplate.Triggers>
@@ -752,7 +754,7 @@
                 <Style.Triggers>
                     <Trigger Property="IsEditable" Value="true">
                         <Setter Property="IsTabStop" Value="false" />
-                        <Setter Property="Padding" Value="2 3 5 3"/>
+                        <Setter Property="Padding" Value="2,3,5,3" />
                         <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}" />
                     </Trigger>
                 </Style.Triggers>

+ 2 - 0
PDF Office/Helper/SettingHelper.cs

@@ -48,6 +48,8 @@ namespace PDF_Master.Helper
             else
             {
                 OpenFileInfo fileInfo = new OpenFileInfo();
+                fileInfo.LastFitMode = Settings.Default.AppProperties.InitialVIew.ZoomMode;
+                fileInfo.LastViewMode = Settings.Default.AppProperties.InitialVIew.PageView;
                 fileInfo.FileName = Path.GetFileName(filePath);
                 fileInfo.FilePath = filePath;
                 fileInfo.IsGuidPDF = string.Equals(filePath, App.GuidPDFPath);

+ 21 - 2
PDF Office/Model/SettingsDialog/AnnotateModel.cs

@@ -137,6 +137,18 @@ namespace PDF_Master.Model.SettingsDialog
             }
         }
 
+        private Color arrowColor;   
+
+        public Color ArrowColor
+        {
+            get { return arrowColor; }
+            set
+            {
+                SetProperty(ref arrowColor, value);
+            }
+        }
+
+
         private TextAlignment textAlign;
 
         public TextAlignment TextAlign
@@ -189,6 +201,7 @@ namespace PDF_Master.Model.SettingsDialog
             this.CircleBorderColor = annote.CircleBorderColor;
             this.CircleFillColor = annote.CircleFillColor;
             this.LineColor = annote.LineColor;
+            this.ArrowColor = annote.ArrowColor;
             this.TextFontFamaily = annote.TextFontFamaily;
             this.AnchoredFamaily = annote.AnchoredFamaily;
             this.TextAlign = annote.TextAlign;
@@ -228,6 +241,10 @@ namespace PDF_Master.Model.SettingsDialog
             var AnnotLineAnnot = GetAnnotDefault(AnnotArgsType.AnnotLine);
             AnnotLineAnnot.BorderColor = this.LineColor;
             SetDefautAnnotProperties(AnnotLineAnnot);
+
+            var ArrowAnnot = GetAnnotDefault(AnnotArgsType.AnnotLine,"Arrow");
+            AnnotLineAnnot.BorderColor = this.LineColor;
+            SetDefautAnnotProperties(AnnotLineAnnot);
             Settings.Default.Save();
         }
 
@@ -240,9 +257,9 @@ namespace PDF_Master.Model.SettingsDialog
             Settings.Default.DefautAnnotProperties.SetAnnotProperty(annotProperty);
         }
 
-        private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType)
+        private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType,string saveKey="")
         {
-            var Annot = SettingHelper.GetAnnotDefaultProperty(annotArgsType);
+            var Annot = SettingHelper.GetAnnotDefaultProperty(annotArgsType,saveKey);
             if (Annot == null)
             {
                 Annot = new DefaultAnnotProperty();
@@ -264,6 +281,7 @@ namespace PDF_Master.Model.SettingsDialog
             annote.CircleBorderColor = this.CircleBorderColor;
             annote.CircleFillColor = this.CircleFillColor;
             annote.LineColor = this.LineColor;
+            annote.ArrowColor = this.ArrowColor;
             annote.TextFontFamaily = this.TextFontFamaily;
             annote.AnchoredFamaily = this.AnchoredFamaily;
             annote.TextAlign = this.TextAlign;
@@ -290,6 +308,7 @@ namespace PDF_Master.Model.SettingsDialog
             this.CircleBorderColor = annote.CircleBorderColor;
             this.CircleFillColor = annote.CircleFillColor;
             this.LineColor = annote.LineColor;
+            this.ArrowColor = annote.ArrowColor;
             this.TextFontFamaily = annote.TextFontFamaily;
             this.AnchoredFamaily = annote.AnchoredFamaily;
             this.TextAlign = annote.TextAlign;

+ 146 - 8
PDF Office/Styles/TextBoxStyle.xaml

@@ -1,4 +1,7 @@
-<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+<ResourceDictionary
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Master.CustomControl">
 
     <Style x:Key="PagesView_txtContext" TargetType="{x:Type TextBlock}">
         <Setter Property="FontFamily" Value="Segoe UI" />
@@ -78,21 +81,156 @@
         </Style.Triggers>
     </Style>
 
+    <!--  没有颜色变化的文本框  -->
+    <Style x:Key="InnerTextBox" TargetType="{x:Type cus:TextBoxEx}">
+        <Setter Property="Background" Value="{StaticResource color.field.bg.def}" />
+        <Setter Property="BorderBrush" Value="{StaticResource color.field.border.norm}" />
+        <Setter Property="Foreground" Value="Black" />
+        <Setter Property="VerticalContentAlignment" Value="Center" />
+        <Setter Property="HorizontalContentAlignment" Value="Left" />
+        <Setter Property="BorderThickness" Value="0" />
+        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
+        <Setter Property="Height" Value="32" />
+        <Setter Property="Padding" Value="3,0" />
+        <Setter Property="CornerRadius" Value="4" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type cus:TextBoxEx}">
+                    <Border
+                        x:Name="border"
+                        Width="{TemplateBinding Width}"
+                        Height="{TemplateBinding Height}"
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="{TemplateBinding BorderBrush}"
+                        BorderThickness="{TemplateBinding BorderThickness}"
+                        CornerRadius="{TemplateBinding CornerRadius}"
+                        SnapsToDevicePixels="True">
+                        <Grid Margin="{TemplateBinding Padding}">
+                            <TextBlock
+                                x:Name="placeholder"
+                                Padding="{TemplateBinding Padding}"
+                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                                FontSize="{TemplateBinding FontSize}"
+                                Foreground="{TemplateBinding PlaceholderForeground}"
+                                Text="{TemplateBinding PlaceholderText}"
+                                Visibility="Collapsed" />
+                            <Grid VerticalAlignment="Center">
+                                <Grid.ColumnDefinitions>
+                                    <ColumnDefinition Width="*" />
+                                    <ColumnDefinition Width="auto" />
+                                </Grid.ColumnDefinitions>
+                                <ScrollViewer
+                                    x:Name="PART_ContentHost"
+                                    Margin="0"
+                                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
+                                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
+                                    Focusable="false"
+                                    Foreground="{TemplateBinding Foreground}"
+                                    HorizontalScrollBarVisibility="Hidden"
+                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
+                                    Style="{x:Null}"
+                                    VerticalScrollBarVisibility="Hidden" />
+                                <Button
+                                    Name="PART_BtnClear"
+                                    Grid.Column="1"
+                                    Width="16"
+                                    Height="16"
+                                    Margin="9,0"
+                                    HorizontalAlignment="Right"
+                                    VerticalAlignment="Center"
+                                    Background="Transparent"
+                                    BorderThickness="0"
+                                    Style="{StaticResource NoColorBtn}"
+                                    Visibility="Collapsed">
+                                    <Path
+                                        Data="M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM11.5303 5.53038L9.06069 8L11.5303 10.4696L10.4697 11.5303L8.00002 9.06066L5.53033 11.5303L4.46967 10.4697L6.93936 8L4.46967 5.53033L5.53033 4.46967L8.00002 6.93934L10.4697 4.46971L11.5303 5.53038Z"
+                                        Fill="#CED0D4"
+                                        Stretch="Uniform" />
+                                </Button>
+                            </Grid>
+                        </Grid>
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsEnabled" Value="false">
+                            <Setter TargetName="border" Property="Opacity" Value="0.56" />
+                        </Trigger>
+                        <Trigger Property="Text" Value="{x:Null}">
+                            <Setter TargetName="placeholder" Property="Visibility" Value="Visible" />
+                        </Trigger>
+                        <Trigger Property="IsMouseOver" Value="True">
+                            <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Visible" />
+                        </Trigger>
+                        <Trigger Property="IsFocused" Value="True">
+                            <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Visible" />
+                        </Trigger>
+                        <MultiTrigger>
+                            <MultiTrigger.Conditions>
+                                <Condition Property="IsFocused" Value="True" />
+                                <Condition Property="IsError" Value="True" />
+                            </MultiTrigger.Conditions>
+                            <MultiTrigger.Setters>
+                                <Setter TargetName="border" Property="Effect" Value="{StaticResource shadow.error.s}" />
+                            </MultiTrigger.Setters>
+                        </MultiTrigger>
+                        <Trigger Property="IsError" Value="True">
+                            <Setter Property="BorderBrush" Value="{StaticResource color.sys.border.error}" />
+                        </Trigger>
+                        <Trigger Property="Text" Value="">
+                            <Setter TargetName="placeholder" Property="Visibility" Value="Visible" />
+                            <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
+                        </Trigger>
+                        <Trigger Property="ShowClose" Value="False">
+                            <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
+                        </Trigger>
+                        <MultiTrigger>
+                            <MultiTrigger.Conditions>
+                                <Condition Property="Text" Value="" />
+                                <Condition Property="IsMouseOver" Value="True" />
+                            </MultiTrigger.Conditions>
+                            <MultiTrigger.Setters>
+                                <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
+                            </MultiTrigger.Setters>
+                        </MultiTrigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+        <Style.Triggers>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
+                    <Condition Property="IsSelectionActive" Value="false" />
+                </MultiTrigger.Conditions>
+                <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
+            </MultiTrigger>
+        </Style.Triggers>
+    </Style>
+
     <Style x:Key="Print_normalTxtStyle" TargetType="TextBox">
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate>
-                    <Grid Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
-                        <Border BorderBrush="{StaticResource color.field.border.norm}" Background="{StaticResource color.field.bg.def}" BorderThickness="1" CornerRadius="4">
-                            <ScrollViewer x:Name="PART_ContentHost" Focusable="false"
-                                          HorizontalScrollBarVisibility="Hidden"
-                                          VerticalScrollBarVisibility="Hidden"
-                                          VerticalAlignment="Center" MinHeight="22" Margin="8,0,0,0" Opacity="1" />
+                    <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
+                        <Border
+                            Background="{StaticResource color.field.bg.def}"
+                            BorderBrush="{StaticResource color.field.border.norm}"
+                            BorderThickness="1"
+                            CornerRadius="4">
+                            <ScrollViewer
+                                x:Name="PART_ContentHost"
+                                MinHeight="22"
+                                Margin="8,0,0,0"
+                                VerticalAlignment="Center"
+                                Focusable="false"
+                                HorizontalScrollBarVisibility="Hidden"
+                                Opacity="1"
+                                VerticalScrollBarVisibility="Hidden" />
                         </Border>
                     </Grid>
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsEnabled" Value="False">
-                            <Setter Property="Opacity" Value="0.6"></Setter>
+                            <Setter Property="Opacity" Value="0.6" />
                         </Trigger>
                     </ControlTemplate.Triggers>
                 </ControlTemplate>

+ 36 - 29
PDF Office/Themes/Generic.xaml

@@ -49,6 +49,8 @@
         <Setter Property="BorderThickness" Value="1" />
         <Setter Property="FocusVisualStyle" Value="{x:Null}" />
         <Setter Property="Height" Value="32" />
+        <Setter Property="Padding" Value="3 0"/>
+        <Setter Property="CornerRadius" Value="4" />
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type cus:TextBoxEx}">
@@ -64,7 +66,6 @@
                         <Grid Margin="{TemplateBinding Padding}">
                             <TextBlock
                                 x:Name="placeholder"
-                                Margin="{Binding ElementName=PART_ContentHost, Path=Margin}"
                                 Padding="{TemplateBinding Padding}"
                                 HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                 VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
@@ -72,33 +73,40 @@
                                 Foreground="{TemplateBinding PlaceholderForeground}"
                                 Text="{TemplateBinding PlaceholderText}"
                                 Visibility="Collapsed" />
-
-                            <ScrollViewer
-                                x:Name="PART_ContentHost"
-                                Margin="4,5,25,5"
-                                HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
-                                Focusable="false"
-                                Foreground="{TemplateBinding Foreground}"
-                                HorizontalScrollBarVisibility="Hidden"
-                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
-                                Style="{x:Null}"
-                                VerticalScrollBarVisibility="Hidden" />
-                            <Button
-                                Name="PART_BtnClear"
-                                Width="16"
-                                Height="16"
-                                Margin="9,0"
-                                HorizontalAlignment="Right"
-                                VerticalAlignment="Center"
-                                Background="Transparent"
-                                BorderThickness="0"
-                                Style="{StaticResource NoColorBtn}"
-                                Visibility="Collapsed">
-                                <Path
-                                    Data="M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM11.5303 5.53038L9.06069 8L11.5303 10.4696L10.4697 11.5303L8.00002 9.06066L5.53033 11.5303L4.46967 10.4697L6.93936 8L4.46967 5.53033L5.53033 4.46967L8.00002 6.93934L10.4697 4.46971L11.5303 5.53038Z"
-                                    Fill="#CED0D4"
-                                    Stretch="Uniform" />
-                            </Button>
+                            <Grid VerticalAlignment="Center">
+                                <Grid.ColumnDefinitions>
+                                    <ColumnDefinition Width="*" />
+                                    <ColumnDefinition Width="auto" />
+                                </Grid.ColumnDefinitions>
+                                <ScrollViewer
+                                    x:Name="PART_ContentHost"
+                                    Margin="0"
+                                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
+                                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
+                                    Focusable="false"
+                                    Foreground="{TemplateBinding Foreground}"
+                                    HorizontalScrollBarVisibility="Hidden"
+                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
+                                    Style="{x:Null}"
+                                    VerticalScrollBarVisibility="Hidden" />
+                                <Button
+                                    Name="PART_BtnClear"
+                                    Grid.Column="1"
+                                    Width="16"
+                                    Height="16"
+                                    Margin="9,0"
+                                    HorizontalAlignment="Right"
+                                    VerticalAlignment="Center"
+                                    Background="Transparent"
+                                    BorderThickness="0"
+                                    Style="{StaticResource NoColorBtn}"
+                                    Visibility="Collapsed">
+                                    <Path
+                                        Data="M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM11.5303 5.53038L9.06069 8L11.5303 10.4696L10.4697 11.5303L8.00002 9.06066L5.53033 11.5303L4.46967 10.4697L6.93936 8L4.46967 5.53033L5.53033 4.46967L8.00002 6.93934L10.4697 4.46971L11.5303 5.53038Z"
+                                        Fill="#CED0D4"
+                                        Stretch="Uniform" />
+                                </Button>
+                            </Grid>
                         </Grid>
                     </Border>
                     <ControlTemplate.Triggers>
@@ -135,7 +143,6 @@
                         </Trigger>
                         <Trigger Property="ShowClose" Value="False">
                             <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
-                            <Setter TargetName="PART_ContentHost" Property="Margin" Value="4,5" />
                         </Trigger>
                         <MultiTrigger>
                             <MultiTrigger.Conditions>

+ 18 - 1
PDF Office/ViewModels/BottomToolContentViewModel.cs

@@ -657,7 +657,24 @@ namespace PDF_Master.ViewModels
             if (e.Key == "Zoom")
             {
                 CurrentZoom = (double)e.Value * 100;
-                SelectedIndex = -1;
+
+                switch (PDFViewer.ModeFit)
+                {
+                    case FitMode.FitWidth:
+                        SelectedIndex = 1;
+                        break;
+                    case FitMode.FitHeight:
+                        SelectedIndex = 2;
+                        break;
+                    case FitMode.FitSize:
+                        SelectedIndex = 0;
+                        break;
+                    case FitMode.FitFree:
+                        SelectedIndex = -1;
+                        break;
+                    default:
+                        break;
+                }
             }
             if (OpenFileInfo != null)
             {

+ 44 - 54
PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs

@@ -57,7 +57,7 @@ namespace PDF_Master.ViewModels.PageEdit
         #endregion
 
 
-        private CPDFViewer PDFViewer;
+        public CPDFViewer PDFViewer;
 
         private ViewContentViewModel viewContentViewModel;
 
@@ -140,14 +140,16 @@ namespace PDF_Master.ViewModels.PageEdit
             set
             {
                 SetProperty(ref listSelecedIndex, value);
-                //显示页面范围选择控件
-                TbPageRangeVisibility = Visibility.Visible;
-                TbPageRange = (ListSelectedIndex + 1).ToString();
-                TxtPageInputVisibility = Visibility.Collapsed;
-                if (IsBOTAThumb == Visibility.Visible && PDFViewer != null)
+                if (!IsSelectFormSelf&&value>=0)
                 {
-                    PDFViewer.GoToPage(listSelecedIndex);
+                    //显示页面范围选择控件
+                    TxtPageInputVisibility = Visibility.Visible;
+                    TbPageRange = (ListSelectedIndex + 1).ToString();
                 }
+                //if (IsBOTAThumb == Visibility.Visible && PDFViewer != null)
+                //{
+                //    PDFViewer.GoToPage(listSelecedIndex);
+                //}
             }
         }
 
@@ -175,10 +177,11 @@ namespace PDF_Master.ViewModels.PageEdit
             set
             {
                 SetProperty(ref comboxSelectIndex, value);
+                //隐藏tb页面范围显示控件
+                TxtPageInputVisibility = Visibility.Collapsed;
                 //选中指定的页面范围
                 SuitPageRange(comboxSelectIndex);
-                //隐藏tb页面范围显示控件
-                TbPageRangeVisibility = Visibility.Collapsed;
+
 
             }
         }
@@ -210,10 +213,6 @@ namespace PDF_Master.ViewModels.PageEdit
             set
             {
                 SetProperty(ref tbPageRange, value);
-                if (string.IsNullOrEmpty(TbPageRange))
-                {
-                    TbPageRange = "请输入范围";
-                }
             }
         }
 
@@ -347,6 +346,11 @@ namespace PDF_Master.ViewModels.PageEdit
         //选中的页面集合
         private List<int> selectedPageList = new List<int>();
 
+        /// <summary>
+        /// 是否是下拉框选项改变引起的选项变更事件
+        /// </summary>
+        private bool IsSelectFormSelf = false;
+
 
         #endregion
 
@@ -358,16 +362,6 @@ namespace PDF_Master.ViewModels.PageEdit
         /// </summary>
         public DelegateCommand<object> PreviewKeyDown { get; set; }
 
-        /// <summary>
-        /// 响应键盘回车事件
-        /// </summary>
-        public DelegateCommand<object> KeyDown { get; set; }
-
-        /// <summary>
-        ///文本框失去焦点事件
-        /// </summary>
-        public DelegateCommand<object> LostFocusCommand { get; set; }
-
 
         /// <summary>
         /// 粘贴
@@ -445,6 +439,8 @@ namespace PDF_Master.ViewModels.PageEdit
         public DelegateCommand ShowPageSizeCommand { get; set; }
 
         public DelegateCommand ClearSelectedCommand { get; set; }
+
+
         #endregion
 
         public PageEditContentViewModel(IDialogService dialogService, IEventAggregator eventAggregator)
@@ -459,8 +455,6 @@ namespace PDF_Master.ViewModels.PageEdit
             //绑定命令
             SelectionChangedCommand = new DelegateCommand<object>(SelectionChangedEvent);
             PreviewKeyDown = new DelegateCommand<object>(PreviewKeyDownEvent);
-            KeyDown = new DelegateCommand<object>(KeyDownEvent);
-            LostFocusCommand = new DelegateCommand<object>(lostfocus);
 
             SplitCommand = new DelegateCommand(SplitCommandEvent);
             InsertCommand = new DelegateCommand<object>(InsertCommandEvent);
@@ -814,10 +808,6 @@ namespace PDF_Master.ViewModels.PageEdit
             PageEditItems.Insert(preiIndex, targetitem);
             PageEditItems.Insert(laterIndex, sourceitem);
 
-            //PageEditItems.Remove(targetitem);
-            //PageEditItems.Insert(laterIndex, sourceitem);
-            //PageEditItems.Remove(sourceitem);
-            //PageEditItems.Insert(preiIndex, targetitem);
             return true;
         }
 
@@ -924,11 +914,16 @@ namespace PDF_Master.ViewModels.PageEdit
         /// <param name="e"></param>
         private void SelectionChangedEvent(object e)
         {
+            if (IsSelectFormSelf)
+            {
+                //避免频繁的触发该事件
+                return;
+            }
             var args = e as SelectionChangedEventArgs;
             //下下策 从UI控件获取所有选项的集合
             var listbox = args.OriginalSource as ListBox;
 
-            if (TbPageRangeVisibility == Visibility.Visible && args != null)
+            if (TxtPageInputVisibility == Visibility.Visible && args != null)
             {
                 selectedPageList = new List<int>();
                 for (int i = 0; i < listbox.SelectedItems.Count; i++)
@@ -994,28 +989,18 @@ namespace PDF_Master.ViewModels.PageEdit
                 return;
             }
 
+
+            //枚举 过滤所有不合理的输入
             if (args.Key != Key.Enter && args.Key != Key.Back && args.Key != Key.OemComma && args.Key != Key.OemMinus && args.Key != Key.Subtract && !((args.Key >= Key.D0 && args.Key <= Key.D9) || (args.Key >= Key.NumPad0 && args.Key <= Key.NumPad9)))
             {
                 args.Handled = true;
             }
-        }
 
-        /// <summary>
-        /// 响应回车确认事件
-        /// </summary>
-        /// <param name="e"></param>
-        private void KeyDownEvent(object e)
-        {
-            var args = e as KeyEventArgs;
-            if (args == null)
-            {
-                return;
-            }
             if (args.Key == Key.Enter)
             {
                 List<int> TargetPageIndexs = new List<int>();
                 var result = CommonHelper.GetPagesInRange(ref TargetPageIndexs, (args.OriginalSource as TextBox).Text, PDFViewer.Document.PageCount, new char[] { ',', ',' }, new char[] { '-' });
-                if (!result && ComboxSelectIndex == 5)
+                if (!result)
                 {
                     AlertsMessage alertsMessage = new AlertsMessage();
                     alertsMessage.ShowDialog("", "请输入有效范围", "OK");
@@ -1040,7 +1025,7 @@ namespace PDF_Master.ViewModels.PageEdit
         /// 失去焦点后选中页面
         /// </summary>
         /// <param name="obj"></param>
-        private void lostfocus(object obj)
+        public void lostfocus(object obj)
         {
             var args = obj as RoutedEventArgs;
             if (args == null || (args.OriginalSource as TextBox) == null)
@@ -2059,7 +2044,7 @@ namespace PDF_Master.ViewModels.PageEdit
         /// 选中目标页面范围的页面
         /// </summary>
         /// <param name="index">页面范围选中项索引</param>
-        private void SuitPageRange(int index)
+        private async void SuitPageRange(int index)
         {
             List<int> pageRange = new List<int>();
             switch (index)
@@ -2111,24 +2096,24 @@ namespace PDF_Master.ViewModels.PageEdit
                     }
                     break;
                 case 5://自定义
-
-                    //await Task.Delay(20);
-                    //TbPageRange = "1,3";
+                    TxtPageInputVisibility = Visibility.Visible;
+                        await Task.Delay(30);
+                        TbPageRange = "";
                     break;
                 default:
                     break;
             }
             if (pageRange.Count > 0)
             {
+                //避免在下面的过程中频繁触发SelectionChanged事件
+                IsSelectFormSelf = true;
                 NotifyUIToRefresh(pageRange);
+                IsSelectFormSelf = false;
             }
             else
             {
-                if (index != 5)
-                {
-                    //没有符合条件时 清空选中项
-                    ListSelectedIndex = -1;
-                }
+                //没有符合条件时 清空选中项
+                ListSelectedIndex = -1;
             }
         }
 
@@ -2338,7 +2323,7 @@ namespace PDF_Master.ViewModels.PageEdit
                 }
             }
             //通知UI选中Items
-            //NotifyUIToRefresh(selectedPages);
+            NotifyUIToRefresh(selectedPages);
             //刷新页码和图片
             ReloadAfterOption(true, true, new Tuple<int, int>(0, PDFViewer.Document.PageCount));
 
@@ -2374,6 +2359,11 @@ namespace PDF_Master.ViewModels.PageEdit
             var source = PageEditItems[sourceindex];
             PageEditItems.RemoveAt(sourceindex);
             PageEditItems.Insert(targetindex, source);
+
+            if(PDFViewer.CurrentIndex==sourceindex)
+            {
+                PDFViewer.GoToPage(targetindex);
+            }
             return true;
         }
 

+ 1 - 0
PDF Office/Views/BOTA/BOTAContent.xaml

@@ -91,6 +91,7 @@
                 Width="48"
                 Height="48"
                 Style="{StaticResource BOTATab}"
+                IsVisibleChanged="TabItemThumbnail_IsVisibleChanged"
                 Visibility="{Binding ElementName=MenuThumbnail, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}">
                 <customcontrol:IconAndTextTabItem.NormalPathIcon>
                     <PathGeometry Figures="M15 9V17H5L5 3L9 3V7C9 8.10457 9.89543 9 11 9H15ZM14.1716 7H11V3.82843L12.5858 5.41421L14.1716 7ZM17 8V17C17 18.1046 16.1046 19 15 19H5C3.89543 19 3 18.1046 3 17V3C3 1.89543 3.89543 1 5 1H10H10.1716C10.702 1 11.2107 1.21071 11.5858 1.58579L14 4L16.4142 6.41421C16.7893 6.78929 17 7.29799 17 7.82843V8Z" />

+ 9 - 2
PDF Office/Views/BOTA/BOTAContent.xaml.cs

@@ -54,9 +54,16 @@ namespace PDF_Master.Views.BOTA
             }
         }
 
-        private void CloseBOTACommand_Executed(object sender, ExecutedRoutedEventArgs e)
+        private void TabItemThumbnail_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
         {
-           
+            var item = sender as TabItem;
+            if(item!=null&&item.IsSelected)
+            {
+                if(!(bool)e.NewValue)
+                {
+                    (this.DataContext as BOTAContentViewModel).viewContentViewModel.OpenBOTA = false;
+                }
+            }
         }
     }
 }

Plik diff jest za duży
+ 59 - 31
PDF Office/Views/BottomToolContent.xaml


+ 22 - 10
PDF Office/Views/Dialog/SettingsDialog.xaml

@@ -460,12 +460,12 @@
 
                                 <Label
                                     Grid.Column="2"
-                                    Content="Rectangular borders:"
+                                    Content="Rectangular Fill:"
                                     Style="{StaticResource Label2}" />
                                 <compositecontrol:ColorContent
                                     Grid.Column="3"
                                     Height="40"
-                                    SelectedColor="{Binding Annote.RectangleBorderColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    SelectedColor="{Binding Annote.RectangleFillColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                     ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="1"
@@ -481,13 +481,13 @@
                                 <Label
                                     Grid.Row="1"
                                     Grid.Column="2"
-                                    Content="Round borders:"
+                                    Content="Rectangle borders:"
                                     Style="{StaticResource Label2}" />
                                 <compositecontrol:ColorContent
                                     Grid.Row="1"
                                     Grid.Column="3"
                                     Height="40"
-                                    SelectedColor="{Binding Annote.CircleBorderColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    SelectedColor="{Binding Annote.RectangleBorderColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                     ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="2"
@@ -503,13 +503,13 @@
                                 <Label
                                     Grid.Row="2"
                                     Grid.Column="2"
-                                    Content="Line segment:"
+                                    Content="Circle Fill:"
                                     Style="{StaticResource Label2}" />
                                 <compositecontrol:ColorContent
                                     Grid.Row="2"
                                     Grid.Column="3"
                                     Height="40"
-                                    SelectedColor="{Binding Annote.LineColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    SelectedColor="{Binding Annote.CircleFillColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                     ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="3"
@@ -525,13 +525,13 @@
                                 <Label
                                     Grid.Row="3"
                                     Grid.Column="2"
-                                    Content="Rectangular Fill:"
+                                    Content="Circle Border:"
                                     Style="{StaticResource Label2}" />
                                 <compositecontrol:ColorContent
                                     Grid.Row="3"
                                     Grid.Column="3"
                                     Height="40"
-                                    SelectedColor="{Binding Annote.RectangleFillColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    SelectedColor="{Binding Annote.CircleBorderColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                     ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="4"
@@ -547,13 +547,13 @@
                                 <Label
                                     Grid.Row="4"
                                     Grid.Column="2"
-                                    Content="Round filling:"
+                                    Content="Line:"
                                     Style="{StaticResource Label2}" />
                                 <compositecontrol:ColorContent
                                     Grid.Row="4"
                                     Grid.Column="3"
                                     Height="40"
-                                    SelectedColor="{Binding Annote.CircleFillColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    SelectedColor="{Binding Annote.LineColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                     ShowColorList="Collapsed" />
                                 <Label
                                     Grid.Row="5"
@@ -566,6 +566,18 @@
                                     HorizontalAlignment="Left"
                                     SelectedColor="{Binding Annote.NoteAnnoteColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                     ShowColorList="Collapsed" />
+                                <Label
+                                    Grid.Row="5"
+                                    Grid.Column="2"
+                                    Content="Arrow:"
+                                    Style="{StaticResource Label2}" />
+                                <compositecontrol:ColorContent
+                                    Grid.Row="5"
+                                    Grid.Column="4"
+                                    Height="40"
+                                    HorizontalAlignment="Left"
+                                    SelectedColor="{Binding Annote.NoteAnnoteColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    ShowColorList="Collapsed" />
                             </Grid>
                         </Border>
 

+ 2 - 8
PDF Office/Views/HomePanel/RecentFiles/RecentFilesContent.xaml

@@ -14,8 +14,8 @@
     d:DesignHeight="450"
     d:DesignWidth="800"
     prism:ViewModelLocator.AutoWireViewModel="True"
-    Loaded="UserControl_Loaded"
     KeyDown="UserControl_KeyDown"
+    Loaded="UserControl_Loaded"
     mc:Ignorable="d">
     <UserControl.Resources>
         <ResourceDictionary>
@@ -50,14 +50,9 @@
 
             <ContextMenu
                 x:Key="FlyoutMenu"
+                DataContext="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext}"
                 FontSize="14"
                 Opened="ContextMenu_Opened">
-                <ContextMenu.ItemContainerStyle>
-                    <Style TargetType="MenuItem">
-                        <Setter Property="Padding" Value="0,7,0,7" />
-                        <Setter Property="VerticalContentAlignment" Value="Center" />
-                    </Style>
-                </ContextMenu.ItemContainerStyle>
                 <MenuItem
                     Name="FilePathMenuItem"
                     Click="FilePathMenuItem_Click"
@@ -272,7 +267,6 @@
                     ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                     ScrollViewer.VerticalScrollBarVisibility="Auto"
                     SelectionMode="Extended"
-                    Style="{StaticResource FilesGridViewStyle}"
                     VirtualizingPanel.CacheLength="1"
                     VirtualizingPanel.CacheLengthUnit="Page"
                     VirtualizingPanel.IsVirtualizing="True"

+ 34 - 31
PDF Office/Views/HomePanel/RecentFiles/RecentFilesContent.xaml.cs

@@ -53,30 +53,30 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
         #region UI操作
         private void ViewModel_RecentFilesSelection(object sender, bool e)
         {
-            if (e)
-            {
-                RecentFilesList.SelectedItems.Clear();
-                if (GridRecentFilesList.SelectedItems.Count > 0)
-                {
-                    for (int i = 0; i < GridRecentFilesList.SelectedItems.Count; i++)
-                    {
-                        RecentFilesList.SelectedItems.Add(GridRecentFilesList.SelectedItems[i]);
-                    }
-
-                }
-            }
-            else
-            {
-                GridRecentFilesList.SelectedItems.Clear();
-                if (RecentFilesList.SelectedItems.Count > 0)
-                {
-                    for (int i = 0; i < RecentFilesList.SelectedItems.Count; i++)
-                    {
-                        GridRecentFilesList.SelectedItems.Add(RecentFilesList.SelectedItems[i]);
-                    }
-
-                }
-            }
+            //if (e)
+            //{
+            //    RecentFilesList.SelectedItems.Clear();
+            //    if (GridRecentFilesList.SelectedItems.Count > 0)
+            //    {
+            //        for (int i = 0; i < GridRecentFilesList.SelectedItems.Count; i++)
+            //        {
+            //            RecentFilesList.SelectedItems.Add(GridRecentFilesList.SelectedItems[i]);
+            //        }
+
+            //    }
+            //}
+            //else
+            //{
+            //    GridRecentFilesList.SelectedItems.Clear();
+            //    if (RecentFilesList.SelectedItems.Count > 0)
+            //    {
+            //        for (int i = 0; i < RecentFilesList.SelectedItems.Count; i++)
+            //        {
+            //            GridRecentFilesList.SelectedItems.Add(RecentFilesList.SelectedItems[i]);
+            //        }
+
+            //    }
+            //}
         }
 
         private void ContextMenu_Opened(object sender, RoutedEventArgs e)
@@ -213,14 +213,17 @@ namespace PDF_Master.Views.HomePanel.RecentFiles
 
         private void UserControl_KeyDown(object sender, KeyEventArgs e)
         {
-            //点击ESC取消选中
-            if(GridRecentFilesList.Visibility == Visibility.Visible)
-            {
-                GridRecentFilesList.SelectedIndex = -1;
-            }
-            else
+            if (e.Key == Key.Escape)
             {
-                RecentFilesList.SelectedIndex = -1;
+                //点击ESC取消选中
+                if (GridRecentFilesList.Visibility == Visibility.Visible)
+                {
+                    GridRecentFilesList.SelectedIndex = -1;
+                }
+                else
+                {
+                    RecentFilesList.SelectedIndex = -1;
+                }
             }
         }
     }

+ 0 - 1
PDF Office/Views/MainWindow.xaml

@@ -22,7 +22,6 @@
     BorderThickness="2"
     Closed="Window_Closed"
     Closing="Window_Closing"
-    PreviewMouseLeftButtonDown="Window_PreviewMouseLeftButtonDown"
     SizeChanged="Window_SizeChanged"
     Style="{StaticResource WindowStyle}"
     UseLayoutRounding="True"

+ 0 - 39
PDF Office/Views/MainWindow.xaml.cs

@@ -240,44 +240,5 @@ namespace PDF_Master.Views
                 e.Cancel = true;
             }
         }
-
-        private void Window_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
-        {
-            //通过转移焦点来使文本框触发失去焦点事件
-            var uiElement = FocusManager.GetFocusedElement(this);
-            if (uiElement != null)
-            {
-                var textBox = uiElement as TextBox;
-                
-                //如果是下拉框本身的可输入文本框,则点击下拉框或者下拉选项时不失去焦点
-                var parent = CommonHelper.FindVisualParent<ComboBox>(textBox);
-                if (parent != null)
-                {
-                    var visual = VisualTreeHelper.HitTest(parent, e.GetPosition(parent));
-                    if (visual != null)
-                    {
-                        //点击下拉框展开按钮时 不失去焦点
-                        var item = CommonHelper.FindVisualParent<ComboBox>(visual.VisualHit);
-                        if (item != null)
-                        {
-                            return;
-                        }
-                    }
-
-                    //选择下拉选项时,返回,不失去焦点,否则下拉框的其他选项无法选中
-                    if(parent.IsDropDownOpen)
-                    {
-                        return;
-                    }
-                }
-
-                //点击其他非文本框区域时,失去焦点
-                if (textBox != null)
-                {
-                    GridRoot.Focusable = true;
-                    GridRoot.Focus();
-                }
-            }
-        }
     }
 }

+ 62 - 59
PDF Office/Views/PageEdit/PageEditContent.xaml

@@ -30,62 +30,64 @@
             <convert:BoolToVisible x:Key="BoolToVisibleConvert" />
             <convert:UnVisivleConvert x:Key="UnVisibleConvert" />
             <DataTemplate x:Key="PageEditListBoxItemTemplate" DataType="{x:Type pageedit:PageEditItem}">
-                <StackPanel AllowDrop="True">
-                    <Border
-                        Name="BdBorder"
-                        VerticalAlignment="Top"
-                        BorderBrush="Transparent"
-                        BorderThickness="2"
-                        CornerRadius="0">
-                        <Grid
-                            Name="GridRoot"
-                            Width="{Binding ItemSize.Width}"
-                            Height="{Binding ItemSize.Height}"
-                            Margin="1"
-                            Background="Transparent">
-                            <Image Source="{Binding Image}" Stretch="Uniform" />
-                            <Border
-                                Width="10"
-                                Height="10"
-                                Margin="0,10,10,0"
-                                HorizontalAlignment="Right"
-                                VerticalAlignment="Top"
-                                Background="Yellow"
-                                Visibility="{Binding HaveBookMark, Converter={StaticResource BoolToVisibleConvert}}" />
-                        </Grid>
-                    </Border>
+                <Grid Name="BdRoot">
+                    <StackPanel AllowDrop="True">
+                        <Border
+                            Name="BdBorder"
+                            VerticalAlignment="Top"
+                            BorderBrush="Transparent"
+                            BorderThickness="2"
+                            CornerRadius="0">
+                            <Grid
+                                Name="GridRoot"
+                                Width="{Binding ItemSize.Width}"
+                                Height="{Binding ItemSize.Height}"
+                                Margin="1"
+                                Background="Transparent">
+                                <Image Source="{Binding Image}" Stretch="Uniform" />
+                                <Border
+                                    Width="10"
+                                    Height="10"
+                                    Margin="0,10,10,0"
+                                    HorizontalAlignment="Right"
+                                    VerticalAlignment="Top"
+                                    Background="Yellow"
+                                    Visibility="{Binding HaveBookMark, Converter={StaticResource BoolToVisibleConvert}}" />
+                            </Grid>
+                        </Border>
 
-                    <Border
-                        Name="BdPageNum"
-                        Margin="0,4,0,0"
-                        HorizontalAlignment="Center"
-                        VerticalAlignment="Bottom"
-                        Background="Transparent">
-                        <StackPanel
-                            Name="StkpnlButtom"
-                            Width="auto"
-                            MinWidth="10"
+                        <Border
+                            Name="BdPageNum"
+                            Margin="0,4,0,0"
                             HorizontalAlignment="Center"
+                            VerticalAlignment="Bottom"
                             Background="Transparent">
-                            <TextBlock
-                                Width="auto"
-                                Height="22"
-                                Margin="0,4"
-                                HorizontalAlignment="Center"
-                                FontSize="14"
-                                Text="{Binding PageNumber}" />
-                            <TextBlock
+                            <StackPanel
+                                Name="StkpnlButtom"
                                 Width="auto"
-                                MinHeight="22"
-                                MaxWidth="{Binding ElementName=GridRoot, Path=ActualWidth}"
+                                MinWidth="10"
                                 HorizontalAlignment="Center"
-                                FontSize="14"
-                                Text="{Binding PageSize}"
-                                TextWrapping="Wrap"
-                                Visibility="{Binding ShowPageSize, Converter={StaticResource BoolToVisibleConvert}}" />
-                        </StackPanel>
-                    </Border>
-                </StackPanel>
+                                Background="Transparent">
+                                <TextBlock
+                                    Width="auto"
+                                    Height="22"
+                                    Margin="0,4"
+                                    HorizontalAlignment="Center"
+                                    FontSize="14"
+                                    Text="{Binding PageNumber}" />
+                                <TextBlock
+                                    Width="auto"
+                                    MinHeight="22"
+                                    MaxWidth="{Binding ElementName=GridRoot, Path=ActualWidth}"
+                                    HorizontalAlignment="Center"
+                                    FontSize="14"
+                                    Text="{Binding PageSize}"
+                                    TextWrapping="Wrap"
+                                    Visibility="{Binding ShowPageSize, Converter={StaticResource BoolToVisibleConvert}}" />
+                            </StackPanel>
+                        </Border>
+                    </StackPanel>
+                </Grid>
             </DataTemplate>
 
             <ContextMenu x:Key="ListBoxItemMenu" DataContext="{Binding Path=DataContext, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}">
@@ -175,29 +177,29 @@
                 <RowDefinition Height="auto" />
                 <RowDefinition />
             </Grid.RowDefinitions>
-            <Grid Height="40" Background="{StaticResource color.sys.layout.mg}">
+            <Grid
+                Height="40"
+                Background="{StaticResource color.sys.layout.mg}"
+                Focusable="True"
+                PreviewMouseLeftButtonDown="Grid_PreviewMouseLeftButtonDown">
                 <StackPanel
                     Name="StkpnlCenter"
                     HorizontalAlignment="Center"
                     Orientation="Horizontal">
                     <Grid>
                         <ComboBox
+                            Name="CmbPageRange"
                             Width="117"
                             Height="23"
                             IsEditable="True"
                             ItemsSource="{Binding PageRangeItems}"
+                            LostFocus="TextBoxEx_LostFocus"
                             SelectedIndex="{Binding ComboxSelectIndex, Mode=TwoWay}"
-                            Text="{Binding TbPageRange}">
+                            Text="{Binding TbPageRange, Mode=TwoWay}">
                             <i:Interaction.Triggers>
                                 <i:EventTrigger EventName="PreviewKeyDown">
                                     <i:InvokeCommandAction Command="{Binding PreviewKeyDown}" PassEventArgsToCommand="True" />
                                 </i:EventTrigger>
-                                <i:EventTrigger EventName="KeyDown">
-                                    <i:InvokeCommandAction Command="{Binding KeyDown}" PassEventArgsToCommand="True" />
-                                </i:EventTrigger>
-                                <i:EventTrigger EventName="LostFocus">
-                                    <i:InvokeCommandAction Command="{Binding LostFocusCommand}" PassEventArgsToCommand="True" />
-                                </i:EventTrigger>
                             </i:Interaction.Triggers>
                         </ComboBox>
                     </Grid>
@@ -214,6 +216,7 @@
                             Data="M19.4129 12.9758C18.9269 10.15 16.4645 8 13.5 8C10.1863 8 7.5 10.6863 7.5 14C7.5 17.3137 10.1863 20 13.5 20C14.5945 20 15.6178 19.7078 16.4993 19.1979L17.5007 20.9291C16.323 21.6104 14.9555 22 13.5 22C9.08172 22 5.5 18.4183 5.5 14C5.5 9.58172 9.08172 6 13.5 6C17.1531 6 20.2343 8.44856 21.192 11.794L21.7091 9.86404L23.641 10.3817L22.4504 14.8249C22.3075 15.3584 21.7591 15.675 21.2257 15.532L16.7824 14.3415L17.3 12.4096L19.4129 12.9758Z" />
                     </Button>
                     <Separator
+                        Name="Separator"
                         Width="1"
                         Height="24"
                         Margin="5,0"

+ 80 - 4
PDF Office/Views/PageEdit/PageEditContent.xaml.cs

@@ -225,8 +225,8 @@ namespace PDF_Master.Views.PageEdit
         /// </summary>
         private void PulishEvent()
         {
-            var itemSize = (ListPageEdit.Items[0] as PageEditItem).ItemSize;
-            var range = GetRoughFromView(ListPageEdit, itemSize, new Thickness(5, 10, 5, 10));
+            var itemSize = new Size((ListPageEdit.Items[0] as PageEditItem).ItemSize.Width+32,(ListPageEdit.Items[0] as PageEditItem).ItemSize.Height+30);
+            var range = GetRoughFromView(ListPageEdit, itemSize, new Thickness(5,10,5,10));
             if((bool)TbnTwoLine.IsChecked)
             {
                 ///双列模式下要计算两列item
@@ -816,8 +816,18 @@ namespace PDF_Master.Views.PageEdit
 
         private void ListBoxItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
-
-            //e.Handled = true;
+            if(GridBOTAHeader.Visibility == Visibility.Visible&&viewModel.PDFViewer!=null)
+            {
+                if(Keyboard.Modifiers == ModifierKeys.Shift||Keyboard.Modifiers== ModifierKeys.Control)
+                {
+                    return;
+                }
+                var item = (sender as ListBoxItem).DataContext as PageEditItem;
+                if(item != null)
+                {
+                    viewModel.PDFViewer.GoToPage(item.PageNumber-1);
+                }
+            }
         }
 
         private void ListBoxItem_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
@@ -919,5 +929,71 @@ namespace PDF_Master.Views.PageEdit
         {
 
         }
+
+        private async void TextBoxEx_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
+        {
+            var text = sender as TextBox;
+            if(text!=null)
+            {
+                await Task.Delay(50);
+                text.Focus();
+            }
+        }
+
+        private void TextBoxEx_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            var text = sender as TextBox;
+            if(text.Visibility==Visibility.Visible&&string.IsNullOrEmpty(text.Text))
+            {
+                text.Focus();
+            }
+        }
+
+        private void TextBoxEx_LostFocus(object sender, RoutedEventArgs e)
+        {
+            //因为需要处理点击按钮或者点击列表失去焦点是 不进行弹窗 因此写在cs里,方便获取UI控件
+            var element = FocusManager.GetFocusedElement(this);
+            var visual = VisualTreeHelper.HitTest(this, Mouse.GetPosition(this));
+            //点击其他区域失去焦点时 不响应页码判断逻辑
+            if (visual != null)
+            {
+                var listbox = CommonHelper.FindVisualParent<ListBox>(visual.VisualHit);
+                if (listbox != null)
+                {
+                    //点击在listbox列表内
+                    return;
+                }
+                var image = CommonHelper.FindVisualParent<Image>(visual.VisualHit);
+                if (image != null)
+                {
+                    //点击在listbox列表内,具体某一项时,上面的判断调整可能失效,需要补充条件
+                    return;
+                }
+                var button =CommonHelper.FindVisualParent<Button>(visual.VisualHit);
+                if(button!=null)
+                {
+                    //点击在按钮时 
+                    return;
+                }
+                var combox = CommonHelper.FindVisualParent<ComboBox>(visual.VisualHit);
+                if(combox!=null)
+                {
+                    //点击在下拉框时 
+                    return;
+                }
+                viewModel.lostfocus(e);
+            }
+
+        }
+
+        private void Grid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            var visual = VisualTreeHelper.HitTest(this, Mouse.GetPosition(this));
+            if ((visual.VisualHit as Grid)!=null)
+            {
+                //点击工具栏空白处时 失去焦点
+                ListPageEdit.Focus();
+            }
+        }
     }
 }

+ 1 - 0
PDF Office/Views/ViewContent.xaml

@@ -128,6 +128,7 @@
                             </MenuItem>
                             <Separator Margin="8,0" Style="{StaticResource HorizontalSeparatorStyle}" />
                             <MenuItem Header="Create Files">
+                                <MenuItem Command="{Binding CreateFromFile}" Header="Create From File" />
                                 <MenuItem Command="{Binding CreateBlankFileCommand}" Header="Create Blank" />
                                 <MenuItem Command="{Binding mainViewModel.homeContentViewModel.CreateFromScanner}" Header="Create Form Scanner" />
                             </MenuItem>

+ 1 - 0
PDFSettings/APPSettingProperties.cs

@@ -195,6 +195,7 @@ namespace PDFSettings
         public Color CircleBorderColor = Color.FromArgb(0xFF, 0xFC, 0x1F, 0x1F);
         public Color CircleFillColor = Colors.White;
         public Color LineColor = Color.FromArgb(0xFF, 0xFC, 0x1F, 0x1F);
+        public Color ArrowColor = Colors.Red;
 
         /// <summary>
         ///文本对齐方式