Browse Source

底部工具栏-补充页面缩放逻辑

ZhouJieSheng 2 years ago
parent
commit
6d43582432

+ 1 - 0
PDF Office/App.xaml

@@ -8,6 +8,7 @@
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/TabControlStyle.xaml" />
+                <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/ComboxStyle.xaml" />
             </ResourceDictionary.MergedDictionaries>
 
 

+ 13 - 1
PDF Office/PDF Office.csproj

@@ -21,12 +21,13 @@
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
+    <DebugType>embedded</DebugType>
     <Optimize>false</Optimize>
     <OutputPath>bin\Debug\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -103,6 +104,9 @@
       <SubType>Designer</SubType>
     </ApplicationDefinition>
     <Compile Include="CustomControl\CustomIconToggleBtn.cs" />
+    <Compile Include="CustomControl\ToastControl.xaml.cs">
+      <DependentUpon>ToastControl.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Model\DialogNames.cs" />
     <Compile Include="CustomControl\InterTabClient.cs" />
     <Compile Include="CustomControl\LoadingControl.xaml.cs">
@@ -170,6 +174,14 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="CustomControl\ToastControl.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Styles\ComboxStyle.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Styles\CustomBtnStyle.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

+ 11 - 0
PDF Office/StyleAndTemplateList.txt

@@ -6,3 +6,14 @@
 样式位置:PDF Office\Styles\TabControlStyle.xaml
 用途:用于调整HeaderPanel水平居中(不影响Content位置的前提下)
 目前用于:阅读页工具栏、BOTA多页签部分
+
+自定义控件
+1.LoadingContorl
+位置:PDF Office\CustomControl\LoadingControl.xaml
+用途:耗时操作过程中,显示圆形转圈的等待界面
+使用方法:View里添加该控件、通过绑定VM里的Vibility类型变量来控制显示和隐藏,需要做异步处理才会显示出来
+
+2.ToastControl
+位置:PDF Office\CustomControl\ToastControl.xaml
+用途:部分操作后,在界面中间显示提示,一段时候后自动渐隐消失
+使用方法:VM里绑定一个bool变量,设为True时,Toast开始显示,开始渐隐时间(beginTime),和渐隐时间(Duration)在xaml里设置

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

