Browse Source

样式-补充弹窗样式文件,弹窗自定义控件

ZhouJieSheng 2 years ago
parent
commit
dce9230b87

+ 8 - 5
PDF Office/App.xaml

@@ -10,19 +10,22 @@
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/TabControlStyle.xaml" />
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/TabControlStyle.xaml" />
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/ComboxStyle.xaml" />
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/ComboxStyle.xaml" />
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/ListBoxStyle.xaml" />
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/ListBoxStyle.xaml" />
+                <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/WindowsStyle.xaml" />
+                <!--  Enable show customctrol's correctly UI in Xaml Designer  -->
+                <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Themes/Generic.xaml" />
             </ResourceDictionary.MergedDictionaries>
             </ResourceDictionary.MergedDictionaries>
 
 
             <Style TargetType="{x:Type Hyperlink}">
             <Style TargetType="{x:Type Hyperlink}">
-                <Setter Property="Foreground" Value="#477EDE"></Setter>
-                <Setter Property="TextBlock.TextDecorations" Value="{x:Null}"></Setter>
+                <Setter Property="Foreground" Value="#477EDE" />
+                <Setter Property="TextBlock.TextDecorations" Value="{x:Null}" />
                 <Style.Triggers>
                 <Style.Triggers>
                     <Trigger Property="IsMouseOver" Value="True">
                     <Trigger Property="IsMouseOver" Value="True">
-                        <Setter Property="Foreground" Value="#6B97E4"></Setter>
-                        <!--在鼠标悬停显示下划线-->
+                        <Setter Property="Foreground" Value="#6B97E4" />
+                        <!--  在鼠标悬停显示下划线  -->
                         <Setter Property="TextBlock.TextDecorations">
                         <Setter Property="TextBlock.TextDecorations">
                             <Setter.Value>
                             <Setter.Value>
                                 <TextDecorationCollection>
                                 <TextDecorationCollection>
-                                    <TextDecoration Location="Underline"/>
+                                    <TextDecoration Location="Underline" />
                                 </TextDecorationCollection>
                                 </TextDecorationCollection>
                             </Setter.Value>
                             </Setter.Value>
                         </Setter>
                         </Setter>

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

@@ -23,6 +23,7 @@ using PDF_Office.Model;
 using PDF_Office.Views.PageEdit;
 using PDF_Office.Views.PageEdit;
 using PDF_Office.Properties;
 using PDF_Office.Properties;
 using PDFSettings.Settings;
 using PDFSettings.Settings;
+using PDF_Office.Views.Dialog.PageEditDialogs;
 
 
 namespace PDF_Office
 namespace PDF_Office
 {
 {
@@ -97,6 +98,9 @@ namespace PDF_Office
             //注册弹窗
             //注册弹窗
             containerRegistry.RegisterDialog<VerifyPassWordDialog>(DialogNames.VerifyPassWordDialog);
             containerRegistry.RegisterDialog<VerifyPassWordDialog>(DialogNames.VerifyPassWordDialog);
             containerRegistry.RegisterDialog<FullScreenWindow>(DialogNames.FullScreenDialog);
             containerRegistry.RegisterDialog<FullScreenWindow>(DialogNames.FullScreenDialog);
+            containerRegistry.RegisterDialog<InsertDialog>(DialogNames.InsertDialog);
+            containerRegistry.RegisterDialog<SplitDialog>(DialogNames.SplitDialog);
+            containerRegistry.RegisterDialog<ExtractDialog>(DialogNames.ExtractDialog);
         }
         }
 
 
         protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)
         protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)

+ 10 - 0
PDF Office/PDF Office.csproj

@@ -113,6 +113,7 @@
       <DependentUpon>AlertsMessage.xaml</DependentUpon>
       <DependentUpon>AlertsMessage.xaml</DependentUpon>
     </Compile>
     </Compile>
     <Compile Include="CustomControl\CustomIconToggleBtn.cs" />
     <Compile Include="CustomControl\CustomIconToggleBtn.cs" />
