Browse Source

属性面板 - 优化UI

chenrongqian 2 years ago
parent
commit
182f13e2d9

+ 2 - 50
PDF Office/CustomControl/ColorDropBox.xaml

@@ -5,57 +5,9 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.CustomControl"
              mc:Ignorable="d" 
-             d:DesignHeight="450" d:DesignWidth="800" MinWidth="52" Background="#01000000">
+             d:DesignHeight="450" d:DesignWidth="800" MinWidth="0" Background="#01000000">
     <Grid>
-        <Grid Visibility="Collapsed">
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="*"></ColumnDefinition>
-                <ColumnDefinition Width="auto"  MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" ></ColumnDefinition>
-            </Grid.ColumnDefinitions>
-            <!--正常颜色显示模块-->
-            <Border Width="16" Height="16" HorizontalAlignment="Left" BorderThickness="1" BorderBrush="#33000000" Margin="12,0,0,0"
-                Visibility="{Binding ElementName=NormalColorRectControl,Path=Visibility}">
-                <Rectangle  Name="NormalColorRectControl" Visibility="Collapsed"/>
-            </Border>
-            <!--透明颜色显示模块-->
-            <Border  Width="16" Height="16" HorizontalAlignment="Left" BorderThickness="1" Margin="12,0,0,0"
-                BorderBrush="#33000000" Visibility="{Binding ElementName=TransparentRectControl,Path=Visibility}">
-                <Rectangle  Name="TransparentRectControl" Visibility="Collapsed">
-                    <Rectangle.Fill>
-                        <DrawingBrush>
-                            <DrawingBrush.Drawing>
-                                <DrawingGroup>
-                                    <GeometryDrawing Brush="White">
-                                        <GeometryDrawing.Pen>
-                                            <Pen Thickness="1" Brush="#E2E3E6"></Pen>
-                                        </GeometryDrawing.Pen>
-                                        <GeometryDrawing.Geometry>
-                                            <RectangleGeometry Rect="0,0,16,16"></RectangleGeometry>
-                                        </GeometryDrawing.Geometry>
-                                    </GeometryDrawing>
-                                    <GeometryDrawing>
-                                        <GeometryDrawing.Pen>
-                                            <Pen Thickness="2" Brush="#FF3B30"></Pen>
-                                        </GeometryDrawing.Pen>
-                                        <GeometryDrawing.Geometry>
-                                            <LineGeometry StartPoint="16,0" EndPoint="0,16"></LineGeometry>
-                                        </GeometryDrawing.Geometry>
-                                    </GeometryDrawing>
-                                </DrawingGroup>
-                            </DrawingBrush.Drawing>
-                        </DrawingBrush>
-                    </Rectangle.Fill>
-                </Rectangle>
-            </Border>
-
-            <!--下拉模块-->
-            <Border Grid.Column="1" BorderThickness="0" Background="Transparent" HorizontalAlignment="Right" Padding="4,0,4,0">
-                <Polygon Points="13.8535156 5.85546875 13.1445312 5.14648438 8 10.2910156 2.85546875 5.14648438 2.14648438 5.85546875 8 11.7089844"
-                     Fill="#000000" Width="16" Height="16"/>
-            </Border>
-        </Grid>
-     
-            <Ellipse Width="16" Height="16" Margin="8,0,2,10"  VerticalAlignment="Center">
+        <Ellipse Width="20" Height="20" HorizontalAlignment="Center"  VerticalAlignment="Center">
                 <Ellipse.Fill>
                     <DrawingBrush>
                         <DrawingBrush.Drawing>

+ 12 - 12
PDF Office/CustomControl/ColorDropBox.xaml.cs

