Browse Source

综合-修复首页部分问题

ZhouJieSheng 2 years ago
parent
commit
6e2bd8c7e8

+ 2 - 2
PDF Office/App.xaml

@@ -692,7 +692,8 @@
                         Style="{StaticResource ComboBoxToggleButton}" />
                     <Border
                         x:Name="border"
-                        Margin="{TemplateBinding BorderThickness}"
+                        Margin="4 1 8 1"
+                        HorizontalAlignment="Left"
                         Background="{StaticResource TextBox.Static.Background}">
                         <TextBox
                             x:Name="PART_EditableTextBox"
@@ -748,7 +749,6 @@
                 <Style.Triggers>
                     <Trigger Property="IsEditable" Value="true">
                         <Setter Property="IsTabStop" Value="false" />
-                        <Setter Property="Padding" Value="2" />
                         <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}" />
                     </Trigger>
                 </Style.Triggers>

+ 5 - 1
PDF Office/CustomControl/AlertsMessage.xaml.cs

@@ -73,7 +73,11 @@ namespace PDF_Office.CustomControl
             BtnGrid.ColumnDefinitions.Add(column);
             BtnGrid.ColumnDefinitions.Add(column2);
 
-            ShowDialog();
+            if (ownerWindow != null)
+            {
+                this.Owner = ownerWindow;
+                ShowDialog();
+            }
         }
 
 

+ 4 - 0
PDF Office/Styles/ExpanderStyle.xaml

@@ -52,8 +52,12 @@
 
     <Style x:Key="PromotionExpanderStyle" TargetType="{x:Type Expander}">
         <Setter Property="Background" Value="Transparent" />
+        <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
         <Setter Property="HorizontalContentAlignment" Value="Stretch" />
         <Setter Property="VerticalContentAlignment" Value="Stretch" />
+        <Setter Property="FontSize" Value="12" />
+        <Setter Property="FontWeight" Value="SemiBold" />
+        <Setter Property="FontFamily" Value="Segoe UI" />
         <Setter Property="BorderBrush" Value="Transparent" />
         <Setter Property="BorderThickness" Value="1" />
         <Setter Property="Template">