+    <Compile Include="CustomControl\DialogContent.cs" />
     <Compile Include="CustomControl\IconAndTextTabItem.cs" />
     <Compile Include="CustomControl\IconAndTextTabItem.cs" />
     <Compile Include="CustomControl\ListBoxItemToolBar.cs" />
     <Compile Include="CustomControl\ListBoxItemToolBar.cs" />
     <Compile Include="CustomControl\MessageBoxEx.cs" />
     <Compile Include="CustomControl\MessageBoxEx.cs" />
@@ -131,6 +132,7 @@
     <Compile Include="CustomControl\LoadingControl.xaml.cs">
     <Compile Include="CustomControl\LoadingControl.xaml.cs">
       <DependentUpon>LoadingControl.xaml</DependentUpon>
       <DependentUpon>LoadingControl.xaml</DependentUpon>
     </Compile>
     </Compile>
+    <Compile Include="Model\PageEdit\ExtractModel.cs" />
     <Compile Include="Model\PageEdit\PageEditItem.cs" />
     <Compile Include="Model\PageEdit\PageEditItem.cs" />
     <Compile Include="Model\ParameterNames.cs" />
     <Compile Include="Model\ParameterNames.cs" />
     <Compile Include="Model\PDFTool\ToolItem.cs" />
     <Compile Include="Model\PDFTool\ToolItem.cs" />
@@ -261,6 +263,14 @@
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>
     </Page>
     </Page>
+    <Page Include="Styles\WindowsStyle.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Themes\Generic.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Views\BOTA\BOTAContent.xaml">
     <Page Include="Views\BOTA\BOTAContent.xaml">
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>

+ 92 - 0
PDF Office/Styles/WindowsStyle.xaml

@@ -0,0 +1,92 @@
+<ResourceDictionary
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:prism="http://prismlibrary.com/">
+    <Style x:Key="WindowStyle" TargetType="{x:Type Window}">
+        <Setter Property="WindowChrome.WindowChrome">
+            <Setter.Value>
+                <WindowChrome
+                    CaptionHeight="32"
+                    CornerRadius="10"
+                    GlassFrameThickness="-1"
+                    ResizeBorderThickness="5"
+                    UseAeroCaptionButtons="False" />
+            </Setter.Value>
+        </Setter>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type Window}">
+                    <Border
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="{TemplateBinding BorderBrush}"
+                        BorderThickness="{TemplateBinding BorderThickness}">
+                        <AdornerDecorator>
+                            <ContentPresenter x:Name="win_content" />
+                        </AdornerDecorator>
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="WindowState" Value="Maximized">
+                            <!--  调整边框  -->
+                            <Setter TargetName="win_content" Property="Margin" Value="5,5,5,5" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+
+    <Style x:Key="WindowWithCorderStyle" TargetType="{x:Type Window}">
+        <Setter Property="WindowChrome.WindowChrome">
+            <Setter.Value>
+                <WindowChrome
+                    CaptionHeight="48"
+                    CornerRadius="15"
+                    GlassFrameThickness="-1"
+                    ResizeBorderThickness="5"
+                    UseAeroCaptionButtons="False" />
+            </Setter.Value>
+        </Setter>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type Window}">
+                    <Border
+                        Margin="20"
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="{TemplateBinding BorderBrush}"
+                        BorderThickness="{TemplateBinding BorderThickness}"
+                        CornerRadius="8">
+                        <AdornerDecorator>
+                            <ContentPresenter x:Name="win_content" />
+                        </AdornerDecorator>
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="WindowState" Value="Maximized">
+                            <!--  调整边框  -->
+                            <Setter TargetName="win_content" Property="Margin" Value="5,5,5,5" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+
+    <!--  弹窗的窗体样式  -->
+    <Style
+        x:Key="DialogWindowStyle"
+        BasedOn="{StaticResource WindowWithCorderStyle}"
+        TargetType="{x:Type Window}">
+        <Setter Property="WindowStyle" Value="None" />
+        <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterOwner" />
+        <Setter Property="SizeToContent" Value="WidthAndHeight" />
+        <Setter Property="ShowInTaskbar" Value="False" />
+        <Setter Property="ResizeMode" Value="NoResize" />
+        <Setter Property="Padding" Value="0" />
+        <Setter Property="BorderThickness" Value="1" />
+        <Setter Property="BorderBrush">
+            <Setter.Value>
+                <SolidColorBrush Opacity="0.3" Color="Gray" />
+            </Setter.Value>
+        </Setter>
+        <Setter Property="Background" Value="Transparent" />
+    </Style>
+</ResourceDictionary>

