Browse Source

偏好设置UI

OYXH\oyxh 2 years ago
parent
commit
c1372d6e83

+ 27 - 6
PDF Office/CustomControl/NumericUpDown.xaml

@@ -7,7 +7,6 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     d:DesignHeight="32"
     d:DesignWidth="80"
-    Background="#EEEEEE"
     FontSize="20"
     mc:Ignorable="d">
     <Border>
@@ -31,7 +30,15 @@
                 PreviewTextInput="CountTextBox_PreviewTextInput"
                 Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=Text}"
                 TextAlignment="Left"
-                TextChanged="TextBox_Num_TextChanged" />
+                TextChanged="TextBox_Num_TextChanged">
+                <TextBox.Template>
+                    <ControlTemplate TargetType="{x:Type TextBox}">
+                        <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,1,0,1" CornerRadius="4,0,0,4" Background="{StaticResource color.field.bg.def}">
+                            <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
+                        </Border>
+                    </ControlTemplate>
+                </TextBox.Template>
+            </TextBox>
             <Grid Grid.Column="1" Width="16">
                 <Grid.RowDefinitions>
                     <RowDefinition />
@@ -46,10 +53,17 @@
                     Click="Button_Add_Click">
                     <Path
                         HorizontalAlignment="Center"
-                        Data="M8 4.29102L2.14648 10.1445L2.85547 10.8535L8 5.70898L13.1445 10.8535L13.8535 10.1445L8 4.29102Z"
-                        Fill="Black"
+                        Data="M10 5.93571L13.9696 9.90532L15.0303 8.84466L10.5303 4.34472C10.2374 4.05183 9.76257 4.05183 9.46967 4.34472L4.96974 8.84466L6.0304 9.90532L10 5.93571Z"
+                        Fill="{StaticResource color.icon.arrow.gray.def}"
                         Stretch="Uniform"
                         Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" />
+                    <Button.Template>
+                        <ControlTemplate TargetType="{x:Type Button}">
+                            <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,1,1,0.5" CornerRadius="0,4,0,0" Background="{StaticResource color.field.bg.def}">
+                                <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
+                            </Border>
+                        </ControlTemplate>
+                    </Button.Template>
                 </Button>
                 <Button
                     Name="Button_Sub"
@@ -58,10 +72,17 @@
                     BorderThickness="00"
                     Click="Button_Sub_Click">
                     <Path
-                        Data="M13.8535 5.85547L13.1445 5.14648L8 10.291L2.85547 5.14648L2.14648 5.85547L8 11.709L13.8535 5.85547Z"
-                        Fill="Black"
+                        Data="M10 9.06427L6.03039 5.09467L4.96973 6.15533L9.46967 10.6553C9.76256 10.9482 10.2374 10.9482 10.5303 10.6553L15.0303 6.15533L13.9696 5.09467L10 9.06427Z"
+                        Fill="{StaticResource color.icon.arrow.gray.def}"
                         Stretch="Uniform"
                         Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" />
+                    <Button.Template>
+                        <ControlTemplate TargetType="{x:Type Button}">
+                            <Border BorderBrush="{StaticResource color.field.border.norm}" BorderThickness="1,0.5,1,1" CornerRadius="0,0,4,0" Background="{StaticResource color.field.bg.def}">
+                                <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
+                            </Border>
+                        </ControlTemplate>
+                    </Button.Template>
                 </Button>
             </Grid>
         </Grid>

+ 33 - 0
PDF Office/DataConvert/BoolToBrushConvert.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows.Media;
+
+namespace PDF_Office.DataConvert
+{
+    internal class BoolToBrushConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value is bool flag)
+            {
+                if (flag)
+                {
+                    Color color = (Color)App.Current.FindResource("color.sys.text.accent.norm");
+                    return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1770F4"));
+                    //return new SolidColorBrush(color);
+                }
+            }
+            return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#616469"));
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            return null;
+        }
+    }
+}

BIN
PDF Office/Image1.png


+ 8 - 0
PDF Office/PDF Office.csproj