@@ -0,0 +1,86 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+    <ControlTemplate x:Key="ComboxItem" TargetType="{x:Type ComboBoxItem}">
+        <Border
+            Name="Bd"
+            Padding="{TemplateBinding Control.Padding}"
+            Background="{TemplateBinding Panel.Background}"
+            BorderBrush="{TemplateBinding Border.BorderBrush}"
+            BorderThickness="{TemplateBinding Border.BorderThickness}"
+            SnapsToDevicePixels="True">
+            <ContentPresenter
+                HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
+                VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
+                Content="{TemplateBinding ContentControl.Content}"
+                ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
+                ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
+                SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
+        </Border>
+        <ControlTemplate.Triggers>
+            <Trigger Property="UIElement.IsEnabled" Value="False">
+                <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
+            </Trigger>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="Selector.IsSelected" Value="False" />
+                    <Condition Property="UIElement.IsMouseOver" Value="True" />
+                    <Condition Property="UIElement.IsKeyboardFocused" Value="False" />
+                </MultiTrigger.Conditions>
+                <Setter TargetName="Bd" Property="Panel.Background" Value="#1F26A0DA" />
+                <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#A826A0DA" />
+            </MultiTrigger>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="Selector.IsSelected" Value="True" />
+                    <Condition Property="UIElement.IsMouseOver" Value="False" />
+                    <Condition Property="UIElement.IsKeyboardFocused" Value="True" />
+                </MultiTrigger.Conditions>
+                <Setter TargetName="Bd" Property="Panel.Background" Value="#3D26A0DA" />
+                <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#26A0DA" />
+            </MultiTrigger>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="Selector.IsSelected" Value="True" />
+                    <Condition Property="UIElement.IsMouseOver" Value="True" />
+                </MultiTrigger.Conditions>
+                <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
+                <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
+            </MultiTrigger>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="Selector.IsSelected" Value="True" />
+                    <Condition Property="UIElement.IsMouseOver" Value="False" />
+                    <Condition Property="UIElement.IsKeyboardFocused" Value="False" />
+                </MultiTrigger.Conditions>
+                <Setter TargetName="Bd" Property="Panel.Background" Value="#3DDADADA" />
+                <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#DADADA" />
+            </MultiTrigger>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="Selector.IsSelected" Value="False" />
+                    <Condition Property="UIElement.IsMouseOver" Value="False" />
+                    <Condition Property="UIElement.IsKeyboardFocused" Value="True" />
+                </MultiTrigger.Conditions>
+                <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#26A0DA" />
+            </MultiTrigger>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="Selector.IsSelected" Value="False" />
+                    <Condition Property="UIElement.IsMouseOver" Value="True" />
+                    <Condition Property="UIElement.IsKeyboardFocused" Value="True" />
+                </MultiTrigger.Conditions>
+                <Setter TargetName="Bd" Property="Panel.Background" Value="#1A000000" />
+                <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A000000" />
+            </MultiTrigger>
+        </ControlTemplate.Triggers>
+    </ControlTemplate>
+
+    <Style x:Key="ZoomComboxItemStyle" TargetType="ComboBoxItem">
+        <Setter Property="Template" Value="{StaticResource ComboxItem}" />
+        <Setter Property="Width" Value="224" />
+        <Setter Property="Height" Value="32" />
+        <Setter Property="VerticalContentAlignment" Value="Center" />
+        <Setter Property="FontFamily" Value="Segoe UI" />
+        <Setter Property="FontSize" Value="14" />
+    </Style>
+</ResourceDictionary>

+ 167 - 110
PDF Office/Styles/ListViewStyle.xaml

@@ -1,34 +1,61 @@
-<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">
 
     <Style x:Key="FilesListViewStyle" TargetType="{x:Type ListView}">
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type ListView}">
-                    <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="1" SnapsToDevicePixels="true">
-                        <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
+                    <Border
+                        x:Name="Bd"
+                        Padding="1"
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="{TemplateBinding BorderBrush}"
+                        BorderThickness="{TemplateBinding BorderThickness}"
+                        SnapsToDevicePixels="true">
+                        <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
                             <Grid>
                                 <Grid.RowDefinitions>
-                                    <RowDefinition Height="Auto"/>
-                                    <RowDefinition/>
+                                    <RowDefinition Height="Auto" />
+                                    <RowDefinition />
 
                                 </Grid.RowDefinitions>
                                 <Grid>
                                     <Grid.ColumnDefinitions>
-                                        <ColumnDefinition MinWidth="0" Width ="4.5*"/>
+                                        <ColumnDefinition Width="4.5*" MinWidth="0" />
                                         <ColumnDefinition Width="3*" />
                                         <ColumnDefinition Width="2*" />
-                                        <ColumnDefinition Width="100"/>
+                                        <ColumnDefinition Width="100" />
                                     </Grid.ColumnDefinitions>