+ 43 - 0
PDF Office/Themes/Generic.xaml

@@ -0,0 +1,43 @@
+<ResourceDictionary
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+    xmlns:local="clr-namespace:PDF_Office">
+
+    <!--  style for customControl  -->
+    <Style TargetType="{x:Type cus:DialogContent}">
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type cus:DialogContent}">
+                    <Border Background="White" CornerRadius="8">
+                        <Grid Background="Transparent">
+                            <Grid.RowDefinitions>
+                                <RowDefinition Height="48" />
+                                <RowDefinition Height="*" />
+                                <RowDefinition Height="64" />
+                            </Grid.RowDefinitions>
+                            <Border Background="Transparent" BorderThickness="0,0,0,1">
+                                <Border.BorderBrush>
+                                    <SolidColorBrush Opacity="0.2" Color="Gray" />
+                                </Border.BorderBrush>
+                                <TextBlock
+                                    Margin="16,0,0,0"
+                                    VerticalAlignment="Center"
+                                    FontSize="16"
+                                    FontWeight="SemiBold"
+                                    Text="{TemplateBinding Header}" />
+                            </Border>
+                            <ContentPresenter Grid.Row="1" Content="{TemplateBinding Content}" />
+                            <Border Grid.Row="2" BorderThickness="0,1,0,0">
+                                <Border.BorderBrush>
+                                    <SolidColorBrush Opacity="0.2" Color="Gray" />
+                                </Border.BorderBrush>
+                                <ContentControl Content="{TemplateBinding BottmBar}" />
+                            </Border>
+                        </Grid>
+                    </Border>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+</ResourceDictionary>

+ 32 - 53
PDF Office/Views/Dialog/PageEditDialogs/ExtractDialog.xaml

@@ -2,45 +2,22 @@
     x:Class="PDF_Office.Views.Dialog.PageEditDialogs.ExtractDialog"
     x:Class="PDF_Office.Views.Dialog.PageEditDialogs.ExtractDialog"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
     xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:pageeditdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.PageEditDialogs"
     xmlns:prism="http://prismlibrary.com/"
     xmlns:prism="http://prismlibrary.com/"
     Width="320"
     Width="320"
     Height="208"
     Height="208"
+    d:DataContext="{d:DesignInstance Type=pageeditdialogs:ExtractDialogViewModel}"
     d:DesignHeight="450"
     d:DesignHeight="450"
     d:DesignWidth="800"
     d:DesignWidth="800"
+    prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
     prism:ViewModelLocator.AutoWireViewModel="True"
     prism:ViewModelLocator.AutoWireViewModel="True"
     mc:Ignorable="d">
     mc:Ignorable="d">