@@ -283,6 +283,7 @@
       <DependentUpon>WritableComboBox.xaml</DependentUpon>
     </Compile>
     <Compile Include="DataConvert\AnnotateFontSizeConverter.cs" />
+    <Compile Include="DataConvert\BoolToBrushConvert.cs" />
     <Compile Include="DataConvert\BoolToTextWrapConvert.cs" />
     <Compile Include="DataConvert\CenterToolTipConverter .cs" />
     <Compile Include="DataConvert\ColorBrushConvert.cs" />
@@ -745,6 +746,9 @@
     <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageSplitDialog.xaml.cs">
       <DependentUpon>HomePageSplitDialog.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Dialog\InfoDialog.xaml.cs">
+      <DependentUpon>InfoDialog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Dialog\PageEditDialogs\ExtractDialog.xaml.cs">
       <DependentUpon>ExtractDialog.xaml</DependentUpon>
     </Compile>
@@ -1413,6 +1417,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Dialog\InfoDialog.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Views\Dialog\PageEditDialogs\SplitDialog.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 151 - 2
PDF Office/Styles/TabControlStyle.xaml

@@ -76,7 +76,6 @@
                             <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
                             <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
                             <Setter TargetName="RowDefinition1" Property="Height" Value="Auto" />
-
                         </Trigger>
                         <Trigger Property="TabStripPlacement" Value="Left">
                             <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
@@ -196,7 +195,6 @@
                                 <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Right" />
                             </MultiDataTrigger.Conditions>
                             <Setter TargetName="templateRoot" Property="Opacity" Value="0.56" />
-
                         </MultiDataTrigger>
                         <MultiDataTrigger>
                             <MultiDataTrigger.Conditions>
@@ -510,6 +508,7 @@
                                 x:Name="PART_SelectedContentHost"
                                 Margin="{TemplateBinding Padding}"
                                 ContentSource="SelectedContent"
+
                                 SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                         </Border>
                     </Grid>
@@ -551,4 +550,154 @@
             </Setter.Value>
         </Setter>
     </Style>