-                                    <TextBlock HorizontalAlignment="Left" Margin="12,0,0,6" VerticalAlignment="Center" FontSize="14"/>
-                                    <!--Text="{x:Static homePageUI:HomePage.RencentFiles_Name}"-->
-                                    <TextBlock HorizontalAlignment="Center" Margin="0,0,0,6" TextWrapping="Wrap" TextAlignment="Center" VerticalAlignment="Center" Grid.Column="1" FontSize="14" />
-                                    <!--Text="{x:Static homePageUI:HomePage.RencentFiles_LastOpenedTime}"-->
-                                    <TextBlock HorizontalAlignment="Center" Margin="0,0,0,6" VerticalAlignment="Center" Grid.Column="2" FontSize="14" />
-                                    <!--Text="{x:Static homePageUI:HomePage.RencentFiles_Size}"-->
-                                    <Rectangle Grid.ColumnSpan="4" Margin="12,0,0,0" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Fill="#26000000" Height="1"/>
+                                    <TextBlock
+                                        Margin="12,0,0,6"
+                                        HorizontalAlignment="Left"
+                                        VerticalAlignment="Center"
+                                        FontSize="14" />
+                                    <!--  Text="{x:Static homePageUI:HomePage.RencentFiles_Name}"  -->
+                                    <TextBlock
+                                        Grid.Column="1"
+                                        Margin="0,0,0,6"
+                                        HorizontalAlignment="Center"
+                                        VerticalAlignment="Center"
+                                        FontSize="14"
+                                        TextAlignment="Center"
+                                        TextWrapping="Wrap" />
+                                    <!--  Text="{x:Static homePageUI:HomePage.RencentFiles_LastOpenedTime}"  -->
+                                    <TextBlock
+                                        Grid.Column="2"
+                                        Margin="0,0,0,6"
+                                        HorizontalAlignment="Center"
+                                        VerticalAlignment="Center"
+                                        FontSize="14" />
+                                    <!--  Text="{x:Static homePageUI:HomePage.RencentFiles_Size}"  -->
+                                    <Rectangle
+                                        Grid.ColumnSpan="4"
+                                        Height="1"
+                                        Margin="12,0,0,0"
+                                        HorizontalAlignment="Stretch"
+                                        VerticalAlignment="Bottom"
+                                        Fill="#26000000" />
                                 </Grid>
-                                <ItemsPresenter Grid.Row="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
+                                <ItemsPresenter Grid.Row="1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                             </Grid>
                         </ScrollViewer>
                     </Border>
@@ -38,39 +65,33 @@
     </Style>
 
     <Style x:Key="FilesListViewItemStyle" TargetType="{x:Type ListViewItem}">
-        <Setter Property="UIElement.SnapsToDevicePixels"
-            Value="True" />
-        <Setter Property="Control.Padding"
-            Value="4,1" />
+        <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
+        <Setter Property="Control.Padding" Value="4,1" />
         <Setter Property="Control.HorizontalContentAlignment">
             <Setter.Value>
-                <Binding Path="HorizontalContentAlignment"
-                     RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
+                <Binding Path="HorizontalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
             </Setter.Value>
         </Setter>
         <Setter Property="Control.VerticalContentAlignment">
             <Setter.Value>
-                <Binding Path="VerticalContentAlignment"
-                     RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
+                <Binding Path="VerticalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
             </Setter.Value>
         </Setter>
-        <Setter Property="Panel.Background"
-            Value="#00FFFFFF" />
-        <Setter Property="Border.BorderBrush"
-            Value="#00FFFFFF" />
-        <Setter Property="Border.BorderThickness"
-            Value="1" />
+        <Setter Property="Panel.Background" Value="#00FFFFFF" />
+        <Setter Property="Border.BorderBrush" Value="#00FFFFFF" />
+        <Setter Property="Border.BorderThickness" Value="1" />
         <Setter Property="FrameworkElement.FocusVisualStyle">
             <Setter.Value>
                 <Style TargetType="{x:Type IFrameworkInputElement}">
                     <Setter Property="Control.Template">
                         <Setter.Value>
                             <ControlTemplate>
-                                <Rectangle Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
-                                       StrokeThickness="1"
-                                       StrokeDashArray="1 2"
-                                       Margin="2"
-                                       SnapsToDevicePixels="True" />
+                                <Rectangle
+                                    Margin="2"
+                                    SnapsToDevicePixels="True"
+                                    Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
+                                    StrokeDashArray="1 2"
+                                    StrokeThickness="1" />
                             </ControlTemplate>
                         </Setter.Value>
                     </Setter>