-    <prism:Dialog.WindowStyle>
-        <Style TargetType="{x:Type Window}">
-            <Setter Property="WindowStyle" Value="None" />
-            <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterOwner" />
-        </Style>
-    </prism:Dialog.WindowStyle>
-    <Border Background="White" CornerRadius="8">
-        <Grid>
-            <Grid.RowDefinitions>
-                <RowDefinition Height="48" />
-                <RowDefinition />
-                <RowDefinition Height="64" />
-            </Grid.RowDefinitions>
-
-            <Border
-                Height="48"
-                VerticalAlignment="Center"
-                BorderThickness="0,0,0,1">
-                <Border.BorderBrush>
-                    <SolidColorBrush Opacity="0.8" Color="White" />
-                </Border.BorderBrush>
-                <TextBlock
-                    Margin="16,0"
-                    VerticalAlignment="Center"
-                    FontSize="16"
-                    FontWeight="SemiBold"
-                    Text="提取页面" />
-            </Border>
-
+    <cus:DialogContent Header="提取页面">
+        <cus:DialogContent.Content>
             <StackPanel
             <StackPanel
                 Grid.Row="1"
                 Grid.Row="1"
                 Margin="16,0"
                 Margin="16,0"
@@ -49,29 +26,31 @@
                     Margin="0,18"
                     Margin="0,18"
                     VerticalAlignment="Center"
                     VerticalAlignment="Center"
                     Content="每个页面作为单独页面"
                     Content="每个页面作为单独页面"
-                    FontSize="14" />
-                <CheckBox Content="提取后删除页面" FontSize="14" />
+                    FontSize="14"
+                    IsChecked="{Binding Model.IsEveryPageToFile, Mode=TwoWay}" />
+                <CheckBox
+                    Content="提取后删除页面"
+                    FontSize="14"
+                    IsChecked="{Binding Model.IsDeleteAfterExtract, Mode=TwoWay}" />
             </StackPanel>
             </StackPanel>
-            <Border Grid.Row="2" BorderThickness="0,1,0,0">
-                <Border.BorderBrush>
-                    <SolidColorBrush Opacity="0.8" Color="White" />
-                </Border.BorderBrush>
-                <Grid>
-                    <Button
-                        Width="98"
-                        Height="32"
-                        Margin="0,0,124,0"
-                        HorizontalAlignment="Right"
-                        Content="取消"
-                        Visibility="Visible" />
-                    <Button
-                        Width="98"
-                        Height="32"
-                        Margin="16,0"
-                        HorizontalAlignment="Right"
-                        Content="插入" />
-                </Grid>
-            </Border>
-        </Grid>
-    </Border>
+        </cus:DialogContent.Content>
+        <cus:DialogContent.BottmBar>
+            <Grid>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="0,0,124,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding ExtractCommnad}"
+                    Content="提取" />
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding CancelCommand}"
+                    Content="取消" />
+            </Grid>
+        </cus:DialogContent.BottmBar>
+    </cus:DialogContent>
 </UserControl>
 </UserControl>

+ 68 - 87
PDF Office/Views/Dialog/PageEditDialogs/InsertDialog.xaml

@@ -2,103 +2,84 @@
     x:Class="PDF_Office.Views.Dialog.PageEditDialogs.InsertDialog"
     x:Class="PDF_Office.Views.Dialog.PageEditDialogs.InsertDialog"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
     xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:pageeditdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.PageEditDialogs"
     xmlns:prism="http://prismlibrary.com/"
     xmlns:prism="http://prismlibrary.com/"
     Width="480"
     Width="480"
     Height="472"
     Height="472"
+    d:DataContext="{d:DesignInstance Type=pageeditdialogs:InsertDialogViewModel}"
     d:DesignHeight="450"
     d:DesignHeight="450"
     d:DesignWidth="800"
     d:DesignWidth="800"
+    prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
     prism:ViewModelLocator.AutoWireViewModel="True"
     prism:ViewModelLocator.AutoWireViewModel="True"
     mc:Ignorable="d">
     mc:Ignorable="d">