+
+    <Style x:Key="InfoTabControl" TargetType="{x:Type TabControl}">
+        <Setter Property="Padding" Value="8" />
+        <Setter Property="HorizontalContentAlignment" Value="Left" />
+        <Setter Property="VerticalContentAlignment" Value="Center" />
+        <Setter Property="BorderThickness" Value="0" />
+        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type TabControl}">
+                    <Grid
+                        x:Name="templateRoot"
+                        ClipToBounds="true"
+                        KeyboardNavigation.TabNavigation="Local"
+                        SnapsToDevicePixels="true">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition x:Name="ColumnDefinition0" Width="200" />
+                            <ColumnDefinition x:Name="ColumnDefinition1" Width="500" />
+                        </Grid.ColumnDefinitions>
+                        <Border
+                            Grid.Column="0"
+                            Width="200"
+                            HorizontalAlignment="Stretch"
+                            VerticalAlignment="Stretch"
+                            Background="{StaticResource color.sys.layout.mg}"
+                            BorderThickness="1"
+                            CornerRadius="4">
+                            <TabPanel
+                                x:Name="headerPanel"
+                                Width="180"
+                                HorizontalAlignment="Center"
+                                VerticalAlignment="Stretch"
+                                Panel.ZIndex="1"
+                                Background="Transparent"
+                                IsItemsHost="true"
+                                KeyboardNavigation.TabIndex="1" />
+                        </Border>
+                        <Border
+                            x:Name="contentPanel"
+                            Grid.Column="1"
+                            Background="{TemplateBinding Background}"
+                            BorderBrush="{TemplateBinding BorderBrush}"
+                            BorderThickness="{TemplateBinding BorderThickness}"
+                            KeyboardNavigation.DirectionalNavigation="Contained"
+                            KeyboardNavigation.TabIndex="2"
+                            KeyboardNavigation.TabNavigation="Local">
+                            <ContentPresenter
+                                x:Name="PART_SelectedContentHost"
+                                Margin="{TemplateBinding Margin}"
+                                ContentSource="SelectedContent"
+                                HorizontalAlignment="Right"
+                                VerticalAlignment="Center"
+                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+                        </Border>
+                    </Grid>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="TabStripPlacement" Value="Bottom">
+                            <Setter TargetName="headerPanel" Property="Grid.Row" Value="1" />
+                            <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
+                            <Setter TargetName="headerPanel" Property="Margin" Value="2,0,2,2" />
+                        </Trigger>
+                        <Trigger Property="TabStripPlacement" Value="Left">
+                            <Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
+                            <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
+                            <Setter TargetName="headerPanel" Property="Grid.Column" Value="0" />
+                            <Setter TargetName="contentPanel" Property="Grid.Column" Value="1" />
+                            <Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
+                            <Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
+                            <Setter TargetName="headerPanel" Property="Margin" Value="2,2,0,2" />
+                        </Trigger>
+                        <Trigger Property="TabStripPlacement" Value="Right">
+                            <Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
+                            <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
+                            <Setter TargetName="headerPanel" Property="Grid.Column" Value="1" />
+                            <Setter TargetName="contentPanel" Property="Grid.Column" Value="0" />
+                            <Setter TargetName="ColumnDefinition0" Property="Width" Value="*" />
+                            <Setter TargetName="ColumnDefinition1" Property="Width" Value="Auto" />
+                            <Setter TargetName="headerPanel" Property="Margin" Value="0,2,2,2" />
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="false">
+                            <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+    <Style x:Key="InfoTabItem" TargetType="{x:Type TabItem}">
+        <Setter Property="Height" Value="50" />
+        <Setter Property="Width" Value="200" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type TabItem}">
+                    <Grid>
+                        <Border
+                            Name="Border"
+                            Padding="8,0"
+                            Height="32"
+                            Background="Transparent"
+                            BorderBrush="Transparent"
+                            BorderThickness="1"
+                            CornerRadius="4">
+                            <ContentPresenter
+                                x:Name="ContentSite"
+                                HorizontalAlignment="Left"
+                                VerticalAlignment="Center"
+                                ContentSource="Header"
+                                RecognizesAccessKey="True" />
+                        </Border>
+                    </Grid>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsSelected" Value="True">
+                            <Setter Property="Panel.ZIndex" Value="100" />
+                            <Setter TargetName="Border" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv1}" />
+                            <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
+                        </Trigger>
+                        <Trigger Property="IsSelected" Value="False">
+                            <Setter Property="Panel.ZIndex" Value="100" />
+                            <Setter TargetName="Border" Property="Background" Value="Transparent" />
+                            <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+    <!--<Style x:Key="InfoTabItem" TargetType="{x:Type TabItem}">
+    <Setter Property="HeaderTemplate">
+
+    <Setter.Value>
+    -->
+    <!--<DataTemplate>
+    <DataTemplate.Triggers>
+    <Trigger Property="IsSelected" Value="True">
+    <Setter TargetName="img" Property="Source" Value="images/customimage.png" />
+    </Trigger>
+    </DataTemplate.Triggers>
+    </DataTemplate>-->
+    <!--
+    <ControlTemplate TargetType="{x:Type TabItem}">
+    <ContentPresenter />
+    <ControlTemplate.Triggers>
+    <Trigger Property="IsSelected" Value="True">
+    <Setter TargetName="img" Property="Source" Value="images/customimage.png" />
+    </Trigger>
+    </ControlTemplate.Triggers>
+    </ControlTemplate>
+    </Setter.Value>
+    </Setter>
+    </Style>-->
 </ResourceDictionary>

File diff suppressed because it is too large
+ 169 - 0
PDF Office/Views/Dialog/InfoDialog.xaml


+ 28 - 0
PDF Office/Views/Dialog/InfoDialog.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.Dialog
+{
+    /// <summary>
+    /// InfoDialog.xaml 的交互逻辑
+    /// </summary>
+    public partial class InfoDialog : UserControl
+    {
+        public InfoDialog()
+        {
+            InitializeComponent();
+        }
+    }
+}