@@ -80,29 +101,50 @@
         <Setter Property="Control.Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type ListViewItem}">
-                    <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
+                    <Border
+                        Name="Bd"
                         Padding="{TemplateBinding Control.Padding}"
-                        BorderBrush="{TemplateBinding Border.BorderBrush}"
                         Background="{TemplateBinding Panel.Background}"
-                        Name="Bd"
+                        BorderBrush="{TemplateBinding Border.BorderBrush}"
+                        BorderThickness="{TemplateBinding Border.BorderThickness}"
                         SnapsToDevicePixels="True">
                         <Grid>
                             <Grid.ColumnDefinitions>
-                                <ColumnDefinition Width="Auto"/>
+                                <ColumnDefinition Width="Auto" />
                                 <ColumnDefinition />
                             </Grid.ColumnDefinitions>
-                            <Grid x:Name="SelectedIcon" Margin="12.5 0 0.5 0" Visibility="Collapsed" HorizontalAlignment="Left" VerticalAlignment="Center">
-                                <Rectangle x:Name="Selectedrect"  Width="20" Height="20" Fill="#FF477EDE" HorizontalAlignment="Right" VerticalAlignment="Top"/>
-                                <Path x:Name="MultiSelectCheck" Margin="0,1,0,0" Fill="White" Width="15" Height="15" Data="M15.3493 0.596191L16.0564 1.3033L5.44979 11.9099L0.146484 6.6066L0.853591 5.89949L5.45004 10.496L15.3493 0.596191Z"
-                                      VerticalAlignment="Center" HorizontalAlignment="Center"
-                                      />
+                            <Grid
+                                x:Name="SelectedIcon"
+                                Margin="12.5,0,0.5,0"
+                                HorizontalAlignment="Left"
+                                VerticalAlignment="Center"
+                                Visibility="Collapsed">
+                                <Rectangle
+                                    x:Name="Selectedrect"
+                                    Width="20"
+                                    Height="20"
+                                    HorizontalAlignment="Right"
+                                    VerticalAlignment="Top"
+                                    Fill="#FF477EDE" />
+                                <Path
+                                    x:Name="MultiSelectCheck"
+                                    Width="15"
+                                    Height="15"
+                                    Margin="0,1,0,0"
+                                    HorizontalAlignment="Center"
+                                    VerticalAlignment="Center"
+                                    Data="M15.3493 0.596191L16.0564 1.3033L5.44979 11.9099L0.146484 6.6066L0.853591 5.89949L5.45004 10.496L15.3493 0.596191Z"
+                                    Fill="White" />
                             </Grid>
-                            <ContentPresenter Margin="15 0 0 0" Content="{TemplateBinding ContentControl.Content}" Grid.Column="1"
-                                      ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
-                                      ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
-                                      HorizontalAlignment="Stretch"
-                                      VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
-                                      SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
+                            <ContentPresenter
+                                Grid.Column="1"
+                                Margin="15,0,0,0"
+                                HorizontalAlignment="Stretch"
+                                VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
+                                Content="{TemplateBinding ContentControl.Content}"
+                                ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
+                                ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
+                                SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                         </Grid>
 
                     </Border>
@@ -111,29 +153,29 @@
                             <MultiTrigger.Conditions>
                                 <Condition Property="UIElement.IsMouseOver" Value="True" />
                             </MultiTrigger.Conditions>
-                            <Setter Property="Panel.Background" TargetName="Bd" Value="#1A000000" />
-                            <Setter Property="Border.BorderBrush" TargetName="Bd" Value="#1A000000" />
+                            <Setter TargetName="Bd" Property="Panel.Background" Value="#1A000000" />
+                            <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A000000" />
                         </MultiTrigger>
                         <MultiTrigger>
                             <MultiTrigger.Conditions>
                                 <Condition Property="Selector.IsSelectionActive" Value="False" />
                                 <Condition Property="Selector.IsSelected" Value="True" />
                             </MultiTrigger.Conditions>