-    <prism:Dialog.WindowStyle>
-        <Style TargetType="{x:Type Window}">
-            <Setter Property="WindowStyle" Value="None" />
-            <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterOwner" />
-        </Style>
-    </prism:Dialog.WindowStyle>
-    <Border Background="White" CornerRadius="8">
-        <Grid>
-            <Grid.RowDefinitions>
-                <RowDefinition Height="48" />
-                <RowDefinition />
-                <RowDefinition Height="auto" />
-                <RowDefinition Height="auto" />
-                <RowDefinition Height="64" />
-            </Grid.RowDefinitions>
-
-            <Border
-                VerticalAlignment="Center"
-                BorderThickness="0,0,0,1"
-                MouseMove="Border_MouseMove">
-                <Border.BorderBrush>
-                    <SolidColorBrush Opacity="0.8" Color="White" />
-                </Border.BorderBrush>
-                <TextBlock
-                    Margin="16,0"
-                    FontSize="16"
-                    FontWeight="SemiBold"
-                    Text="插入自定义页面" />
-            </Border>
-
-            <ListBox Grid.Row="1" />
-
-            <StackPanel Grid.Row="2" Margin="16,0">
-                <TextBlock
-                    FontSize="14"
-                    FontWeight="SemiBold"
-                    Text="页面大小" />
-                <RadioButton Margin="0,12,0,0" Content="当前页" />
-                <StackPanel Margin="0,12" Orientation="Horizontal">
-                    <RadioButton VerticalAlignment="Center" Content="标准" />
-                    <ComboBox Margin="8,0" />
-                </StackPanel>
-                <StackPanel Margin="0,0,0,12" Orientation="Horizontal">
-                    <RadioButton VerticalAlignment="Center" Content="自定义" />
-                    <TextBox
-                        Width="80"
-                        Height="32"
-                        Margin="8,0"
-                        VerticalAlignment="Center" />
-                    <TextBlock VerticalAlignment="Center" Text="X" />
-                    <TextBox
-                        Width="80"
-                        Height="32"
-                        Margin="8,0"
-                        VerticalAlignment="Center" />
-                    <ComboBox Width="80" />
+    <cus:DialogContent Header="插入自定义页面">
+        <cus:DialogContent.Content>
+            <Grid>
+                <Grid.RowDefinitions>
+                    <RowDefinition />
+                    <RowDefinition Height="auto" />
+                    <RowDefinition Height="auto" />
+                </Grid.RowDefinitions>
+                <ListBox />
+                <StackPanel Grid.Row="1" Margin="16,0">
+                    <TextBlock
+                        FontSize="14"
+                        FontWeight="SemiBold"
+                        Text="页面大小" />
+                    <RadioButton Margin="0,12,0,0" Content="当前页" />
+                    <StackPanel Margin="0,12" Orientation="Horizontal">
+                        <RadioButton VerticalAlignment="Center" Content="标准" />
+                        <ComboBox Margin="8,0" />
+                    </StackPanel>
+                    <StackPanel Margin="0,0,0,12" Orientation="Horizontal">
+                        <RadioButton VerticalAlignment="Center" Content="自定义" />
+                        <TextBox
+                            Width="80"
+                            Height="32"
+                            Margin="8,0"
+                            VerticalAlignment="Center" />
+                        <TextBlock VerticalAlignment="Center" Text="X" />
+                        <TextBox
+                            Width="80"
+                            Height="32"
+                            Margin="8,0"
+                            VerticalAlignment="Center" />
+                        <ComboBox Width="80" />
+                    </StackPanel>
                 </StackPanel>
                 </StackPanel>
-            </StackPanel>
-            <StackPanel Grid.Row="3" Margin="16,0">
-                <TextBlock
-                    FontSize="14"
-                    FontWeight="SemiBold"
-                    Text="方向" />
-                <StackPanel Orientation="Horizontal">
-                    <RadioButton Margin="0,12,0,16" Content="纵向页面" />
-                    <RadioButton Margin="24,12,0,16" Content="横向页面" />
+                <StackPanel Grid.Row="2" Margin="16,0">
+                    <TextBlock
+                        FontSize="14"
+                        FontWeight="SemiBold"
+                        Text="方向" />
+                    <StackPanel Orientation="Horizontal">
+                        <RadioButton Margin="0,12,0,16" Content="纵向页面" />
+                        <RadioButton Margin="24,12,0,16" Content="横向页面" />
+                    </StackPanel>
                 </StackPanel>
                 </StackPanel>