@@ -238,16 +238,16 @@ namespace PDF_Office.CustomControl
         {
             if (SelectedColor != e)
             {
-                NormalColorRectControl.Visibility = Visibility.Collapsed;
-                TransparentRectControl.Visibility = Visibility.Collapsed;
+              //  NormalColorRectControl.Visibility = Visibility.Collapsed;
+               // TransparentRectControl.Visibility = Visibility.Collapsed;
                 if (e != Colors.Transparent)
                 {
-                    NormalColorRectControl.Visibility = Visibility.Visible;
-                    NormalColorRectControl.Fill = new SolidColorBrush(e);
+                  //  NormalColorRectControl.Visibility = Visibility.Visible;
+                  //  NormalColorRectControl.Fill = new SolidColorBrush(e);
                 }
                 else
                 {
-                    TransparentRectControl.Visibility = Visibility.Visible;
+                 //   TransparentRectControl.Visibility = Visibility.Visible;
                 }
                 SelectedColor = e;
                 SelectedColorChanged?.Invoke(this, SelectedColor);
@@ -301,16 +301,16 @@ namespace PDF_Office.CustomControl
         {
             if (SelectedColor != setColor)
             {
-                NormalColorRectControl.Visibility = Visibility.Collapsed;
-                TransparentRectControl.Visibility = Visibility.Collapsed;
+              //  NormalColorRectControl.Visibility = Visibility.Collapsed;
+              //  TransparentRectControl.Visibility = Visibility.Collapsed;
                 if (setColor != Colors.Transparent)
                 {
-                    NormalColorRectControl.Visibility = Visibility.Visible;
-                    NormalColorRectControl.Fill = new SolidColorBrush(setColor);
+               //     NormalColorRectControl.Visibility = Visibility.Visible;
+               //     NormalColorRectControl.Fill = new SolidColorBrush(setColor);
                 }
                 else
                 {
-                    TransparentRectControl.Visibility = Visibility.Visible;
+               //     TransparentRectControl.Visibility = Visibility.Visible;
                 }
                 SelectedColor = setColor;
                 if (colorPop != null)
@@ -323,8 +323,8 @@ namespace PDF_Office.CustomControl
         public void ClearSelectColor()
         {
             _selectedColor = null;
-            NormalColorRectControl.Visibility = Visibility.Collapsed;
-            TransparentRectControl.Visibility = Visibility.Collapsed;
+           // NormalColorRectControl.Visibility = Visibility.Collapsed;
+           // TransparentRectControl.Visibility = Visibility.Collapsed;
         }
     }
 }

+ 2 - 1
PDF Office/Views/PropertyPanel/AnnotPanel/FreehandAnnotProperty.xaml

@@ -4,6 +4,7 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel"
+             xmlns:CommonControls="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel.CommonControls"
               xmlns:cus="clr-namespace:PDF_Office.CustomControl"
              xmlns:Convert="clr-namespace:PDF_Office.DataConvert"
              mc:Ignorable="d" 
@@ -147,7 +148,7 @@
                         <RowDefinition Height="auto"/>
                         <RowDefinition/>
                     </Grid.RowDefinitions>
-                    <local:ThicknessContent x:Name="layerThick" HorizontalAlignment="Right"/>
+                    <CommonControls:SlidContent x:Name="layerThick" HorizontalAlignment="Right"/>
                     <Grid Grid.Row="1">
                         <Grid.ColumnDefinitions>
                             <ColumnDefinition Width="*"></ColumnDefinition>

+ 2 - 1
PDF Office/Views/PropertyPanel/AnnotPanel/FreetextAnnotProperty.xaml

@@ -4,6 +4,7 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel"
+             xmlns:CommonControls="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel.CommonControls"
              xmlns:Convert="clr-namespace:PDF_Office.DataConvert"
              xmlns:cus="clr-namespace:PDF_Office.CustomControl"
              mc:Ignorable="d" 
@@ -273,7 +274,7 @@
                     <RowDefinition Height="auto"/>
                     <RowDefinition/>
                 </Grid.RowDefinitions>
-                <local:ThicknessContent x:Name="layerThick" HorizontalAlignment="Right"/>
+                <CommonControls:SlidContent x:Name="layerThick" HorizontalAlignment="Right"/>
                 <Grid Grid.Row="1">
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="*"></ColumnDefinition>

+ 3 - 2
PDF Office/Views/PropertyPanel/AnnotPanel/SharpsAnnotProperty.xaml

@@ -5,6 +5,7 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel"
               xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:CommonControls="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel.CommonControls"
              xmlns:Convert="clr-namespace:PDF_Office.DataConvert"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
@@ -140,7 +141,7 @@
                     <RowDefinition Height="auto"/>
                     <RowDefinition/>
                 </Grid.RowDefinitions>
-                <local:ThicknessContent x:Name="layerFill" HorizontalAlignment="Right"/>
+                <CommonControls:SlidContent x:Name="layerFill" HorizontalAlignment="Right"/>
                 <Grid Grid.Row="1">
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="*"></ColumnDefinition>
@@ -166,7 +167,7 @@
                     <RowDefinition Height="auto"/>
                     <RowDefinition/>
                 </Grid.RowDefinitions>
-                <local:ThicknessContent x:Name="layerThick" HorizontalAlignment="Right"/>
+                <CommonControls:SlidContent x:Name="layerThick" HorizontalAlignment="Right"/>
                 <Grid Grid.Row="1">
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="*"></ColumnDefinition>

+ 6 - 41
PDF Office/Views/PropertyPanel/AnnotPanel/TextAnnotProperty.xaml

@@ -4,6 +4,7 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel"
+             xmlns:CommonControls="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel.CommonControls"
              xmlns:cus="clr-namespace:PDF_Office.CustomControl"
              xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
              xmlns:prism="http://prismlibrary.com/"             
@@ -19,29 +20,7 @@
                 <ResourceDictionary Source="../../../Styles/SliderStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
             <Convert:AnnotArgsTypeConverter x:Key="AnnotArgsTypeConverter"/>
-            <DataTemplate x:Key="listboxData">
-                <Ellipse Height="20" Width="20" Fill="{Binding}"/>
-            </DataTemplate>
 
-            <ContextMenu x:Key="FlyoutMenu" FontSize="14"
-                        >
-                <ContextMenu.ItemContainerStyle>
-                    <Style TargetType="MenuItem">
-                        <Setter Property="Padding" Value="0,7,0,7"/>
-                        <Setter Property="VerticalContentAlignment" Value="Center"/>
-                    </Style>
-                </ContextMenu.ItemContainerStyle>
-                <MenuItem Name="ChangeColorMenuItem" Click="ChangeColorMenuItem_Click" Header="更改颜色" IsEnabled="True">
-                </MenuItem>
-                <MenuItem Name="BackColorMenuItem"  Header="恢复默认颜色" IsEnabled="True">
-                </MenuItem>
-            </ContextMenu>
-
-            <Style x:Key="listboxItemStyle" TargetType="{x:Type ListBoxItem}">
-                <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"/>
-                <Setter Property="HorizontalContentAlignment" Value="Center"/>
-                <Setter Property="Margin" Value="2,0,2,0"/>
-            </Style>
         </ResourceDictionary>
       
     </UserControl.Resources>
@@ -77,30 +56,16 @@
                 </Grid>
             </Border>
 
+
+           
+
             <Grid Margin="0,18,0,0">
                 <Grid.RowDefinitions>
                     <RowDefinition Height="auto"/>
                     <RowDefinition/>
                 </Grid.RowDefinitions>
-                <local:ThicknessContent x:Name="layerThick" HorizontalAlignment="Right"/>
-                <Grid Grid.Row="1">
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="*"></ColumnDefinition>
-                        <ColumnDefinition Width="auto"></ColumnDefinition>
-                    </Grid.ColumnDefinitions>
-                    <cus:ColorDropBox x:Name="ColorDropPicker"  Grid.Column="1" BorderThickness="1"  HorizontalAlignment="Right"
-                                BorderBrush="#E2E3E6" Width="80" Height="32">
-                    </cus:ColorDropBox>
-                    <ListBox x:Name="ListColor" ItemContainerStyle="{StaticResource listboxItemStyle}" ItemTemplate="{StaticResource listboxData}" BorderThickness="0" Background="Transparent">
-                        <ListBox.ItemsPanel>
-                            <ItemsPanelTemplate>
-                                <WrapPanel Orientation="Horizontal"/>
-                            </ItemsPanelTemplate>
-                        </ListBox.ItemsPanel>
-
-                    </ListBox>
-                </Grid>
-               
+                <CommonControls:SlidContent x:Name="SlidOpacity" HorizontalAlignment="Right"/>
+                <CommonControls:ColorContent Grid.Row="1" x:Name="cusColor"/>
             </Grid>
 
         </StackPanel>

+ 0 - 14
PDF Office/Views/PropertyPanel/AnnotPanel/TextAnnotProperty.xaml.cs

@@ -25,15 +25,9 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
     /// </summary>
     public partial class TextAnnotProperty : UserControl
     {
-        private List<string> colors = new List<string>(); 
         public TextAnnotProperty()
         {
             InitializeComponent();
-            colors.Add("#FFFF10");
-            colors.Add("#FF1010");
-            colors.Add("#10FF10");
-            colors.Add("#1070FF");
-            ListColor.ItemsSource= colors;
         }
 
         private void OpacitySlider_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
@@ -60,14 +54,6 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             }
         }
 
-        private void ChangeColorMenuItem_Click(object sender, RoutedEventArgs e)
-        {
-            var data = (sender as FrameworkElement).DataContext as string;
-            var listBoxItem = ListColor.ItemContainerGenerator.ContainerFromItem(data) as ListBoxItem;
-
-            if (listBoxItem != null)
-                ColorDropPicker?.ShowLayer(listBoxItem);
-        }
     }
    
 }