-                            <Setter Property="Panel.Background" TargetName="Bd" Value="#1A477EDE" />
-                            <Setter Property="Border.BorderBrush" TargetName="Bd" Value="#1A477EDE" />
-                            <Setter Property="Grid.Visibility" TargetName="SelectedIcon" Value="Visible"/>
+                            <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
+                            <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
+                            <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />
                         </MultiTrigger>
                         <MultiTrigger>
                             <MultiTrigger.Conditions>
                                 <Condition Property="Selector.IsSelectionActive" Value="True" />
                                 <Condition Property="Selector.IsSelected" Value="True" />
                             </MultiTrigger.Conditions>
-                            <Setter Property="Panel.Background" TargetName="Bd" Value="#1A477EDE" />
-                            <Setter Property="Border.BorderBrush" TargetName="Bd" Value="#1A477EDE" />
-                            <Setter Property="Grid.Visibility" TargetName="SelectedIcon" Value="Visible"/>
+                            <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
+                            <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
+                            <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />
                         </MultiTrigger>
-                        <Trigger Property="UIElement.IsEnabled"  Value="False">
-                            <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
+                        <Trigger Property="UIElement.IsEnabled" Value="False">
+                            <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                         </Trigger>
                     </ControlTemplate.Triggers>
                 </ControlTemplate>
@@ -143,39 +185,33 @@
 
 
     <Style x:Key="FilesGridItemStyle" TargetType="{x:Type ListViewItem}">
-        <Setter Property="UIElement.SnapsToDevicePixels"
-            Value="True" />
-        <Setter Property="Control.Padding"
-            Value="4,1" />
+        <Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
+        <Setter Property="Control.Padding" Value="4,1" />
         <Setter Property="Control.HorizontalContentAlignment">
             <Setter.Value>
-                <Binding Path="HorizontalContentAlignment"
-                     RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
+                <Binding Path="HorizontalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
             </Setter.Value>
         </Setter>
         <Setter Property="Control.VerticalContentAlignment">
             <Setter.Value>
-                <Binding Path="VerticalContentAlignment"
-                     RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
+                <Binding Path="VerticalContentAlignment" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
             </Setter.Value>
         </Setter>
-        <Setter Property="Panel.Background"
-            Value="#00FFFFFF" />
-        <Setter Property="Border.BorderBrush"
-            Value="#00FFFFFF" />
-        <Setter Property="Border.BorderThickness"
-            Value="2" />
+        <Setter Property="Panel.Background" Value="#00FFFFFF" />
+        <Setter Property="Border.BorderBrush" Value="#00FFFFFF" />
+        <Setter Property="Border.BorderThickness" Value="2" />
         <Setter Property="FrameworkElement.FocusVisualStyle">
             <Setter.Value>
                 <Style TargetType="{x:Type IFrameworkInputElement}">
                     <Setter Property="Control.Template">
                         <Setter.Value>
                             <ControlTemplate>
-                                <Rectangle Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
-                                       StrokeThickness="1"
-                                       StrokeDashArray="1 2"
-                                       Margin="2"
-                                       SnapsToDevicePixels="True" />
+                                <Rectangle
+                                    Margin="2"
+                                    SnapsToDevicePixels="True"
+                                    Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
+                                    StrokeDashArray="1 2"
+                                    StrokeThickness="1" />
                             </ControlTemplate>
                         </Setter.Value>
                     </Setter>
@@ -186,24 +222,39 @@
 
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type ListViewItem}">
-                    <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
-                        Padding="{TemplateBinding Control.Padding}" Margin="0,0,12,24"
-                        BorderBrush="{TemplateBinding Border.BorderBrush}"
-                        Background="{TemplateBinding Panel.Background}"
+                    <Border
                         Name="Bd"