-            </StackPanel>
-            <Border Grid.Row="4" BorderThickness="0,1,0,0">
-                <Border.BorderBrush>
-                    <SolidColorBrush Opacity="0.8" Color="White" />
-                </Border.BorderBrush>
-                <Grid>
-                    <Button
-                        Width="98"
-                        Height="32"
-                        Margin="124,0"
-                        HorizontalAlignment="Right"
-                        Content="取消" />
-                    <Button
-                        Width="98"
-                        Height="32"
-                        Margin="16,0"
-                        HorizontalAlignment="Right"
-                        Content="插入" />
-                </Grid>
-            </Border>
-        </Grid>
-    </Border>
+            </Grid>
+        </cus:DialogContent.Content>
+        <cus:DialogContent.BottmBar>
+            <Grid>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding CancelCommnad}"
+                    Content="取消" />
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="124,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding InsertCommnad}"
+                    Content="插入" />
+            </Grid>
+        </cus:DialogContent.BottmBar>
+    </cus:DialogContent>
 </UserControl>
 </UserControl>

+ 87 - 103
PDF Office/Views/Dialog/PageEditDialogs/SplitDialog.xaml

@@ -2,123 +2,107 @@
     x:Class="PDF_Office.Views.Dialog.PageEditDialogs.SplitDialog"
     x:Class="PDF_Office.Views.Dialog.PageEditDialogs.SplitDialog"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
     xmlns:local="clr-namespace:PDF_Office.Views.Dialog.PageEditDialogs"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:pageeditdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.PageEditDialogs"
     xmlns:prism="http://prismlibrary.com/"
     xmlns:prism="http://prismlibrary.com/"
     Width="480"
     Width="480"
     Height="481"
     Height="481"
+    d:DataContext="{d:DesignInstance Type=pageeditdialogs:SplitDialogViewModel}"
     d:DesignHeight="450"
     d:DesignHeight="450"
     d:DesignWidth="800"
     d:DesignWidth="800"
+    prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
     prism:ViewModelLocator.AutoWireViewModel="True"
     prism:ViewModelLocator.AutoWireViewModel="True"
     mc:Ignorable="d">
     mc:Ignorable="d">