+ 1 - 1
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -139,7 +139,7 @@ namespace PDF_Office.ViewModels
             get { return _isInPageEdit; }
             set
             {
-                _isInPageEdit = value;
+                SetProperty(ref _isInPageEdit, value);
                 if (!value)
                 {
                     CanRedo = PDFViewer.UndoManager.CanRedo;

+ 1 - 1
PDF Office/Views/HomeContent.xaml

@@ -81,7 +81,7 @@
                     Initialized="BtnCreatPDF_Initialized"
                     Style="{StaticResource btn.sec}">
                     <Button.ContextMenu>
-                        <ContextMenu Name="ContextCreatePDF">
+                        <ContextMenu Name="ContextCreatePDF" Closed="ContextCreatePDF_Closed">
                             <MenuItem Command="{Binding CreateBlackPDFCommand}" Header="New Blank Page" />
                             <MenuItem
                                 Command="{Binding CreateFromHtmlCommnd}"

+ 15 - 1
PDF Office/Views/HomeContent.xaml.cs

@@ -33,6 +33,8 @@ namespace PDF_Office.Views
     /// </summary>
     public partial class HomeContent : UserControl
     {
+
+        private bool IsContextMenuOpen = false;
        
         public HomeContent()
         {
@@ -68,7 +70,19 @@ namespace PDF_Office.Views
         {
             ContextCreatePDF.PlacementTarget = BtnCreatPDF;
             ContextCreatePDF.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
-            ContextCreatePDF.IsOpen = true;
+            IsContextMenuOpen = !IsContextMenuOpen;
+            ContextCreatePDF.IsOpen = IsContextMenuOpen;
+        }
+
+        private void ContextCreatePDF_Closed(object sender, RoutedEventArgs e)
+        {
+            var visual = VisualTreeHelper.HitTest(BtnExpand, Mouse.GetPosition(BtnExpand));
+            if (visual == null)
+            {
+                //点击其他地方引起的下拉框收取,猜需要更改按钮状态,
+                //如果是点击按钮造成的下拉框收起,则不需要更改按钮状态(如果改了,会出现每次缓慢点击按钮都展开下拉框的现象)
+                IsContextMenuOpen = false;
+            }
         }
     }
 }

+ 64 - 54
PDF Office/Views/HomePanel/PromotionContent.xaml

@@ -7,6 +7,7 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     d:DesignHeight="450"
     d:DesignWidth="800"
+    Background="{StaticResource color.sys.layout.mg}"
     SizeChanged="UserControl_SizeChanged"
     mc:Ignorable="d">
     <UserControl.Resources>
@@ -17,8 +18,8 @@
             </ResourceDictionary.MergedDictionaries>
             <DataTemplate x:Key="PromotionDataTemplate">
                 <StackPanel
-                    Margin="0,10,0,10"
-                    Background="White"
+                    Height="32"
+                    Background="Transparent"
                     Cursor="Hand"
                     Orientation="Horizontal">
                     <Image
@@ -27,74 +28,83 @@
                         Margin="0,0,10,0"
                         Source="{Binding ImagePath}" />
                     <TextBlock
+                        VerticalAlignment="Center"
                         FontSize="14"
-                        Foreground="#6B6F7D"
+                        Foreground="{StaticResource color.sys.text.neutral.lv2}"
                         Text="{Binding Content}" />
                 </StackPanel>
             </DataTemplate>
         </ResourceDictionary>
     </UserControl.Resources>
     <ScrollViewer VerticalScrollBarVisibility="Auto">
-        <StackPanel Background="{StaticResource color.sys.layout.mg}">
-            <Expander
-                x:Name="PDFProSeriesExpander"
-                Margin="20,20,0,0"
-                Style="{StaticResource PromotionExpanderStyle}">
-                <Expander.Header>
-                    <Grid Name="GridHeader" HorizontalAlignment="Center">
-                        <TextBlock
-                            FontSize="12"
-                            Foreground="#8F96A7"
-                            Text="PDF Pro Series" />
-                    </Grid>
-                </Expander.Header>
-                <Border CornerRadius="4">
-                    <Grid Name="GroupPDFProSeries">
-                        <ListView
-                            x:Name="PDFProListview"
-                            MinWidth="0"
-                            HorizontalAlignment="Stretch"
-                            BorderThickness="0"
-                            ItemContainerStyle="{StaticResource EmptyListViewItem}"
-                            ItemTemplate="{StaticResource PromotionDataTemplate}" />
-                    </Grid>
-                </Border>
+        <Grid>
+            <StackPanel Margin="0,0,0,252">
+                <Expander
+                    x:Name="PDFProSeriesExpander"
+                    Margin="20,20,0,0"
+                    IsExpanded="True"
+                    Style="{StaticResource PromotionExpanderStyle}">
+                    <Expander.Header>
+                        <Grid
+                            Name="GridHeader"
+                            Height="32"
+                            HorizontalAlignment="Center">
+                            <TextBlock VerticalAlignment="Center" Text="PDF Pro Series" />
+                        </Grid>
+                    </Expander.Header>
+                    <Border CornerRadius="4">
+                        <Grid Name="GroupPDFProSeries">
+                            <ListView
+                                x:Name="PDFProListview"
+                                MinWidth="0"
+                                HorizontalAlignment="Stretch"
+                                Background="Transparent"
+                                BorderThickness="0"
+                                ItemContainerStyle="{StaticResource EmptyListViewItem}"
+                                ItemTemplate="{StaticResource PromotionDataTemplate}" />
+                        </Grid>
+                    </Border>
 
-            </Expander>
+                </Expander>
 
-            <Expander
-                x:Name="OthersExpander"
-                Margin="20,20,0,0"
-                Style="{StaticResource PromotionExpanderStyle}">
-                <Expander.Header>
-                    <Grid Name="GridHeaderOthers" HorizontalAlignment="Center">
-                        <TextBlock
-                            FontSize="12"
-                            Foreground="#8F96A7"
-                            Text="Others" />
-                    </Grid>
-                </Expander.Header>
-                <Border CornerRadius="4">
-                    <Grid Name="GridGroupOthers">
-                        <ListView
-                            x:Name="OthersListview"
-                            MinWidth="0"
-                            HorizontalAlignment="Stretch"
-                            BorderThickness="0"
-                            ItemContainerStyle="{StaticResource EmptyListViewItem}"
-                            ItemTemplate="{StaticResource PromotionDataTemplate}" />
-                    </Grid>
-                </Border>
+                <Expander
+                    x:Name="OthersExpander"
+                    Margin="20,8,0,0"
+                    IsExpanded="True"
+                    Style="{StaticResource PromotionExpanderStyle}">
+                    <Expander.Header>
+                        <Grid
+                            Name="GridHeaderOthers"
+                            Height="32"
+                            HorizontalAlignment="Center">
+                            <TextBlock VerticalAlignment="Center" Text="Others" />
+                        </Grid>
+                    </Expander.Header>
+                    <Border CornerRadius="4">
+                        <Grid Name="GridGroupOthers">
+                            <ListView
+                                x:Name="OthersListview"
+                                MinWidth="0"
+                                HorizontalAlignment="Stretch"
+                                Background="Transparent"
+                                BorderThickness="0"
+                                ItemContainerStyle="{StaticResource EmptyListViewItem}"
+                                ItemTemplate="{StaticResource PromotionDataTemplate}" />
+                        </Grid>
+                    </Border>
 
-            </Expander>
+                </Expander>
+
+            </StackPanel>
             <Rectangle
                 x:Name="promtionRect"
                 Width="216"
                 Height="216"
-                Margin="0,8,0,0"
+                Margin="0,23"
+                VerticalAlignment="Bottom"
                 Fill="#EBEBEB"
                 RadiusX="8"
                 RadiusY="8" />
-        </StackPanel>
+        </Grid>
     </ScrollViewer>
 </UserControl>

+ 14 - 12
PDF Office/Views/HomePanel/RecentFiles/DocItemControl.xaml

@@ -18,27 +18,29 @@
             <RowDefinition Height="auto" />
             <RowDefinition />
         </Grid.RowDefinitions>
-        <Border
-            Margin="51,16"
+        <Grid Height="165" Margin="51,16">
+            <Border
             BorderBrush="{StaticResource color.sys.layout.divider}"
             BorderThickness="1"
+                VerticalAlignment="Center"
+                HorizontalAlignment="Center"
             CornerRadius="{StaticResource border-radius.8}">
-            <Grid>
-                <Border
+                <Grid>
+                    <Border
                     Name="BorderImage"
-                    Height="164"
                     Background="White"
                     CornerRadius="{StaticResource border-radius.8}" />
-                <Image
+                    <Image
                     Name="CoverImage"
                     RenderOptions.BitmapScalingMode="HighQuality"
                     UseLayoutRounding="True">
-                    <Image.OpacityMask>
-                        <VisualBrush Visual="{Binding ElementName=BorderImage}" />
-                    </Image.OpacityMask>
-                </Image>
-            </Grid>
-        </Border>
+                        <Image.OpacityMask>
+                            <VisualBrush Visual="{Binding ElementName=BorderImage}" />
+                        </Image.OpacityMask>
+                    </Image>
+                </Grid>
+            </Border>
+        </Grid>
         <TextBlock
             Grid.Row="1"
             MaxWidth="226"

+ 10 - 5
PDF Office/Views/HomePanel/RecentFiles/DocItemListViewControl.xaml

@@ -50,12 +50,17 @@
                     <ColumnDefinition />
                 </Grid.ColumnDefinitions>
 
-                <Image
-                    x:Name="CoverImage"
+                <Border
                     Margin="10,0"
-                    HorizontalAlignment="Left"
-                    RenderOptions.BitmapScalingMode="HighQuality"
-                    UseLayoutRounding="True" />
+                    BorderBrush="{StaticResource color.item-state.sel.border.lv3}"
+                    BorderThickness="1">
+                    <Image
+                        x:Name="CoverImage"
+                        Width="40"
+                        Height="60"
+                        RenderOptions.BitmapScalingMode="HighQuality"
+                        UseLayoutRounding="True" />
+                </Border>
                 <StackPanel Grid.Column="1" Margin="8,8,0,8">
                     <TextBlock
                         x:Name="FileName"

+ 15 - 3
PDF Office/Views/HomePanel/RecentFiles/RecentFilesContent.xaml

@@ -9,6 +9,8 @@
     xmlns:local="clr-namespace:PDF_Office.Views.HomePanel.RecentFiles"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
+    xmlns:recentfiles="clr-namespace:PDF_Office.ViewModels.HomePanel.RecentFiles"
+    d:DataContext="{d:DesignInstance Type=recentfiles:RecentFilesContentViewModel}"
     d:DesignHeight="450"
     d:DesignWidth="800"
     prism:ViewModelLocator.AutoWireViewModel="True"
@@ -201,15 +203,25 @@
                         Margin="16,0,0,0"
                         Padding="0,0,0,0"
                         Command="{Binding RemoveFilesFromContainerCommand}"
-                        CommandParameter="{Binding ElementName=RecentFilesList, Path=SelectedItems}"
                         Foreground="#6B6F7D"
-                        IsEnabled="{Binding IsEmpty, Converter={StaticResource InvertBoolConvert}, Mode=OneWay}"
-                        Style="{StaticResource btn.sec}">
+                        IsEnabled="{Binding IsEmpty, Converter={StaticResource InvertBoolConvert}, Mode=OneWay}">
                         <Path
                             Width="32"
                             Height="32"
                             Data="M14 9.75H18V8.25H14V9.75ZM9 12.25H10.25V23C10.25 23.4142 10.5858 23.75 11 23.75H21C21.4142 23.75 21.75 23.4142 21.75 23V12.25H23V10.75H9V12.25ZM11.75 22.25V12.25H20.25V22.25H11.75ZM15.25 14.5V19.5H16.75V14.5H15.25Z"
                             Fill="{Binding ElementName=BtnDelete, Path=Foreground}" />
+                        <Button.Style>
+                            <Style BasedOn="{StaticResource btn.sec}" TargetType="{x:Type Button}">
+                                <Style.Triggers>
+                                    <DataTrigger Binding="{Binding ElementName=RecentFilesList, Path=Visibility}" Value="Visible">
+                                        <Setter Property="CommandParameter" Value="{Binding ElementName=RecentFilesList, Path=SelectedItems}" />
+                                    </DataTrigger>
+                                    <DataTrigger Binding="{Binding ElementName=GridRecentFilesList, Path=Visibility}" Value="Visible">
+                                        <Setter Property="CommandParameter" Value="{Binding ElementName=GridRecentFilesList, Path=SelectedItems}" />
+                                    </DataTrigger>
+                                </Style.Triggers>
+                            </Style>
+                        </Button.Style>
                     </Button>
                 </StackPanel>
             </Grid>

+ 7 - 3
PDF Office/Views/ViewContent.xaml

@@ -27,7 +27,7 @@
             <ResourceDictionary.MergedDictionaries>
                 <ResourceDictionary Source="pack://application:,,,/Styles/ButtonStyle.xaml" />
             </ResourceDictionary.MergedDictionaries>
-
+            <convert:InvertBoolConvert x:Key="UnBoolConvert" />
             <Style x:Key="MenuButtonStyle" TargetType="{x:Type Button}">
                 <Setter Property="Width" Value="20" />
                 <Setter Property="Height" Value="20" />
@@ -69,7 +69,10 @@
                                 Header="Open Recent"
                                 Loaded="MenuRecent_Loaded">
                                 <Separator Name="Menu_Separator" Style="{StaticResource HorizontalSeparatorStyle}" />
-                                <MenuItem Name="MenuDeleteAll" Header="Delete All" Click="MenuDeleteAll_Click" />
+                                <MenuItem
+                                    Name="MenuDeleteAll"
+                                    Click="MenuDeleteAll_Click"
+                                    Header="Delete All" />
                             </MenuItem>
                             <Separator Margin="8,0" Style="{StaticResource HorizontalSeparatorStyle}" />
                             <MenuItem Header="Create Files">
@@ -230,13 +233,14 @@
                     Height="28"
                     BorderThickness="0"
                     IsChecked="{Binding IsPropertyOpen}"
+                    IsEnabled="{Binding isInPageEdit, Converter={StaticResource UnBoolConvert}}"
                     Style="{StaticResource SubToolbarTgb}"
                     ToolTip="Property">
                     <Path
                         Width="20"
                         Height="20"
                         Data="M2 4V7H18V4H2ZM2 16V9H13V16H2ZM15 16H18V9H15V16ZM1.72101 2C0.770524 2 0 2.77052 0 3.72101V16.279C0 17.2295 0.770524 18 1.72101 18H18.279C19.2295 18 20 17.2295 20 16.279V3.72101C20 2.77052 19.2295 2 18.279 2H1.72101Z"
-                        Fill="{StaticResource color.icon.base.neutral.norm.lv1}" />
+                        Fill="{Binding ElementName=TbtnProperty, Path=Foreground}" />
                 </ToggleButton>
             </StackPanel>
             <TabControl