+                        Margin="0,0,12,24"
+                        Padding="{TemplateBinding Control.Padding}"
+                        Background="{TemplateBinding Panel.Background}"
+                        BorderBrush="{TemplateBinding Border.BorderBrush}"
+                        BorderThickness="{TemplateBinding Border.BorderThickness}"
                         SnapsToDevicePixels="True">
                         <Grid>
-                            <ContentPresenter Content="{TemplateBinding ContentControl.Content}"
-                                      ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
-                                      ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
-                                      HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
-                                      VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
-                                      SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
-                            <Grid x:Name="SelectedIcon" Visibility="Collapsed" HorizontalAlignment="Right" VerticalAlignment="Top">
-                                <Image Source="pack://application:,,,/Resources/Image/Home/btn_multiselect.png" Width="20" Height="20" RenderOptions.BitmapScalingMode="HighQuality"/>
-                            </Grid>
-                            <Grid x:Name="UnSelectedIcon" Visibility="Collapsed" HorizontalAlignment="Right" VerticalAlignment="Top">
-                                <Rectangle x:Name="UnSelectedrect"  Width="20" Height="20" Fill="#FFE2E3E6" HorizontalAlignment="Right" VerticalAlignment="Top"/>
+                            <ContentPresenter
+                                HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
+                                VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
+                                Content="{TemplateBinding ContentControl.Content}"
+                                ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
+                                ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
+                                SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
+                            <Grid
+                                x:Name="SelectedIcon"
+                                HorizontalAlignment="Right"
+                                VerticalAlignment="Top"
+                                Visibility="Collapsed" />
+                            <Grid
+                                x:Name="UnSelectedIcon"
+                                HorizontalAlignment="Right"
+                                VerticalAlignment="Top"
+                                Visibility="Collapsed">
+                                <Rectangle
+                                    x:Name="UnSelectedrect"
+                                    Width="20"
+                                    Height="20"
+                                    HorizontalAlignment="Right"
+                                    VerticalAlignment="Top"
+                                    Fill="#FFE2E3E6" />
                             </Grid>
                         </Grid>
 
@@ -215,32 +266,32 @@
                                 <Condition Property="Selector.IsSelected" Value="False" />
                             </MultiTrigger.Conditions>
                             <!--<Setter Property="Panel.Background" TargetName="Bd" Value="#1A000000" />-->
-                            <Setter Property="Border.BorderBrush" TargetName="Bd" Value="#FF477EDE" />
-                            <Setter Property="Grid.Visibility" TargetName="UnSelectedIcon" Value="Visible"/>
-                            <Setter Property="Grid.Visibility" TargetName="SelectedIcon" Value="Collapsed"/>
+                            <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#FF477EDE" />
+                            <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Visible" />
+                            <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
                         </MultiTrigger>
                         <MultiTrigger>
                             <MultiTrigger.Conditions>
                                 <Condition Property="Selector.IsSelectionActive" Value="False" />
                                 <Condition Property="Selector.IsSelected" Value="True" />
                             </MultiTrigger.Conditions>
-                            <Setter Property="Panel.Background" TargetName="Bd" Value="#1A477EDE" />
-                            <Setter Property="Border.BorderBrush" TargetName="Bd" Value="#1A477EDE" />
-                            <Setter Property="Grid.Visibility" TargetName="SelectedIcon" Value="Visible"/>
-                            <Setter Property="Grid.Visibility" TargetName="UnSelectedIcon" Value="Collapsed"/>
+                            <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
+                            <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
+                            <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />
+                            <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
                         </MultiTrigger>
                         <MultiTrigger>
                             <MultiTrigger.Conditions>
                                 <Condition Property="Selector.IsSelectionActive" Value="True" />
                                 <Condition Property="Selector.IsSelected" Value="True" />
                             </MultiTrigger.Conditions>