-    <prism:Dialog.WindowStyle>
-        <Style TargetType="{x:Type Window}">
-            <Setter Property="WindowStyle" Value="None" />
-            <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterOwner" />
-        </Style>
-    </prism:Dialog.WindowStyle>
-    <Border Background="White" CornerRadius="8">
-        <Grid>
-            <Grid.RowDefinitions>
-                <RowDefinition Height="48" />
-                <RowDefinition Height="*" />
-                <RowDefinition Height="auto" />
-                <RowDefinition Height="64" />
-            </Grid.RowDefinitions>
-
-            <Border VerticalAlignment="Center" BorderThickness="0,0,0,1">
-                <Border.BorderBrush>
-                    <SolidColorBrush Opacity="0.8" Color="White" />
-                </Border.BorderBrush>
-                <TextBlock
-                    Margin="16,0"
-                    FontSize="16"
-                    FontWeight="SemiBold"
-                    Text="拆分页面" />
-            </Border>
-
-            <StackPanel Grid.Row="1" Margin="16,0">
-                <TextBlock
-                    FontSize="14"
-                    FontWeight="SemiBold"
-                    Text="拆分方式" />
-                <StackPanel Orientation="Horizontal">
-                    <RadioButton Margin="0,12,0,0" Content="平均每" />
-                    <TextBox
-                        Width="110"
-                        Height="32"
-                        Margin="8,0" />
-                    <TextBlock VerticalAlignment="Center" Text="页拆分为一个PDF文件" />
-                </StackPanel>
-                <StackPanel Margin="0,12" Orientation="Horizontal">
-                    <RadioButton VerticalAlignment="Center" Content="平均拆分为" />
-                    <ComboBox Width="110" Margin="8,0" />
-                    <TextBlock VerticalAlignment="Center" Text="个PDF文件" />
-                </StackPanel>
-                <StackPanel Margin="0,0,0,12" Orientation="Horizontal">
-                    <RadioButton VerticalAlignment="Center" Content="按页面范围拆分" />
-                    <ComboBox Width="110" Margin="8,0" />
-                </StackPanel>
-            </StackPanel>
-            <StackPanel Grid.Row="2" Margin="16,0">
-                <TextBlock
-                    FontSize="14"
-                    FontWeight="SemiBold"
-                    Text="文档命名" />
-                <TextBox
-                    Width="346"
-                    Height="32"
-                    HorizontalAlignment="Left" />
-                <CheckBox Margin="0,6" Content="将原始文档名前置" />
-
-
-                <StackPanel Orientation="Horizontal">
-                    <CheckBox
-                        Width="{Binding ElementName=ChkSeparator, Path=ActualWidth}"
-                        Margin="0,6"
-                        Content="标签" />
-                    <TextBox
-                        Width="110"
-                        Height="32"
-                        Margin="16,0" />
+    <cus:DialogContent Header="拆分页面">
+        <cus:DialogContent.Content>
+            <Grid>
+                <Grid.RowDefinitions>
+                    <RowDefinition />
+                    <RowDefinition />
+                </Grid.RowDefinitions>
+                <StackPanel Margin="16,0">
+                    <TextBlock
+                        FontSize="14"
+                        FontWeight="SemiBold"
+                        Text="拆分方式" />
+                    <StackPanel Orientation="Horizontal">
+                        <RadioButton Margin="0,12,0,0" Content="平均每" />
+                        <TextBox
+                            Width="110"
+                            Height="32"
+                            Margin="8,0" />
+                        <TextBlock VerticalAlignment="Center" Text="页拆分为一个PDF文件" />
+                    </StackPanel>
+                    <StackPanel Margin="0,12" Orientation="Horizontal">
+                        <RadioButton VerticalAlignment="Center" Content="平均拆分为" />
+                        <ComboBox Width="110" Margin="8,0" />
+                        <TextBlock VerticalAlignment="Center" Text="个PDF文件" />
+                    </StackPanel>
+                    <StackPanel Margin="0,0,0,12" Orientation="Horizontal">
+                        <RadioButton VerticalAlignment="Center" Content="按页面范围拆分" />
+                        <ComboBox Width="110" Margin="8,0" />
+                    </StackPanel>
                 </StackPanel>
                 </StackPanel>
-                <StackPanel Orientation="Horizontal">
-                    <CheckBox
-                        Name="ChkSeparator"
-                        Margin="0,6"
-                        Content="分隔符" />
+                <StackPanel Grid.Row="1" Margin="16,0">
+                    <TextBlock
+                        FontSize="14"
+                        FontWeight="SemiBold"
+                        Text="文档命名" />
                     <TextBox
                     <TextBox
-                        Width="110"
+                        Width="346"
                         Height="32"
                         Height="32"
-                        Margin="16,0" />
-                </StackPanel>
+                        HorizontalAlignment="Left" />
+                    <CheckBox Margin="0,6" Content="将原始文档名前置" />
+
 
 
+                    <StackPanel Orientation="Horizontal">
+                        <CheckBox
+                            Width="{Binding ElementName=ChkSeparator, Path=ActualWidth}"
+                            Margin="0,6"
+                            Content="标签" />
+                        <TextBox
+                            Width="110"
+                            Height="32"
+                            Margin="16,0" />
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal">
+                        <CheckBox
+                            Name="ChkSeparator"
+                            Margin="0,6"
+                            Content="分隔符" />
+                        <TextBox
+                            Width="110"
+                            Height="32"
+                            Margin="16,0" />
+                    </StackPanel>
 
 
-                <StackPanel Orientation="Horizontal">
-                    <RadioButton Margin="0,12,0,16" Content="纵向页面" />
-                    <RadioButton Margin="24,12,0,16" Content="横向页面" />
+                    <StackPanel Orientation="Horizontal">
+                        <RadioButton Margin="0,12,0,16" Content="纵向页面" />
+                        <RadioButton Margin="24,12,0,16" Content="横向页面" />
+                    </StackPanel>
                 </StackPanel>
                 </StackPanel>
-            </StackPanel>
-            <Border Grid.Row="3" BorderThickness="0,1,0,0">
-                <Border.BorderBrush>
-                    <SolidColorBrush Opacity="0.8" Color="White" />
-                </Border.BorderBrush>
-                <Grid>
-                    <Button
-                        Width="98"
-                        Height="32"
-                        Margin="124,0"
-                        HorizontalAlignment="Right"
-                        Content="取消" />
-                    <Button
-                        Width="98"
-                        Height="32"
-                        Margin="16,0"
-                        HorizontalAlignment="Right"
-                        Content="插入" />
-                </Grid>
-            </Border>
-        </Grid>
-    </Border>
+            </Grid>
+        </cus:DialogContent.Content>
+        <cus:DialogContent.BottmBar>
+            <Grid>
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding CancelCommand}"
+                    Content="取消" />
+                <Button
+                    Width="98"
+                    Height="32"
+                    Margin="124,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding SplitCommnad}"
+                    Content="拆分" />
+            </Grid>
+        </cus:DialogContent.BottmBar>
+    </cus:DialogContent>
 </UserControl>
 </UserControl>

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

@@ -17,7 +17,7 @@
     prism:ViewModelLocator.AutoWireViewModel="True"
     prism:ViewModelLocator.AutoWireViewModel="True"
     Activated="Window_Activated"
     Activated="Window_Activated"
     Closed="Window_Closed"
     Closed="Window_Closed"
-    Style="{DynamicResource WindowStyle}"
+    Style="{StaticResource WindowStyle}"
     UseLayoutRounding="True"
     UseLayoutRounding="True"
     WindowStartupLocation="CenterScreen"
     WindowStartupLocation="CenterScreen"
     mc:Ignorable="d">
     mc:Ignorable="d">
@@ -121,39 +121,6 @@
                     </Setter.Value>
                     </Setter.Value>
                 </Setter>
                 </Setter>
             </Style>
             </Style>
-
-            <Style x:Key="WindowStyle" TargetType="{x:Type Window}">
-                <Setter Property="WindowChrome.WindowChrome">
-                    <Setter.Value>
-                        <WindowChrome
-                            CaptionHeight="32"
-                            CornerRadius="10"
-                            GlassFrameThickness="-1"
-                            ResizeBorderThickness="5"
-                            UseAeroCaptionButtons="False" />
-                    </Setter.Value>
-                </Setter>
-                <Setter Property="Template">
-                    <Setter.Value>
-                        <ControlTemplate TargetType="{x:Type Window}">
-                            <Border
-                                Background="{TemplateBinding Background}"
-                                BorderBrush="{TemplateBinding BorderBrush}"
-                                BorderThickness="{TemplateBinding BorderThickness}">
-                                <AdornerDecorator>
-                                    <ContentPresenter x:Name="win_content" />
-                                </AdornerDecorator>
-                            </Border>
-                            <ControlTemplate.Triggers>
-                                <Trigger Property="WindowState" Value="Maximized">
-                                    <!--  调整边框  -->
-                                    <Setter TargetName="win_content" Property="Margin" Value="5,5,5,5" />
-                                </Trigger>
-                            </ControlTemplate.Triggers>
-                        </ControlTemplate>
-                    </Setter.Value>
-                </Setter>
-            </Style>
         </ResourceDictionary>
         </ResourceDictionary>
     </Window.Resources>
     </Window.Resources>
     <Border>
     <Border>