-                            <Setter Property="Panel.Background" TargetName="Bd" Value="#1A477EDE" />
-                            <Setter Property="Border.BorderBrush" TargetName="Bd" Value="#1A477EDE" />
-                            <Setter Property="Grid.Visibility" TargetName="SelectedIcon" Value="Visible"/>
-                            <Setter Property="Grid.Visibility" TargetName="UnSelectedIcon" Value="Collapsed"/>
+                            <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
+                            <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
+                            <Setter TargetName="SelectedIcon" Property="Grid.Visibility" Value="Visible" />
+                            <Setter TargetName="UnSelectedIcon" Property="Grid.Visibility" Value="Collapsed" />
                         </MultiTrigger>
-                        <Trigger Property="UIElement.IsEnabled"  Value="False">
-                            <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
+                        <Trigger Property="UIElement.IsEnabled" Value="False">
+                            <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                         </Trigger>
 
                     </ControlTemplate.Triggers>
@@ -253,9 +304,15 @@
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type ListView}">
-                    <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="1" SnapsToDevicePixels="true">
-                        <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
-                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
+                    <Border
+                        x:Name="Bd"
+                        Padding="1"
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="{TemplateBinding BorderBrush}"
+                        BorderThickness="{TemplateBinding BorderThickness}"
+                        SnapsToDevicePixels="true">
+                        <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
+                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                         </ScrollViewer>
                     </Border>
                 </ControlTemplate>

+ 127 - 0
PDF Office/ViewModels/BottomToolContentViewModel.cs

@@ -51,6 +51,8 @@ namespace PDF_Office.ViewModels
 
         public DelegateCommand<object> PageTextPreviewKeyDownCommand { get; set; }
 
+        public DelegateCommand<object> SelectionChangedCommand { get; set; }
+
         private bool isSingleView;
 
         public bool IsSingleView
@@ -130,6 +132,27 @@ namespace PDF_Office.ViewModels
             }
         }
 
+        private double currenZoom;
+
+        public double CurrentZoom
+        {
+            get { return currenZoom; }
+            set { SetProperty(ref currenZoom, value); }
+        }
+
+        private int selectedIndex;
+
+        public int SelectedIndex
+        {
+            get { return selectedIndex; }
+            set
+            {
+                SetProperty(ref selectedIndex, value);
+            }
+        }
+
+
+
         public CPDFViewer PDFViewer { get; set; }
 
 
@@ -148,9 +171,12 @@ namespace PDF_Office.ViewModels
             NextPageCommand = new DelegateCommand(GoNextPage, CanNextPageExcute).ObservesProperty(() => CurrentPage);
             FirstPageCommand = new DelegateCommand(GoFirstPage, CanPrePageExcute).ObservesProperty(() => CurrentPage);
             LastPageCommand = new DelegateCommand(GoLastPage, CanNextPageExcute).ObservesProperty(() => CurrentPage);
+            ZoomInCommand = new DelegateCommand(ZoomIn, CanZoomIn).ObservesProperty(()=>CurrentZoom);
+            ZoomOutCommand = new DelegateCommand(ZoomOut, CanZoomOut).ObservesProperty(()=>CurrentZoom);
             SetViewModeCommand = new DelegateCommand(SetModeView);
             PageTextKeyDownCommand = new DelegateCommand<object>(PageNumText_KeyDown);
             PageTextPreviewKeyDownCommand = new DelegateCommand<object>(PageNumText_PreviewKeyDown);
+            SelectionChangedCommand = new DelegateCommand<object>(SelectionChangedEvent);
             OpenFullCommand = new DelegateCommand(OpenFullWindow);
         }
 
@@ -172,6 +198,42 @@ namespace PDF_Office.ViewModels
             });
         }
 
+        private void SelectionChangedEvent(object e)
+        {
+            var args = e as SelectionChangedEventArgs;
+            if(args!=null)
+            {
+                if(SelectedIndex<=2)
+                {
+                    switch (SelectedIndex)
+                    {
+                        case 0:
+                            PDFViewer.ChangeFitMode(FitMode.FitSize);
+                            break;
+                        case 1:
+                            PDFViewer.ChangeFitMode(FitMode.FitWidth);
+                            break;
+                        case 2:
+                            PDFViewer.ChangeFitMode(FitMode.FitHeight);
+                            break;
+                        default:
+                            break;
+                    }
+                }
+                else
+                {
+                    if (args.AddedItems[0] is ComboBoxItem)
+                    {
+                        if ((args.AddedItems[0] as ComboBoxItem).Tag != null)
+                        {
+                            PDFViewer.Zoom(Convert.ToDouble((args.AddedItems[0] as ComboBoxItem).Tag.ToString()) / 100.0);
+                        }
+                    }
+                }
+    
+            }
+        }
+
         private void PageNumText_PreviewKeyDown(object e)
         {
             var args = e as KeyEventArgs;
@@ -279,6 +341,64 @@ namespace PDF_Office.ViewModels
             }
         }
 
+        private void ZoomIn()
+        {
+            var zoom = PDFViewer.ZoomFactor*100;
+            if (zoom >= 1 && zoom <= 100)
+            {
+                PDFViewer.Zoom((zoom + 5) / 100.0);
+            }
+            else if (zoom <= 500)
+            {
+                PDFViewer.Zoom((zoom + 50) / 100.0);
+            }
+            else
+            {
+                PDFViewer.Zoom((zoom + 100) / 100.0);
+            }
+        }
+
+        private void ZoomOut()
+        {
+            var zoom = PDFViewer.ZoomFactor*100;
+            if (zoom >= 1 && zoom <= 100)
+            {
+                PDFViewer.Zoom((zoom - 5)/100.0);
+            }
+            else if (zoom <= 500)
+            {
+                PDFViewer.Zoom((zoom - 50) / 100.0);
+            }
+            else
+            {
+                PDFViewer.Zoom((zoom - 100) / 100.0);
+            }
+        }
+
+        private bool CanZoomIn()
+        {
+            if (PDFViewer != null)
+            {
+                if (PDFViewer.ZoomFactor*100 >=1000)
+                    return false;
+                else
+                    return true;
+            }
+            return false;
+        }
+
+        private bool CanZoomOut()
+        {
+            if (PDFViewer != null)
+            {
+                if (PDFViewer.ZoomFactor*100 <=1)
+                    return false;
+                else
+                    return true;
+            }
+            return false;
+        }
+
 
         private void LoadControl()
         {
@@ -287,9 +407,11 @@ namespace PDF_Office.ViewModels
                 PDFViewer = App.mainWindowViewModel.CurrentPDFViewer;
                 if (PDFViewer != null)
                 {
+                    //获取页面设置等信息
                     PageCount = PDFViewer.Document.PageCount;
                     GetModeView(PDFViewer.ModeView);
                     CurrentPage = PDFViewer.CurrentIndex+1;
+                    CurrentZoom = PDFViewer.ZoomFactor*100;
                     PDFViewer.InfoChanged += PDFViewer_InfoChanged;
                 }
 
@@ -306,6 +428,11 @@ namespace PDF_Office.ViewModels
             {
                 GetModeView((ViewMode)e.Value);
             }
+            if(e.Key=="Zoom")
+            {
+                CurrentZoom = (double)e.Value*100;
+                SelectedIndex = -1;
+            }
         }
 
         private void GetModeView(ViewMode mode)

+ 5 - 0
PDF Office/ViewModels/HomeContentViewModel.cs

@@ -64,6 +64,11 @@ namespace PDF_Office.ViewModels
             ToolRegionName = Guid.NewGuid().ToString();
             OpenFileCommand = new DelegateCommand(OpenFile);
             ShowToolCommand = new DelegateCommand<string>(ShowToolContent);
+
+            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+            {
+                toolregion.RequestNavigate(ToolRegionName, "Guid");
+            }));
         }
 
         /// <summary>

File diff suppressed because it is too large
+ 123 - 1
PDF Office/Views/BottomToolContent.xaml