Browse Source

属性面板 - UI布局

chenrongqian 2 years ago
parent
commit
171af5f098

+ 56 - 39
PDF Office/CustomControl/ColorDropBox.xaml

@@ -7,50 +7,67 @@
              mc:Ignorable="d" 
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800" MinWidth="52" Background="#01000000">
              d:DesignHeight="450" d:DesignWidth="800" MinWidth="52" Background="#01000000">
     <Grid>
     <Grid>
-        <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"
+        <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}">
                 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"
+                <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}">
                 BorderBrush="#33000000" Visibility="{Binding ElementName=TransparentRectControl,Path=Visibility}">
-            <Rectangle  Name="TransparentRectControl" Visibility="Collapsed">
-                <Rectangle.Fill>
+                <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.Fill>
                     <DrawingBrush>
                     <DrawingBrush>
                         <DrawingBrush.Drawing>
                         <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>
+                            <ImageDrawing ImageSource="../Resources/PropertyPanel/colorIcon.png">
+                                <ImageDrawing.Rect>
+                                    <Rect Width="16" Height="16"></Rect>
+                                </ImageDrawing.Rect>
+                            </ImageDrawing>
                         </DrawingBrush.Drawing>
                         </DrawingBrush.Drawing>
                     </DrawingBrush>
                     </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>
+                </Ellipse.Fill>
+            </Ellipse>
     </Grid>
     </Grid>
+   
 </UserControl>
 </UserControl>

+ 19 - 4
PDF Office/CustomControl/ColorDropBox.xaml.cs

@@ -138,17 +138,23 @@ namespace PDF_Office.CustomControl
         private void ColorDropBox_MouseDown(object sender, MouseButtonEventArgs e)
         private void ColorDropBox_MouseDown(object sender, MouseButtonEventArgs e)
         {
         {
             e.Handled = true;
             e.Handled = true;
+            ShowLayer();
+        }
+
+        public void ShowLayer(DependencyObject dependencyObject = null)
+        {
             if (layerAdded)
             if (layerAdded)
             {
             {
                 RemoveFromLayer();
                 RemoveFromLayer();
                 return;
                 return;
             }
             }
-            AddToLayer();
+            AddToLayer(dependencyObject);
         }
         }
 
 
-        private void AddToLayer()
+        private void AddToLayer(DependencyObject dependencyObject = null)
         {
         {
             Window parentWnd = Window.GetWindow(this);
             Window parentWnd = Window.GetWindow(this);
+
             popLayer = AdornerLayer.GetAdornerLayer(parentWnd.Content as UIElement);
             popLayer = AdornerLayer.GetAdornerLayer(parentWnd.Content as UIElement);
             if (popLayer != null && colorPop != null &&!layerAdded)
             if (popLayer != null && colorPop != null &&!layerAdded)
             {
             {
@@ -165,7 +171,7 @@ namespace PDF_Office.CustomControl
 
 
                     colorPop.ColorSelected += ColorPop_ColorSelected;
                     colorPop.ColorSelected += ColorPop_ColorSelected;
                 }
                 }
-                Point offset = GetOffsetToWindow();
+                Point offset = GetOffsetToWindow(dependencyObject);
                 colorPop.Visibility = Visibility.Visible;
                 colorPop.Visibility = Visibility.Visible;
                 colorPop.Measure(new Size(parentWnd.ActualWidth, parentWnd.ActualHeight));
                 colorPop.Measure(new Size(parentWnd.ActualWidth, parentWnd.ActualHeight));
                 colorPop.SetValue(Canvas.TopProperty, offset.Y + this.ActualHeight + 2);
                 colorPop.SetValue(Canvas.TopProperty, offset.Y + this.ActualHeight + 2);
@@ -249,9 +255,18 @@ namespace PDF_Office.CustomControl
             RemoveFromLayer();
             RemoveFromLayer();
         }
         }
 
 
-        public Point GetOffsetToWindow()
+        public Point GetOffsetToWindow(DependencyObject dependencyObject = null)
         {
         {
             Window parentWnd = Window.GetWindow(this);
             Window parentWnd = Window.GetWindow(this);
+            if (dependencyObject != null)
+            {
+                var frame = dependencyObject as FrameworkElement;
+                if(frame != null)
+                {
+                    return frame.TransformToAncestor(parentWnd).Transform(new Point(0, 0));
+                }
+            }
+           
             return TransformToAncestor(parentWnd).Transform(new Point(0, 0));
             return TransformToAncestor(parentWnd).Transform(new Point(0, 0));
         }
         }
 
 

+ 143 - 103
PDF Office/Views/PropertyPanel/AnnotPanel/FreehandAnnotProperty.xaml

@@ -12,6 +12,7 @@
         <ResourceDictionary>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
             <ResourceDictionary.MergedDictionaries>
                 <ResourceDictionary Source="../../../Styles/SliderStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="../../../Styles/SliderStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml"/>
             </ResourceDictionary.MergedDictionaries>
             </ResourceDictionary.MergedDictionaries>
           
           
             <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert"/>
             <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert"/>
@@ -25,14 +26,38 @@
                     </Setter.Value>
                     </Setter.Value>
                 </Setter>
                 </Setter>
             </Style>
             </Style>
+
+            <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>
         </ResourceDictionary>
     </UserControl.Resources>
     </UserControl.Resources>
-    <Grid Background="Wheat">
+    <Grid Background="#F3F3F3">
         <StackPanel>
         <StackPanel>
-            <TextBlock Name="AnnotTypeTitle" FontFamily="SegoeUI" FontWeight="Bold" FontSize="18" LineHeight="24" HorizontalAlignment="Center" Margin="0,8,0,0">Freehand</TextBlock>
-            <Border Width="232" Height="80" BorderThickness="1" BorderBrush="#E2E3E6" Margin="0,8,0,0">
+            <TextBlock Name="AnnotTypeTitle" FontFamily="SegoeUI" FontWeight="Bold" FontSize="18" LineHeight="24" HorizontalAlignment="Left" Margin="10,8,0,0">Freehand</TextBlock>
+            <Border Width="228" Height="100" BorderThickness="1" CornerRadius="2" BorderBrush="#DDDDDD" Background="White" Margin="0,8,0,0">
                 <Grid>
                 <Grid>
-                    <Path Name="FreehandPath" 
+                    <Path Name="FreehandPath" Fill="Red"
                   Data="M89.6572823,33.0006836 C92.423623,33.0142613 94.9660238,33.2143167 97.6072943,33.6499257 L98.4450428,33.7953737 C99.2868308,33.9487663 100.141867,
                   Data="M89.6572823,33.0006836 C92.423623,33.0142613 94.9660238,33.2143167 97.6072943,33.6499257 L98.4450428,33.7953737 C99.2868308,33.9487663 100.141867,
                   34.1261641 101.020317,34.3291126 L101.906948,34.5406353 L102.811448,34.7695353 L103.736075,35.016156 C103.891982,35.0587552 104.048822,35.1021072 104.206642,
                   34.1261641 101.020317,34.3291126 L101.906948,34.5406353 L102.811448,34.7695353 L103.736075,35.016156 C103.891982,35.0587552 104.048822,35.1021072 104.206642,
                   35.1462189 L105.165696,35.4200646 L106.150524,35.7124896 L107.163387,36.0238374 L108.206543,36.3544513 L109.833019,36.8872476 L110.961791,37.2675295 L112.128763,
                   35.1462189 L105.165696,35.4200646 L106.150524,35.7124896 L107.163387,36.0238374 L108.206543,36.3544513 L109.833019,36.8872476 L110.961791,37.2675295 L112.128763,
@@ -116,111 +141,126 @@
                 </Grid>
                 </Grid>
             </Border>
             </Border>
 
 
+            <StackPanel>
+                <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>
+
+                </Grid>
 
 
-            <Grid Margin="0,18,0,0" Name="ColorGrid">
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-                <TextBlock x:Name="colorText"  LineHeight="20" Margin="12,0,0,0" VerticalAlignment="Center">Color</TextBlock>
-                <cus:ColorDropBox x:Name="ColorDropPicker" Grid.Column="1" Margin="0,0,12,0" BorderThickness="1"  HorizontalAlignment="Right"
-                                BorderBrush="#E2E3E6" Width="80" Height="32" ></cus:ColorDropBox>
-            </Grid>
-
-            <TextBlock x:Name="borderText" LineHeight="20" Margin="12,14,0,0" >Border</TextBlock>
-            <Grid>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-                <Slider Name="BorderSlider" VerticalAlignment="Center" Margin="12,0,4,0"  Minimum="1" Maximum="12" IsSelectionRangeEnabled="True" IsMoveToPointEnabled="True"
+                <TextBlock x:Name="borderText" LineHeight="20" Margin="12,14,0,0" >Border</TextBlock>
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"></ColumnDefinition>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                    </Grid.ColumnDefinitions>
+                    <Slider Name="BorderSlider" VerticalAlignment="Center" Margin="12,0,4,0"  Minimum="1" Maximum="12" IsSelectionRangeEnabled="True" IsMoveToPointEnabled="True"
                     Style="{StaticResource RoundThumbSlider}"  TickFrequency="1" IsSnapToTickEnabled="True" >
                     Style="{StaticResource RoundThumbSlider}"  TickFrequency="1" IsSnapToTickEnabled="True" >
-                    <Slider.Resources>
-                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
-                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
-                    </Slider.Resources>
-                </Slider>
-
-                <Border Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="0,0,12,0"  BorderThickness="0">
-                    <Grid>
-                        <ComboBox Name="BorderDropBox" BorderThickness="1" Padding="10 10 0 0" Background="Transparent" BorderBrush="#FFE2E3E6" >
-                            <ComboBox.ItemContainerStyle>
-                                <Style TargetType="{x:Type ComboBoxItem}">
-                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                </Style>
-                            </ComboBox.ItemContainerStyle>
-                            <ComboBoxItem Content="1" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
-                            <ComboBoxItem Content="3" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
-                            <ComboBoxItem Content="6" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
-                            <ComboBoxItem Content="9" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
-                            <ComboBoxItem Content="12" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
-                        </ComboBox>
-                        <TextBox FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Margin="10,0,35,0" IsReadOnly="True"
+                        <Slider.Resources>
+                            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
+                            <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
+                        </Slider.Resources>
+                    </Slider>
+
+                    <Border Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="0,0,12,0"  BorderThickness="0">
+                        <Grid>
+                            <ComboBox Name="BorderDropBox" BorderThickness="1" Padding="10 10 0 0" Background="Transparent" BorderBrush="#FFE2E3E6" >
+                                <ComboBox.ItemContainerStyle>
+                                    <Style TargetType="{x:Type ComboBoxItem}">
+                                        <Setter Property="Padding" Value="10 0 0 0"/>
+                                    </Style>
+                                </ComboBox.ItemContainerStyle>
+                                <ComboBoxItem Content="1" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
+                                <ComboBoxItem Content="3" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
+                                <ComboBoxItem Content="6" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
+                                <ComboBoxItem Content="9" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
+                                <ComboBoxItem Content="12" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
+                            </ComboBox>
+                            <TextBox FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Margin="10,0,35,0" IsReadOnly="True"
                              BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" Text="{Binding ElementName=BorderSlider,Path=Value}">
                              BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" Text="{Binding ElementName=BorderSlider,Path=Value}">
-                        </TextBox>
-                    </Grid>
-                </Border>
-            </Grid>
-
-
-            <TextBlock x:Name="opacityText"  LineHeight="20" Margin="12,14,0,0" >Opacity</TextBlock>
-
-            <Grid Name="OpacityGrid">
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-
-                <Slider Name="OpacitySlider" VerticalAlignment="Center" Margin="12,0,4,0"  Minimum="0" Maximum="1" IsSelectionRangeEnabled="True" IsMoveToPointEnabled="True"
-                    Style="{StaticResource RoundThumbSlider}"  TickFrequency="0.01" >
-                    <Slider.Resources>
-                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
-                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
-                    </Slider.Resources>
-                </Slider>
-
-                <Border Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="0,0,12,0"  BorderThickness="0">
-                    <Grid>
-                        <ComboBox Name="OpacityDropBox" BorderThickness="1" Padding="10 10 0 0" Background="Transparent" BorderBrush="#FFE2E3E6">
-                            <ComboBox.ItemContainerStyle>
-                                <Style TargetType="{x:Type ComboBoxItem}">
-                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                </Style>
-                            </ComboBox.ItemContainerStyle>
-                            <ComboBoxItem Content="25%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}" />
-                            <ComboBoxItem Content="50%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}" />
-                            <ComboBoxItem Content="75%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
-                            <ComboBoxItem Content="100%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}" />
-                        </ComboBox>
-                        <TextBox FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Margin="10,0,23,0" IsReadOnly="True"
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Center">
-                            <TextBox.Style>
-                                <Style TargetType="TextBox">
-                                    <Style.Setters>
-                                        <Setter Property="TextBox.Text">
-                                            <Setter.Value>
-                                                <MultiBinding StringFormat="P0">
-                                                    <Binding ElementName="OpacitySlider" Path="Value"></Binding>
-                                                </MultiBinding>
-                                            </Setter.Value>
-                                        </Setter>
-                                    </Style.Setters>
-                                </Style>
-                            </TextBox.Style>
-                        </TextBox>
-                    </Grid>
-                </Border>
-            </Grid>
+                            </TextBox>
+                        </Grid>
+                    </Border>
+                </Grid>
 
 
 
 
-            <StackPanel Margin="0 36 0 0">
-                <cus:ToastControl x:Name="tip" Width="auto" Height="20" FontFamily="Segoe UI" FontSize="12" Background="#1A477EDE" Foreground="#477EDE"/>
-                <Button x:Name="UseAsDefaultBtn" Content="Use As Default"  Margin="12,8,12,0" Width="232" Height="32" Foreground="#273C62" FontWeight="SemiBold"
-                Background="White" VerticalContentAlignment="Center" BorderThickness="1" BorderBrush="#273C62" FontFamily="SegoeUI" FontSize="14"></Button>
+                <StackPanel Orientation="Horizontal" Margin="0,20,0,0">
+                    <cus:CustomIconToggleBtn x:Name="BtnListMode" Tag="Line" Width="110" Height="32"
+                                              Style="{StaticResource ToggleBtnViewModeStyle}">
+                        <Border BorderBrush="Black" BorderThickness="1" Padding="8,0,8,0" Width="108" Height="30">
+                            <Line X1="10" Y1="15" X2="260" Y2="15" Stroke="Black" StrokeThickness="2" />
+                        </Border>
+                    </cus:CustomIconToggleBtn>
+                    <cus:CustomIconToggleBtn x:Name="BtnListMode1" Tag="Line" Width="110" Height="32"
+                                              Style="{StaticResource ToggleBtnViewModeStyle}">
+                        <Border BorderBrush="Black" BorderThickness="1" Padding="8,0,8,0" Width="108" Height="30" >
+                            <Line X1="10" Y1="15" X2="260" Y2="15" Stroke="Black" StrokeThickness="2" StrokeDashArray="2"/>
+                        </Border>
+                    </cus:CustomIconToggleBtn>
+                </StackPanel>
             </StackPanel>
             </StackPanel>
-            <TextBlock x:Name="noteText" Text="Note" LineHeight="20" Margin="12,30,0,0"></TextBlock>
-            <TextBox Name="AnnotNoteText" FontSize="14" TextWrapping="Wrap" BorderBrush="#E2E3E6" Width="232" Height="96" Margin="12,10,12,0" AcceptsReturn="True">
-            </TextBox>
+
+
+
+            <StackPanel x:Name="PanelEraser">
+                <TextBlock x:Name="eText" LineHeight="20" Margin="12,14,0,0" >Border</TextBlock>
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"></ColumnDefinition>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                    </Grid.ColumnDefinitions>
+                    <Slider Name="SlEraser" VerticalAlignment="Center" Margin="12,0,4,0"  Minimum="1" Maximum="12" IsSelectionRangeEnabled="True" IsMoveToPointEnabled="True"
+                    Style="{StaticResource RoundThumbSlider}"  TickFrequency="1" IsSnapToTickEnabled="True" >
+                        <Slider.Resources>
+                            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
+                            <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
+                        </Slider.Resources>
+                    </Slider>
+
+                    <Border Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="0,0,12,0"  BorderThickness="0">
+                        <Grid>
+                            <ComboBox Name="comBoxEraser" BorderThickness="1" Padding="10 10 0 0" Background="Transparent" BorderBrush="#FFE2E3E6" >
+                                <ComboBox.ItemContainerStyle>
+                                    <Style TargetType="{x:Type ComboBoxItem}">
+                                        <Setter Property="Padding" Value="10 0 0 0"/>
+                                    </Style>
+                                </ComboBox.ItemContainerStyle>
+                                <ComboBoxItem Content="1" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
+                                <ComboBoxItem Content="3" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
+                                <ComboBoxItem Content="6" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
+                                <ComboBoxItem Content="9" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
+                                <ComboBoxItem Content="12" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
+                            </ComboBox>
+                            <TextBox FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Margin="10,0,35,0" IsReadOnly="True"
+                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" Text="{Binding ElementName=BorderSlider,Path=Value}">
+                            </TextBox>
+                        </Grid>
+                    </Border>
+                </Grid>
+
+            </StackPanel>
+          
+          
 
 
         </StackPanel>
         </StackPanel>
     </Grid>
     </Grid>

+ 15 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/FreehandAnnotProperty.xaml.cs

@@ -20,9 +20,24 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
     /// </summary>
     /// </summary>
     public partial class FreehandAnnotProperty : UserControl
     public partial class FreehandAnnotProperty : UserControl
     {
     {
+        private List<string> colors = new List<string>();
         public FreehandAnnotProperty()
         public FreehandAnnotProperty()
         {
         {
             InitializeComponent();
             InitializeComponent();
+            colors.Add("#FFFF10");
+            colors.Add("#FF1010");
+            colors.Add("#10FF10");
+            colors.Add("#1070FF");
+            ListColor.ItemsSource = colors;
+        }
+
+        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);
         }
         }
     }
     }
 }
 }

+ 123 - 82
PDF Office/Views/PropertyPanel/AnnotPanel/FreetextAnnotProperty.xaml

@@ -12,6 +12,7 @@
         <ResourceDictionary>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
             <ResourceDictionary.MergedDictionaries>
                 <ResourceDictionary Source="../../../Styles/SliderStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="../../../Styles/SliderStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml"/>
             </ResourceDictionary.MergedDictionaries>
             </ResourceDictionary.MergedDictionaries>
 
 
             <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert"/>
             <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert"/>
@@ -35,12 +36,52 @@
                     </Setter.Value>
                     </Setter.Value>
                 </Setter>
                 </Setter>
             </Style>
             </Style>
+
+
+            <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>
+
+
+            <ContextMenu x:Key="BtnFlyoutMenu" 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="ChangeStyleMenuItem"  Header="用所选部分重新定义" IsEnabled="True">
+                </MenuItem>
+                <MenuItem Name="BackStyleMenuItem"  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>
         </ResourceDictionary>
     </UserControl.Resources>
     </UserControl.Resources>
-    <Grid Background="Wheat">
+    <Grid Background="#F3F3F3">
         <StackPanel>
         <StackPanel>
             <TextBlock Name="AnnotTypeTitle" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="18" LineHeight="24" HorizontalAlignment="Center" Margin="0,8,0,0">Freetext</TextBlock>
             <TextBlock Name="AnnotTypeTitle" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="18" LineHeight="24" HorizontalAlignment="Center" Margin="0,8,0,0">Freetext</TextBlock>
-            <Border Width="232" Height="80" BorderThickness="1" BorderBrush="#E2E3E6" Margin="0,8,0,0">
+            <Border Width="228" Height="100" BorderThickness="1" CornerRadius="2" BorderBrush="#DDDDDD" Background="White" Margin="0,8,0,0">
                 <Grid>
                 <Grid>
                     <Border Name="FreeTextBorder" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="5">
                     <Border Name="FreeTextBorder" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="5">
                         <TextBlock Name="SampleText" Text="Sample" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="SemiBold" FontFamily="Segoe UI Semibold" FontSize="24">
                         <TextBlock Name="SampleText" Text="Sample" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="SemiBold" FontFamily="Segoe UI Semibold" FontSize="24">
@@ -63,6 +104,47 @@
                 </Grid>
                 </Grid>
             </Border>
             </Border>
 
 
+
+            <Border BorderBrush="#E2E3E6"  Height="32" Margin="12,0,4,0"  BorderThickness="0">
+                <StackPanel Orientation="Horizontal">
+                    <ComboBox IsReadOnly="True" Name="FontTitleBox" Background="Transparent" Padding="10 10 0 0"  Width="148"   BorderThickness="1" BorderBrush="#FFE2E3E6"
+                                >
+                        <ComboBox.ItemContainerStyle>
+                            <Style TargetType="{x:Type ComboBoxItem}">
+                                <Setter Property="Padding" Value="10 0 0 0"/>
+                            </Style>
+                        </ComboBox.ItemContainerStyle>
+                        <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
+                            <TextBlock Text="H1 大标题"  Tag="Courier"  FontSize="14"/>
+                        </ComboBoxItem>
+                        <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
+                            <TextBlock Text="H2标准标题"  Tag="Helvetica" FontSize="14"/>
+                        </ComboBoxItem>
+                        <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
+                            <TextBlock Text="H3小标题"  Tag="Times Roman" FontSize="14"/>
+                        </ComboBoxItem>
+
+                        <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
+                            <TextBlock Text="H3小标题"  Tag="Times Roman" FontSize="14"/>
+                        </ComboBoxItem>
+
+                        <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
+                            <TextBlock Text="B1正文(标准)"  Tag="Times Roman" FontSize="14"/>
+                        </ComboBoxItem>
+                        <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
+                            <TextBlock Text="B2正文(小)"  Tag="Times Roman" FontSize="14"/>
+                        </ComboBoxItem>
+                        <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
+                            <TextBlock Text="B3描述"  Tag="Times Roman" FontSize="14"/>
+                        </ComboBoxItem>
+                    </ComboBox>
+                    <Button Width="32" Height="32" ContextMenu="{StaticResource BtnFlyoutMenu}"/>
+                </StackPanel>
+            </Border>
+
+
+
+
             <TextBlock x:Name="FontText"  FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,18,0,0" >Font</TextBlock>
             <TextBlock x:Name="FontText"  FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,18,0,0" >Font</TextBlock>
 
 
             <Grid Margin="0,6,0,0">
             <Grid Margin="0,6,0,0">
@@ -102,7 +184,7 @@
                     </Grid>
                     </Grid>
                 </Border>
                 </Border>
 
 
-                <cus:ColorDropBox x:Name="FontColorBox" Grid.Column="1" BorderThickness="1" BorderBrush="#E2E3E6" Width="80" Height="32" HorizontalAlignment="Left"
+                <cus:ColorDropBox x:Name="FontColorBox" Grid.Column="1" Grid.Row="1" BorderThickness="1" BorderBrush="#E2E3E6" Width="80" Height="32" HorizontalAlignment="Left"
                                    ></cus:ColorDropBox>
                                    ></cus:ColorDropBox>
 
 
                 <Border Grid.Row="1" BorderBrush="#E2E3E6"  Width="148" Height="32" Margin="12,8,4,0"  BorderThickness="0">
                 <Border Grid.Row="1" BorderBrush="#E2E3E6"  Width="148" Height="32" Margin="12,8,4,0"  BorderThickness="0">
@@ -124,7 +206,7 @@
                     </Grid>
                     </Grid>
                 </Border>
                 </Border>
 
 
-                <Border Grid.Row="1" Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="-1,8,0,0"  BorderThickness="0">
+                <Border Grid.Row="0" Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="-1,8,0,0"  BorderThickness="0">
                     <Grid>
                     <Grid>
                         <ComboBox Name="FontSizeBox" BorderThickness="1" Background="Transparent" BorderBrush="#FFE2E3E6"
                         <ComboBox Name="FontSizeBox" BorderThickness="1" Background="Transparent" BorderBrush="#FFE2E3E6"
                                   MaxDropDownHeight="200">
                                   MaxDropDownHeight="200">
@@ -187,25 +269,33 @@
 
 
 
 
             <Grid Margin="0,18,0,0">
             <Grid Margin="0,18,0,0">
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-                <TextBlock x:Name="FillColorText" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,0,0,0" VerticalAlignment="Center">Fill</TextBlock>
-                <cus:ColorDropBox x:Name="ColorDropFill" Grid.Column="1" Margin="0,0,11,0" BorderThickness="1"  HorizontalAlignment="Right"
-                                BorderBrush="#E2E3E6" Width="80" Height="32"  HasTransparentColor="True"></cus:ColorDropBox>
+                <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>
+
             </Grid>
             </Grid>
 
 
 
 
-            <Grid Margin="0,18,0,0">
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-                <TextBlock x:Name="borderColorText" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,0,0,0" VerticalAlignment="Center">Border</TextBlock>
-                <cus:ColorDropBox x:Name="ColorDropBorder" Grid.Column="1" Margin="0,0,11,0" BorderThickness="1"  HorizontalAlignment="Right"
-                                BorderBrush="#E2E3E6" Width="80" Height="32" ></cus:ColorDropBox>
-            </Grid>
+         
 
 
             <TextBlock x:Name="thicknessText" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,14,0,0" >Thickness</TextBlock>
             <TextBlock x:Name="thicknessText" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,14,0,0" >Thickness</TextBlock>
 
 
@@ -252,69 +342,20 @@
             </Grid>
             </Grid>
 
 
 
 
-            <TextBlock x:Name="opacityText" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,14,0,0" >Opacity</TextBlock>
-
-            <Grid>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-                <Slider Name="OpacitySlider" VerticalAlignment="Center" Width="148" Margin="12,0,0,0"  Minimum="0" Maximum="1" IsSelectionRangeEnabled="True" IsMoveToPointEnabled="True" 
-                    Style="{StaticResource RoundThumbSlider}"  TickFrequency="0.01">
-                    <Slider.Resources>
-                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
-                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
-                    </Slider.Resources>
-                </Slider>
-
-                <Border Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="0,0,11,0"  BorderThickness="0">
-                    <Grid>
-                        <ComboBox Name="OpacityDropBox" BorderThickness="1" BorderBrush="#FFE2E3E6" Padding="10 10 0 0" Background="Transparent"
-                                  >
-                            <ComboBox.ItemContainerStyle>
-                                <Style TargetType="{x:Type ComboBoxItem}">
-                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                </Style>
-                            </ComboBox.ItemContainerStyle>
-                            <ComboBoxItem Content="25%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}" />
-                            <ComboBoxItem Content="50%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}" />
-                            <ComboBoxItem Content="75%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}" />
-                            <ComboBoxItem Content="100%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}" />
-                        </ComboBox>
-
-                        <TextBox FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Margin="10,0,23,0" IsReadOnly="True"
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left">
-                            <TextBox.Style>
-                                <Style TargetType="TextBox">
-                                    <Style.Setters>
-                                        <Setter Property="TextBox.Text">
-                                            <Setter.Value>
-                                                <MultiBinding StringFormat="P0">
-                                                    <Binding ElementName="OpacitySlider" Path="Value"></Binding>
-                                                </MultiBinding>
-                                            </Setter.Value>
-                                        </Setter>
-                                    </Style.Setters>
-                                </Style>
-                            </TextBox.Style>
-                        </TextBox>
-
-                    </Grid>
-                </Border>
-            </Grid>
-
-
-            <StackPanel Margin="0 36 0 0">
-                <cus:ToastControl x:Name="tip" Width="auto" Height="20" FontFamily="Segoe UI" FontSize="12" Background="#1A477EDE" Foreground="#477EDE"/>
-                <Button x:Name="UseAsDefaultBtn" Content="Use As Default"  Margin="12,8,12,0" Width="232" Height="32" Foreground="#273C62"
-                Background="White" BorderThickness="1" BorderBrush="#FF273C62" FontWeight="SemiBold" FontFamily="Segoe UI" FontSize="14" ></Button>
+            <StackPanel Orientation="Horizontal" Margin="0,20,0,0">
+                <cus:CustomIconToggleBtn x:Name="BtnListMode" Tag="Line" Width="110" Height="32"
+                                              Style="{StaticResource ToggleBtnViewModeStyle}">
+                    <Border BorderBrush="Black" BorderThickness="1" Padding="8,0,8,0" Width="108" Height="30">
+                        <Line X1="10" Y1="15" X2="260" Y2="15" Stroke="Black" StrokeThickness="2" />
+                    </Border>
+                </cus:CustomIconToggleBtn>
+                <cus:CustomIconToggleBtn x:Name="BtnListMode1" Tag="Line" Width="110" Height="32"
+                                              Style="{StaticResource ToggleBtnViewModeStyle}">
+                    <Border BorderBrush="Black" BorderThickness="1" Padding="8,0,8,0" Width="108" Height="30" >
+                        <Line X1="10" Y1="15" X2="260" Y2="15" Stroke="Black" StrokeThickness="2" StrokeDashArray="2"/>
+                    </Border>
+                </cus:CustomIconToggleBtn>
             </StackPanel>
             </StackPanel>
-            <TextBlock x:Name="noteText" Text="Note" FontFamily="Segoe UI Semibold" FontWeight="SemiBold" FontSize="14" LineHeight="20" Margin="12,30,0,0"/>
-            <TextBox Name="AnnotNoteText" FontSize="14" TextWrapping="Wrap" BorderBrush="#E2E3E6" Width="232" Height="96" Margin="12,10,12,0"  AcceptsReturn="True">
-            </TextBox>
-
-
-
         </StackPanel>
         </StackPanel>
     </Grid>
     </Grid>
 </UserControl>
 </UserControl>

+ 15 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/FreetextAnnotProperty.xaml.cs

@@ -20,9 +20,24 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
     /// </summary>
     /// </summary>
     public partial class FreetextAnnotProperty : UserControl
     public partial class FreetextAnnotProperty : UserControl
     {
     {
+        private List<string> colors = new List<string>();
         public FreetextAnnotProperty()
         public FreetextAnnotProperty()
         {
         {
             InitializeComponent();
             InitializeComponent();
+            colors.Add("#FFFF10");
+            colors.Add("#FF1010");
+            colors.Add("#10FF10");
+            colors.Add("#1070FF");
+            ListColor.ItemsSource = colors;
+        }
+
+        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);
         }
         }
     }
     }
 }
 }

+ 91 - 350
PDF Office/Views/PropertyPanel/AnnotPanel/SharpsAnnotProperty.xaml

@@ -12,9 +12,14 @@
         <ResourceDictionary>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
             <ResourceDictionary.MergedDictionaries>
                 <ResourceDictionary Source="../../../Styles/SliderStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="../../../Styles/SliderStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml"/>
             </ResourceDictionary.MergedDictionaries>
             </ResourceDictionary.MergedDictionaries>
             <Convert:ColorToBrushConverter x:Key="ColorToBrushConvert"></Convert:ColorToBrushConverter>
             <Convert:ColorToBrushConverter x:Key="ColorToBrushConvert"></Convert:ColorToBrushConverter>
             <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert"/>
             <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert"/>
+            <DataTemplate x:Key="listboxData">
+                <Ellipse Height="20" Width="20" Fill="{Binding}"/>
+            </DataTemplate>
+
             <Style x:Key="line1Style" TargetType="{x:Type Line}">
             <Style x:Key="line1Style" TargetType="{x:Type Line}">
                 <Setter Property="Visibility">
                 <Setter Property="Visibility">
                     <Setter.Value>
                     <Setter.Value>
@@ -45,12 +50,36 @@
                     </Setter.Value>
                     </Setter.Value>
                 </Setter>
                 </Setter>
             </Style>
             </Style>
+
+
+
+
+            <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>
         </ResourceDictionary>
     </UserControl.Resources>
     </UserControl.Resources>
-    <Grid Background="Wheat">
+    <Grid Background="#F3F3F3">
         <StackPanel>
         <StackPanel>
             <TextBlock Name="AnnotTypeTitle" FontFamily="SegoeUI" FontWeight="Bold" FontSize="18" LineHeight="24" HorizontalAlignment="Center" Margin="0,8,0,0">Freehand</TextBlock>
             <TextBlock Name="AnnotTypeTitle" FontFamily="SegoeUI" FontWeight="Bold" FontSize="18" LineHeight="24" HorizontalAlignment="Center" Margin="0,8,0,0">Freehand</TextBlock>
-            <Border Width="232" Height="80" BorderThickness="1" BorderBrush="#E2E3E6" Margin="0,8,0,0">
+            <Border Width="228" Height="100" BorderThickness="1" CornerRadius="2" BorderBrush="#DDDDDD" Background="White" Margin="0,8,0,0">
                 <Grid>
                 <Grid>
                     <!--<Path Name="SharpPath" Opacity="{Binding ElementName=OpacitySlider,Path=Value}" StrokeThickness="{Binding ElementName=ThicknessSlider,Path=Value}" 
                     <!--<Path Name="SharpPath" Opacity="{Binding ElementName=OpacitySlider,Path=Value}" StrokeThickness="{Binding ElementName=ThicknessSlider,Path=Value}" 
                         Stroke="{Binding ElementName=BorderColorPicker,Path=SelectedColor,Converter={StaticResource ColorToBrushConvert}}"
                         Stroke="{Binding ElementName=BorderColorPicker,Path=SelectedColor,Converter={StaticResource ColorToBrushConvert}}"
@@ -106,320 +135,76 @@
             </Border>
             </Border>
 
 
 
 
-
             <Grid Margin="0,18,0,0">
             <Grid Margin="0,18,0,0">
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-                <TextBlock x:Name="borderColorText" LineHeight="20" Margin="12,0,0,0" VerticalAlignment="Center">Border</TextBlock>
-                <cus:ColorDropBox x:Name="BorderColorPicker" Grid.Column="1" Margin="0,0,12,0" BorderThickness="1"  HorizontalAlignment="Right"
-                                BorderBrush="#E2E3E6" Width="80" Height="32"  ></cus:ColorDropBox>
-            </Grid>
-
-
-            <Grid Margin="0,18,0,0" Name="FillGrid">
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-                <TextBlock x:Name="FillColorText"  LineHeight="20" Margin="12,0,0,0" VerticalAlignment="Center">Fill</TextBlock>
-                <cus:ColorDropBox x:Name="FillColorPicker" Grid.Column="1" Margin="0,0,12,0" BorderThickness="1"  HorizontalAlignment="Right" HasTransparentColor="True"
-                                BorderBrush="#E2E3E6" Width="80" Height="32" ></cus:ColorDropBox>
-            </Grid>
-
-
-            <Grid Margin="12,18,0,0" Name="ArrowGrid" Visibility="Visible">
                 <Grid.RowDefinitions>
                 <Grid.RowDefinitions>
-                    <RowDefinition Height="auto"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
+                    <RowDefinition Height="auto"/>
+                    <RowDefinition/>
                 </Grid.RowDefinitions>
                 </Grid.RowDefinitions>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-
-                <TextBlock x:Name="StartAndEndText" Grid.ColumnSpan="2"  LineHeight="20" Margin="0,6,0,0" VerticalAlignment="Center">Start &amp; End</TextBlock>
-
-                <Border Grid.Row="1" BorderBrush="#E2E3E6" BorderThickness="0"  Width="115" Height="32">
-                    <Grid>
-                        <ComboBox Name="StartArrowBox"  Background="Transparent"  BorderThickness="1" BorderBrush="#FFE2E3E6" IsReadOnly="True"
-                              MaxDropDownHeight="200">
-                            <ComboBox.ItemContainerStyle>
-                                <Style TargetType="{x:Type ComboBoxItem}">
-                                    <Setter Property="Padding" Value="25 0 0 0"/>
-                                </Style>
-                            </ComboBox.ItemContainerStyle>
-                            <ComboBoxItem VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Line"  Height="20">
-                                    <Path.Data>
-                                        F1 M40,16z M0,0z M34,7.5L34,7.5 34,8.5 6,8.5 6,7.5z
-                                    </Path.Data>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Arrow" Height="20">
-                                    <Path.Data>
-                                        F1 M40,16z M0,0z M10.7427521,4.57125354L11.2572479,5.42874646 7.80417468,7.49925354 34,7.5 34,8.5 7.80417468,8.49925354 11.2572479,10.5712535 10.7427521,11.4287465 5.02817468,8 10.7427521,4.57125354z
-                                    </Path.Data>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="CloseArrow" Height="20">
-                                    <Path.Data>
-                                        F1 M40,16z M0,0z M11.5,4.11690481L11.4991747,7.49990481 34,7.5 34,8.5 11.4991747,8.49990481 11.5,11.8830952 5.02817468,8 11.5,4.11690481z
-                                    </Path.Data>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Square"  Height="20">
-                                    <Path.Data>
-                                        M11.5,5 L11.5,7.5 L34,7.5 L34,8.5 L11.5,8.5 L11.5,11 L5.5,11 L5.5,5 L11.5,5 Z
-                                    </Path.Data>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Circle"  Height="20">
-                                    <Path.Data>
-                                        M8.5,5 C9.98660106,5 11.2206526,6.08129303 11.4585702,7.50029469 L34,7.5 L34,8.5 L11.4584039,8.50069618 C11.2200781,9.9192103 9.98625501,11 8.5,11 C6.84314575,11 5.5,9.65685425 5.5,8 C5.5,6.34314575 6.84314575,5 8.5,5 Z
-                                    </Path.Data>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Diamond"  Height="20">
-                                    <Path.Data>
-                                        M9,4.29289322 L12.2068932,7.49989322 L34,7.5 L34,8.5 L12.2068932,8.49989322 L9,11.7071068 L5.29289322,8 L9,4.29289322 Z
-                                    </Path.Data>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Butt"  Height="20">
-                                    <Path.Data>
-                                        M7.5,5.5 L7.5,7.5 L34,7.5 L34,8.5 L7.5,8.5 L7.5,10.5 L6.5,10.5 L6.5,5.5 L7.5,5.5 Z
-                                    </Path.Data>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="RArrow" Height="20">
-                                    <Path.Data>
-                                        M5.58660083,5.07600085 L9.46460189,7.49900085 L34,7.5 L34,8.5 L9.46460189,8.49900085 L5.58660083,10.9239992 L5.05660189,10.0760008 L8.37960136,8 L5.05660189,5.92399915 L5.58660083,5.07600085 Z
-                                    </Path.Data>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="RCloseArrow" Height="20">
-                                    <Path.Data>
-                                        M5.5,4.59787618 L10.143,7.49987618 L34,7.5 L34,8.5 L10.143,8.49987618 L5.5,11.4021238 L5.5,4.59787618 Z
-                                    </Path.Data>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Slash" Height="20">
-                                    <Path.Data>
-                                        M9.531981,5.84644661 L10.239087,6.55355339 L9.292447,7.49944661 L34,7.5 L34,8.5 L8.292447,8.49944661 L6.703553,10.0890873 L5.996447,9.38198052 L9.531981,5.84644661 Z
-                                    </Path.Data>
-                                </Path>
-                            </ComboBoxItem>
-                        </ComboBox>
-
-
-                        <TextBox Background="White" Height="20" Margin="10,0,35,0" 
-                             BorderThickness="0" VerticalAlignment="Center" IsReadOnly="True">
-                        </TextBox>
-                        <Path Name="StartArrowPath" VerticalAlignment="Center" Fill="#000000" Width="56" Height="16" Margin="30,8,0,8" HorizontalAlignment="Left"></Path>
-
-                        
-
-                    </Grid>
-
-                </Border>
-
-
-                <Border Grid.Row="1" Grid.Column="1" BorderBrush="#E2E3E6" BorderThickness="0" Width="115" Height="32" Margin="4,0,0,0">
-                    <Grid>
-                        <ComboBox Name="EndArrowBox" Background="Transparent" BorderBrush="#FFE2E3E6" BorderThickness="1" IsReadOnly="True"
-                           MaxDropDownHeight="200">
-                            <ComboBox.ItemContainerStyle>
-                                <Style TargetType="{x:Type ComboBoxItem}">
-                                    <Setter Property="Padding" Value="25 0 0 0"/>
-                                </Style>
-                            </ComboBox.ItemContainerStyle>
-                            <ComboBoxItem  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Line"  Height="20">
-                                    <Path.Data>
-                                        F1 M40,16z M0,0z M34,7.5L34,7.5 34,8.5 6,8.5 6,7.5z
-                                    </Path.Data>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Arrow" Height="20">
-                                    <Path.Data>
-                                        F1 M40,16z M0,0z M10.7427521,4.57125354L11.2572479,5.42874646 7.80417468,7.49925354 34,7.5 34,8.5 7.80417468,8.49925354 11.2572479,10.5712535 10.7427521,11.4287465 5.02817468,8 10.7427521,4.57125354z
-                                    </Path.Data>
-                                    <Path.LayoutTransform>
-                                        <RotateTransform Angle="180"></RotateTransform>
-                                    </Path.LayoutTransform>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="CloseArrow" Height="20">
-                                    <Path.Data>
-                                        F1 M40,16z M0,0z M11.5,4.11690481L11.4991747,7.49990481 34,7.5 34,8.5 11.4991747,8.49990481 11.5,11.8830952 5.02817468,8 11.5,4.11690481z
-                                    </Path.Data>
-                                    <Path.LayoutTransform>
-                                        <RotateTransform Angle="180"></RotateTransform>
-                                    </Path.LayoutTransform>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Square" Height="20" Margin="6,0,0,0" >
-                                    <Path.Data>
-                                        M11.5,5 L11.5,7.5 L34,7.5 L34,8.5 L11.5,8.5 L11.5,11 L5.5,11 L5.5,5 L11.5,5 Z
-                                    </Path.Data>
-                                    <Path.LayoutTransform>
-                                        <RotateTransform Angle="180"></RotateTransform>
-                                    </Path.LayoutTransform>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Circle"  Height="20" Margin="6,0,0,0" >
-                                    <Path.Data>
-                                        M8.5,5 C9.98660106,5 11.2206526,6.08129303 11.4585702,7.50029469 L34,7.5 L34,8.5 L11.4584039,8.50069618 C11.2200781,9.9192103 9.98625501,11 8.5,11 C6.84314575,11 5.5,9.65685425 5.5,8 C5.5,6.34314575 6.84314575,5 8.5,5 Z
-                                    </Path.Data>
-                                    <Path.LayoutTransform>
-                                        <RotateTransform Angle="180"></RotateTransform>
-                                    </Path.LayoutTransform>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Diamond"  Height="20" Margin="6,0,0,0" >
-                                    <Path.Data>
-                                        M9,4.29289322 L12.2068932,7.49989322 L34,7.5 L34,8.5 L12.2068932,8.49989322 L9,11.7071068 L5.29289322,8 L9,4.29289322 Z
-                                    </Path.Data>
-                                    <Path.LayoutTransform>
-                                        <RotateTransform Angle="180"></RotateTransform>
-                                    </Path.LayoutTransform>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Butt"  Height="20" Margin="6,0,0,0" >
-                                    <Path.Data>
-                                        M7.5,5.5 L7.5,7.5 L34,7.5 L34,8.5 L7.5,8.5 L7.5,10.5 L6.5,10.5 L6.5,5.5 L7.5,5.5 Z
-                                    </Path.Data>
-                                    <Path.LayoutTransform>
-                                        <RotateTransform Angle="180"></RotateTransform>
-                                    </Path.LayoutTransform>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="RArrow"  Height="20" Margin="6,0,0,0" >
-                                    <Path.Data>
-                                        M5.58660083,5.07600085 L9.46460189,7.49900085 L34,7.5 L34,8.5 L9.46460189,8.49900085 L5.58660083,10.9239992 L5.05660189,10.0760008 L8.37960136,8 L5.05660189,5.92399915 L5.58660083,5.07600085 Z
-                                    </Path.Data>
-                                    <Path.LayoutTransform>
-                                        <RotateTransform Angle="180"></RotateTransform>
-                                    </Path.LayoutTransform>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="RCloseArrow"  Height="20" Margin="6,0,0,0" >
-                                    <Path.Data>
-                                        M5.5,4.59787618 L10.143,7.49987618 L34,7.5 L34,8.5 L10.143,8.49987618 L5.5,11.4021238 L5.5,4.59787618 Z
-                                    </Path.Data>
-                                    <Path.LayoutTransform>
-                                        <RotateTransform Angle="180"></RotateTransform>
-                                    </Path.LayoutTransform>
-                                </Path>
-                            </ComboBoxItem>
-                            <ComboBoxItem VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <Path Fill="#000000" Tag="Slash"  Height="20" Margin="6,0,0,0" >
-                                    <Path.Data>
-                                        M9.531981,5.84644661 L10.239087,6.55355339 L9.292447,7.49944661 L34,7.5 L34,8.5 L8.292447,8.49944661 L6.703553,10.0890873 L5.996447,9.38198052 L9.531981,5.84644661 Z
-                                    </Path.Data>
-                                    <Path.LayoutTransform>
-                                        <RotateTransform Angle="180"></RotateTransform>
-                                    </Path.LayoutTransform>
-                                </Path>
-                            </ComboBoxItem>
-                        </ComboBox>
-                        <TextBox Background="White" Height="20"  Margin="10,0,35,0" 
-                             BorderThickness="0" VerticalAlignment="Center" IsReadOnly="True">
-                        </TextBox>
-                        <Path Name="EndArrowPath" Fill="#000000" Width="56" Height="16" Margin="12,8,0,8" HorizontalAlignment="Left">
-                            <Path.LayoutTransform>
-                                <RotateTransform Angle="180"></RotateTransform>
-                            </Path.LayoutTransform>
-                        </Path>
+                <local:ThicknessContent x:Name="layerFill" HorizontalAlignment="Right"/>
+                <Grid Grid.Row="1">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"></ColumnDefinition>
+                        <ColumnDefinition Width="auto"></ColumnDefinition>
+                    </Grid.ColumnDefinitions>
+                    <cus:ColorDropBox x:Name="ColorFillDropPicker"  Grid.Column="1" BorderThickness="1"  HorizontalAlignment="Right"
+                                BorderBrush="#E2E3E6" Width="80" Height="32">
+                    </cus:ColorDropBox>
+                    <ListBox x:Name="ListColorFill" ItemContainerStyle="{StaticResource listboxItemStyle}" ItemTemplate="{StaticResource listboxData}" BorderThickness="0" Background="Transparent">
+                        <ListBox.ItemsPanel>
+                            <ItemsPanelTemplate>
+                                <WrapPanel Orientation="Horizontal"/>
+                            </ItemsPanelTemplate>
+                        </ListBox.ItemsPanel>
+
+                    </ListBox>
+                </Grid>
 
 
-                    </Grid>
-                </Border>
             </Grid>
             </Grid>
 
 
-            <TextBlock x:Name="LineStyleText"  LineHeight="20" Margin="12,14,0,0">Line Style</TextBlock>
-
-
-            <Grid>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
+            <Grid Margin="0,18,0,0">
                 <Grid.RowDefinitions>
                 <Grid.RowDefinitions>
-                    <RowDefinition Height="auto"></RowDefinition>
-                    <RowDefinition Height="auto"></RowDefinition>
+                    <RowDefinition Height="auto"/>
+                    <RowDefinition/>
                 </Grid.RowDefinitions>
                 </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>
 
 
-
-                <Viewbox Height="18" Width="18" Margin="12,12,10,0">
-                    <RadioButton Tag="SolidLine" Name="SolidLineBtn" GroupName="LineStyleGroup" IsChecked="True" ></RadioButton>
-                </Viewbox>
-                <Line Name="SolidLineControl" Margin="0,12,0,0" Grid.Column="1" Stroke="#000000" StrokeThickness="2" X1="0" Y1="0" X2="112" Y2="0" VerticalAlignment="Center"></Line>
-                <Viewbox Grid.Row="1" Height="18" Width="18" Margin="12,22,10,0">
-                    <RadioButton Tag="DashLine" Name="DashLineBtn" GroupName="LineStyleGroup" VerticalAlignment="Center"/>
-                </Viewbox>
-
-                <Line Name="DashLineControl" Margin="0,22,0,0" Grid.Row="1" Grid.Column="1" Stroke="#000000" StrokeThickness="2" X1="0" Y1="0" X2="112" Y2="0" VerticalAlignment="Center" StrokeDashArray="0,1,1"></Line>
-                <!--<cus:AutoNumber x:Name="NumberBox" Grid.Row="1" Grid.Column="2" Width="80" Height="32" Margin="0,22,0,0" Maximum="50" Minimum="1" TickFrequency="1" Current="1"
-                              BorderBrush="#FFE2E3E6" BorderThickness="1" IsEnabled="False" NumberChanged="NumberBox_NumberChanged">
-                    <local:AutoNumber.Resources>
-                        <Style TargetType="local:AutoNumber">
-                            <Style.Triggers>
-                                <Trigger Property="IsEnabled" Value="False">
-                                    <Setter Property = "Background" Value="LightGray"/>
-                                </Trigger>
-                                <Trigger Property="IsEnabled" Value="True">
-                                    <Setter Property = "Background" Value="White"/>
-                                </Trigger>
-                            </Style.Triggers>
-                        </Style>
-                    </local:AutoNumber.Resources>
-                </cus:AutoNumber>-->
             </Grid>
             </Grid>
 
 
 
 
 
 
-            <TextBlock x:Name="thicknessText"  LineHeight="20" Margin="12,14,0,0" >Thickness</TextBlock>
-
-
             <Grid>
             <Grid>
                 <Grid.ColumnDefinitions>
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="*"></ColumnDefinition>
                     <ColumnDefinition Width="*"></ColumnDefinition>
                     <ColumnDefinition Width="auto"></ColumnDefinition>
                     <ColumnDefinition Width="auto"></ColumnDefinition>
                 </Grid.ColumnDefinitions>
                 </Grid.ColumnDefinitions>
-
-
-                <Slider Name="ThicknessSlider" VerticalAlignment="Center" Margin="12,0,4,0"  Minimum="1" Maximum="12" IsSelectionRangeEnabled="True" IsMoveToPointEnabled="True" 
-                    Style="{StaticResource RoundThumbSlider}"  TickFrequency="1" IsSnapToTickEnabled="True">
+                <Slider Name="BorderSlider" VerticalAlignment="Center" Margin="12,0,4,0"  Minimum="1" Maximum="12" IsSelectionRangeEnabled="True" IsMoveToPointEnabled="True"
+                    Style="{StaticResource RoundThumbSlider}"  TickFrequency="1" IsSnapToTickEnabled="True" >
                     <Slider.Resources>
                     <Slider.Resources>
                         <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
                         <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
                         <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
                         <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
                     </Slider.Resources>
                     </Slider.Resources>
                 </Slider>
                 </Slider>
 
 
-
                 <Border Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="0,0,12,0"  BorderThickness="0">
                 <Border Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="0,0,12,0"  BorderThickness="0">
                     <Grid>
                     <Grid>
-                        <ComboBox Name="ThicknessDropBox" BorderThickness="1" Padding="10 10 0 0" Background="Transparent" BorderBrush="#FFE2E3E6" >
+                        <ComboBox Name="BorderDropBox" BorderThickness="1" Padding="10 10 0 0" Background="Transparent" BorderBrush="#FFE2E3E6" >
                             <ComboBox.ItemContainerStyle>
                             <ComboBox.ItemContainerStyle>
                                 <Style TargetType="{x:Type ComboBoxItem}">
                                 <Style TargetType="{x:Type ComboBoxItem}">
                                     <Setter Property="Padding" Value="10 0 0 0"/>
                                     <Setter Property="Padding" Value="10 0 0 0"/>
@@ -431,75 +216,31 @@
                             <ComboBoxItem Content="9" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
                             <ComboBoxItem Content="9" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
                             <ComboBoxItem Content="12" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
                             <ComboBoxItem Content="12" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
                         </ComboBox>
                         </ComboBox>
-                        <TextBox FontFamily="Segoe UI" FontSize="14" Background="White" Padding="0" Height="20" Margin="10,0,35,0" IsReadOnly="True"
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" Text="{Binding ElementName=ThicknessSlider,Path=Value}">
+                        <TextBox FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Margin="10,0,35,0" IsReadOnly="True"
+                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" Text="{Binding ElementName=BorderSlider,Path=Value}">
                         </TextBox>
                         </TextBox>
-
                     </Grid>
                     </Grid>
                 </Border>
                 </Border>
             </Grid>
             </Grid>
 
 
-            <TextBlock x:Name="opacityText" LineHeight="20" Margin="12,14,0,0" >Opacity</TextBlock>
 
 
-
-            <Grid>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-
-
-                <Slider Name="OpacitySlider" VerticalAlignment="Center" Margin="12,0,4,0"  Minimum="0" Maximum="1" IsSelectionRangeEnabled="True" IsMoveToPointEnabled="True" 
-                    Style="{StaticResource RoundThumbSlider}"  TickFrequency="0.01" >
-                    <Slider.Resources>
-                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
-                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
-                    </Slider.Resources>
-                </Slider>
-
-                <Border Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="0,0,12,0"  BorderThickness="0">
-                    <Grid>
-                        <ComboBox Name="OpacityDropBox" BorderThickness="1" Padding="10 10 0 0" Background="Transparent" BorderBrush="#FFE2E3E6">
-                            <ComboBox.ItemContainerStyle>
-                                <Style TargetType="{x:Type ComboBoxItem}">
-                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                </Style>
-                            </ComboBox.ItemContainerStyle>
-                            <ComboBoxItem Content="25%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}" />
-                            <ComboBoxItem Content="50%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
-                            <ComboBoxItem Content="75%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
-                            <ComboBoxItem Content="100%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}"/>
-                        </ComboBox>
-                        <TextBox FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Margin="10,0,23,0" 
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" IsReadOnly="True">
-                            <TextBox.Style>
-                                <Style TargetType="TextBox">
-                                    <Style.Setters>
-                                        <Setter Property="TextBox.Text">
-                                            <Setter.Value>
-                                                <MultiBinding StringFormat="P0">
-                                                    <Binding ElementName="OpacitySlider" Path="Value"></Binding>
-                                                </MultiBinding>
-                                            </Setter.Value>
-                                        </Setter>
-                                    </Style.Setters>
-                                </Style>
-                            </TextBox.Style>
-                        </TextBox>
-                    </Grid>
-                </Border>
-            </Grid>
+            <StackPanel Orientation="Horizontal" Margin="0,20,0,0">
+                <cus:CustomIconToggleBtn x:Name="BtnListMode" Tag="Line" Width="110" Height="32"
+                                              Style="{StaticResource ToggleBtnViewModeStyle}">
+                    <Border BorderBrush="Black" BorderThickness="1" Padding="8,0,8,0" Width="108" Height="30">
+                        <Line X1="10" Y1="15" X2="260" Y2="15" Stroke="Black" StrokeThickness="2" />
+                    </Border>
+                </cus:CustomIconToggleBtn>
+                <cus:CustomIconToggleBtn x:Name="BtnListMode1" Tag="Line" Width="110" Height="32"
+                                              Style="{StaticResource ToggleBtnViewModeStyle}">
+                    <Border BorderBrush="Black" BorderThickness="1" Padding="8,0,8,0" Width="108" Height="30" >
+                        <Line X1="10" Y1="15" X2="260" Y2="15" Stroke="Black" StrokeThickness="2" StrokeDashArray="2"/>
+                    </Border>
+                </cus:CustomIconToggleBtn>
+            </StackPanel>
 
 
 
 
 
 
-            <StackPanel Margin="0 36 0 0">
-                <cus:ToastControl x:Name="tip" Width="auto" Height="20" FontSize="12" Background="#1A477EDE" Foreground="#477EDE"/>
-                <Button x:Name="UseAsDefaultBtn" Content="Use As Default"  Margin="12,8,12,0" Width="232" Height="32" Foreground="#273C62" FontWeight="SemiBold"
-                Background="White" BorderThickness="1" BorderBrush="#273C62" FontFamily="SegoeUI" FontSize="14" ></Button>
-            </StackPanel>
-            <TextBlock x:Name="noteText" Text="Note" LineHeight="20" Margin="12,30,0,0"></TextBlock>
-            <TextBox Name="AnnotNoteText" FontSize="14" TextWrapping="Wrap" BorderBrush="#E2E3E6" Width="232" Height="96" Margin="12,10,12,0"  AcceptsReturn="True">
-            </TextBox>
         </StackPanel>
         </StackPanel>
     </Grid>
     </Grid>
 </UserControl>
 </UserControl>

+ 19 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/SharpsAnnotProperty.xaml.cs

@@ -20,9 +20,28 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
     /// </summary>
     /// </summary>
     public partial class SharpsAnnotProperty : UserControl
     public partial class SharpsAnnotProperty : UserControl
     {
     {
+        private List<string> colors = new List<string>();
+        private List<string> colorFills = new List<string>();
         public SharpsAnnotProperty()
         public SharpsAnnotProperty()
         {
         {
             InitializeComponent();
             InitializeComponent();
+            colors.Add("#FFFF10");
+            colors.Add("#FF1010");
+            colors.Add("#10FF10");
+            colors.Add("#1070FF");
+            ListColor.ItemsSource = colors;
+
+            colorFills.Add("#FFFF10");
+            colorFills.Add("#FF1010");
+            colorFills.Add("#10FF10");
+            colorFills.Add("#1070FF");
+            ListColorFill.ItemsSource = colorFills;
+
+        }
+
+        private void ChangeColorMenuItem_Click(object sender, RoutedEventArgs e)
+        {
+
         }
         }
     }
     }
 }
 }

+ 49 - 97
PDF Office/Views/PropertyPanel/AnnotPanel/TextAnnotProperty.xaml

@@ -19,14 +19,38 @@
                 <ResourceDictionary Source="../../../Styles/SliderStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="../../../Styles/SliderStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
             </ResourceDictionary.MergedDictionaries>
             <Convert:AnnotArgsTypeConverter x:Key="AnnotArgsTypeConverter"/>
             <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>
         </ResourceDictionary>
+      
     </UserControl.Resources>
     </UserControl.Resources>
-    <Grid  VerticalAlignment="Stretch" Background="Wheat">
+    <Grid  VerticalAlignment="Stretch" Background="#F3F3F3">
         <StackPanel Margin="12 0 12 0">
         <StackPanel Margin="12 0 12 0">
-            <TextBlock Name="AnnotTypeTitle" FontFamily="Segoe UI" FontWeight="Bold" FontSize="18" LineHeight="24" HorizontalAlignment="Center" Margin="0,8,0,0"
+            <TextBlock Name="AnnotTypeTitle" FontFamily="Segoe UI" FontWeight="Bold" FontSize="18" LineHeight="24" HorizontalAlignment="Left" Margin="0,16,0,8"
                        Text="{Binding AnnotTypeTitle}"
                        Text="{Binding AnnotTypeTitle}"
                        ></TextBlock>
                        ></TextBlock>
-            <Border Width="232" Height="80" BorderThickness="1" BorderBrush="#E2E3E6" Margin="0,8,0,0">
+            <Border Width="228" Height="100" BorderThickness="1" CornerRadius="2" BorderBrush="#DDDDDD" Background="White" Margin="0,8,0,0">
                 <Grid>
                 <Grid>
                     <TextBlock Name="SampleText" Text="Sample" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontFamily="Segoe UI" FontSize="18"
                     <TextBlock Name="SampleText" Text="Sample" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontFamily="Segoe UI" FontSize="18"
                              Background="{Binding SampleTextBg}" 
                              Background="{Binding SampleTextBg}" 
@@ -54,103 +78,31 @@
             </Border>
             </Border>
 
 
             <Grid Margin="0,18,0,0">
             <Grid Margin="0,18,0,0">
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-                <TextBlock x:Name="colorText"  LineHeight="20" TextAlignment="Left" VerticalAlignment="Center">Color</TextBlock>
-                <cus:ColorDropBox x:Name="ColorDropPicker" Grid.Column="1" BorderThickness="1"  HorizontalAlignment="Right"
-                                BorderBrush="#E2E3E6" Width="80" Height="32" SelectedColorChanged="ColorDropPicker_SelectedColorChanged">
-                </cus:ColorDropBox>
-            </Grid>
-
-            <TextBlock x:Name="opacityText"  TextAlignment="Left" LineHeight="20" Margin="0,14,0,0" >Opacity</TextBlock>
-
-            <Grid>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*"></ColumnDefinition>
-                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                </Grid.ColumnDefinitions>
-                <Slider Name="OpacitySlider" HorizontalAlignment="Left" VerticalAlignment="Center" Minimum="0" Maximum="1" IsSelectionRangeEnabled="True" IsSnapToTickEnabled="True" IsMoveToPointEnabled="True"
-                     Value="{Binding AnnotOpacity}"
-                    Style="{StaticResource RoundThumbSlider}" Width="148" TickFrequency="0.01" Thumb.DragStarted="OpacitySlider_DragStarted" 
-                    Thumb.DragCompleted="OpacitySlider_DragCompleted">
-                    <Slider.Resources>
-                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#477EDE" />
-                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlDarkDarkBrushKey}" Color="#E2E3E6" />
-                    </Slider.Resources>
+                <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>
 
 
-                    <i:Interaction.Triggers>
-                        <i:EventTrigger EventName="ValueChanged">
-                            <i:InvokeCommandAction Command="{Binding OpacityValueChangedCommand}" CommandParameter="75"/>
-                        </i:EventTrigger>
-                    </i:Interaction.Triggers>
-                </Slider>
-
-                <Border Grid.Column="1" HorizontalAlignment="Right" Background="Transparent" BorderBrush="#E2E3E6"  Width="80" Height="32"  BorderThickness="0">
-                    <Grid>
-                        <ComboBox Name="OpacityDropBox" BorderThickness="1" Background="Transparent" BorderBrush="#FFE2E3E6">
-                            <ComboBoxItem Content="25%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <i:Interaction.Triggers>
-                                    <i:EventTrigger EventName="PreviewMouseDown">
-                                        <i:InvokeCommandAction Command="{Binding OpacityItemCommand}" CommandParameter="25"/>
-                                    </i:EventTrigger>
-                                </i:Interaction.Triggers>
-                            </ComboBoxItem>
-
-                            <ComboBoxItem Content="50%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}" >
-                                <i:Interaction.Triggers>
-                                    <i:EventTrigger EventName="PreviewMouseDown">
-                                        <i:InvokeCommandAction Command="{Binding OpacityItemCommand}" CommandParameter="50"/>
-                                    </i:EventTrigger>
-                                </i:Interaction.Triggers>
-                            </ComboBoxItem>
-                            <ComboBoxItem Content="75%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                <i:Interaction.Triggers>
-                                    <i:EventTrigger EventName="PreviewMouseDown">
-                                        <i:InvokeCommandAction Command="{Binding OpacityItemCommand}" CommandParameter="75"/>
-                                    </i:EventTrigger>
-                                </i:Interaction.Triggers>
-                            </ComboBoxItem>
-                            <ComboBoxItem Content="100%" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}" >
-                                <i:Interaction.Triggers>
-                                    <i:EventTrigger EventName="PreviewMouseDown">
-                                        <i:InvokeCommandAction Command="{Binding OpacityItemCommand}" CommandParameter="100"/>
-                                    </i:EventTrigger>
-                                </i:Interaction.Triggers>
-                            </ComboBoxItem>
-                        </ComboBox>
-                        
-                        <TextBox FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Margin="2,0,23,0" IsReadOnly="True"
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Center">
-                            <TextBox.Style>
-                                <Style TargetType="TextBox">
-                                    <Style.Setters>
-                                        <Setter Property="TextBox.Text">
-                                            <Setter.Value>
-                                                <MultiBinding StringFormat="P0">
-                                                    <Binding ElementName="OpacitySlider" Path="Value"></Binding>
-                                                </MultiBinding>
-                                            </Setter.Value>
-                                        </Setter>
-                                    </Style.Setters>
-                                </Style>
-                            </TextBox.Style>
-                        </TextBox>
-                    </Grid>
-                </Border>
+                    </ListBox>
+                </Grid>
+               
             </Grid>
             </Grid>
 
 
-
-            <StackPanel Margin="0 36 0 0">
-                <cus:ToastControl x:Name="tip" Width="auto" Height="20" FontFamily="Segoe UI" FontSize="12" Background="#1A477EDE" Foreground="#477EDE"/>
-
-                <Button x:Name="UseAsDefaultBtn"  Margin="0 8 0 0" Content="Use As Default"  Width="232" Height="32" Foreground="#273C62" FontWeight="SemiBold"
-                Background="White" BorderThickness="1" BorderBrush="#273C62" FontFamily="Segoe UI" FontSize="14" ></Button>
-            </StackPanel>
-            <TextBlock x:Name="NoteText" Text="Note" TextAlignment="Left" LineHeight="20" Margin="0,30,0,0"></TextBlock>
-            <TextBox Name="AnnotNoteText" FontSize="14" TextWrapping="Wrap" BorderBrush="#E2E3E6" Width="232" Height="96" Margin="0,10,0,0"  AcceptsReturn="True">
-            </TextBox>
         </StackPanel>
         </StackPanel>
     </Grid>
     </Grid>
 </UserControl>
 </UserControl>

+ 15 - 404
PDF Office/Views/PropertyPanel/AnnotPanel/TextAnnotProperty.xaml.cs

@@ -25,9 +25,15 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
     /// </summary>
     /// </summary>
     public partial class TextAnnotProperty : UserControl
     public partial class TextAnnotProperty : UserControl
     {
     {
+        private List<string> colors = new List<string>(); 
         public TextAnnotProperty()
         public TextAnnotProperty()
         {
         {
             InitializeComponent();
             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)
         private void OpacitySlider_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
@@ -53,410 +59,15 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
                 data.SelectedColorChangedCommand?.Execute(e.Value);
                 data.SelectedColorChangedCommand?.Execute(e.Value);
             }
             }
         }
         }
-    }
-    //public partial class TextAnnotProperty : UserControl
-    //{
-    //    /// <summary>
-    //    /// 属性更改事件
-    //    /// </summary>
-    //    public event EventHandler<Dictionary<AnnotArgsType, object>> DataChanged;
-    //    /// <summary>
-    //    /// 默认值设置事件
-    //    /// </summary>
-    //    public event EventHandler<object> DefaultStored;
-    //    public Color? SelectedColor { get { return ColorDropPicker.SelectedColor; } }
-    //    public string AnnotTitle { get { return AnnotTypeTitle.Text; } }
-    //    public string AnnoteNote { get { return AnnotNoteText.Text; } }
-    //    public double AnnotOpacity { get { return OpacitySlider.Value; } }
-    //    public AnnotArgsType AnnotType { get; private set; }
-    //    public AnnotAttribEvent AnnotEvent { get; set; }
-
-    //    private bool DisableValueChange = false;
-
-    //    public TextAnnotProperty()
-    //    {
-    //        InitializeComponent();
-    //        SetLangText();
-
-    //        string font = Settings.Default.AppProperties.Annotate.AnchoredFamaily;
-    //        if (font.Equals("Courier"))
-    //            AnnotNoteText.FontFamily = new FontFamily("Courier New");
-    //        else if (font.Equals("Helvetica"))
-    //            AnnotNoteText.FontFamily = new FontFamily("Arial");
-    //        else
-    //            AnnotNoteText.FontFamily = new FontFamily("Times New Roman");
-    //        DataContext = this;
-    //        PathFigure FigureData = GetSquigglyPathFigure(new Point(0, 0), new Point(62, 0), 60, 2);
-    //        PathGeometry SquigglyGeometry = new PathGeometry();
-    //        PathFigureCollection FiguresCollection = new PathFigureCollection();
-    //        SquigglyGeometry.Figures = FiguresCollection;
-    //        FiguresCollection.Add(FigureData);
-    //        SquigglyPath.Data = SquigglyGeometry;
-    //    }
-
-
-    //    private void SetLangText()
-    //    {
-    //        //SampleText.Text = App.MainPageLoader.GetString("ProperPanel_Example");
-    //        //colorText.Text = App.MainPageLoader.GetString("ProperPanel_Color");
-    //        //opacityText.Text = App.MainPageLoader.GetString("ProperPanel_Opacity");
-    //        //UseAsDefaultBtn.Content = App.MainPageLoader.GetString("ProperPanel_SetAsDefault");
-    //        //NoteText.Text = App.MainPageLoader.GetString("ProperPanel_Note");
-    //    }
-    //    private void SetTextDecoratePath(Color? selectColor, double? opacity)
-    //    {
-    //        UnderlinePath.Visibility = Visibility.Collapsed;
-    //        StrikeoutPath.Visibility = Visibility.Collapsed;
-    //        SquigglyPath.Visibility = Visibility.Collapsed;
-    //        UnderlinePath.Opacity = 1;
-    //        StrikeoutPath.Opacity = 1;
-    //        UnderlinePath.Opacity = 1;
-
-    //        switch (AnnotType)
-    //        {
-    //            case AnnotArgsType.AnnotHighlight:
-    //                if (selectColor != null)
-    //                {
-    //                    SampleText.Background = new SolidColorBrush((Color)selectColor);
-    //                }
-    //                if (opacity != null)
-    //                {
-    //                    SampleText.Background.Opacity = (double)opacity;
-    //                }
-    //                break;
-    //            case AnnotArgsType.AnnotUnderline:
-    //                UnderlinePath.Visibility = Visibility.Visible;
-    //                SampleText.Background = Brushes.Transparent;
-    //                if (opacity != null)
-    //                {
-    //                    UnderlinePath.Opacity = (double)opacity;
-    //                }
-    //                if (selectColor != null)
-    //                {
-    //                    UnderlinePath.Stroke = new SolidColorBrush((Color)selectColor);
-    //                }
-    //                break;
-    //            case AnnotArgsType.AnnotStrikeout:
-    //                StrikeoutPath.Visibility = Visibility.Visible;
-    //                SampleText.Background = Brushes.Transparent;
-    //                if (opacity != null)
-    //                {
-    //                    StrikeoutPath.Opacity = (double)opacity;
-    //                }
-    //                if (selectColor != null)
-    //                {
-    //                    StrikeoutPath.Stroke = new SolidColorBrush((Color)selectColor);
-    //                }
-    //                break;
-    //            case AnnotArgsType.AnnotSquiggly:
-    //                SquigglyPath.Visibility = Visibility.Visible;
-    //                SampleText.Background = Brushes.Transparent;
-    //                if (opacity != null)
-    //                {
-    //                    SquigglyPath.Opacity = (double)opacity;
-    //                }
-    //                if (selectColor != null)
-    //                {
-    //                    SquigglyPath.Stroke = new SolidColorBrush((Color)selectColor);
-    //                }
-    //                break;
-    //            case AnnotArgsType.AnnotSticky:
-    //                {
-    //                    if (opacity != null)
-    //                    {
-    //                        StickyPath.Opacity = (double)opacity;
-    //                    }
-    //                    if (selectColor != null)
-    //                    {
-    //                        StickyPath.Fill = new SolidColorBrush((Color)selectColor);
-    //                    }
-    //                }
-    //                break;
-    //            default:
-    //                break;
-    //        }
-    //    }
-
-    //    public void SetSelectedColor(Color selectColor)
-    //    {
-    //        bool changed = false;
-    //        if (ColorDropPicker.SelectedColor != selectColor)
-    //        {
-    //            changed = true;
-    //        }
-    //        ColorDropPicker.SetSelectedColor(selectColor);
-    //        SetTextDecoratePath(selectColor, null);
-    //        if (changed)
-    //        {
-    //            Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
-    //            changeData[AnnotType] = selectColor;
-    //            DataChanged?.Invoke(this, changeData);
-    //        }
-    //    }
-
-    //    public void SetSelectOpacity(double opacity)
-    //    {
-    //        OpacitySlider.Value = opacity;
-    //        SetTextDecoratePath(null, opacity);
-    //    }
-    //    public void SetNoteContent(string textNote)
-    //    {
-    //        AnnotNoteText.Text = textNote;
-    //    }
-
-    //    public void SetAnnotType(AnnotArgsType annotType)
-    //    {
-    //        //AnnotType = annotType;
-    //        //switch (annotType)
-    //        //{
-    //        //    case AnnotArgsType.AnnotHighlight:
-    //        //        AnnotTypeTitle.Text = App.MainPageLoader.GetString("SubTools_Tools_Highlight");
-    //        //        break;
-    //        //    case AnnotArgsType.AnnotUnderline:
-    //        //        AnnotTypeTitle.Text = App.MainPageLoader.GetString("SubTools_Tools_Underline");
-    //        //        break;
-    //        //    case AnnotArgsType.AnnotStrikeout:
-    //        //        AnnotTypeTitle.Text = App.MainPageLoader.GetString("SubTools_Tools_Strikthrough");
-    //        //        break;
-    //        //    case AnnotArgsType.AnnotSquiggly:
-    //        //        AnnotTypeTitle.Text = App.MainPageLoader.GetString("SubTools_Tools_Squiggly");
-    //        //        break;
-    //        //    case AnnotArgsType.AnnotSticky:
-    //        //        AnnotTypeTitle.Text = App.MainPageLoader.GetString("SubTools_Tools_AnchoredNote");
-    //        //        SampleText.Visibility = Visibility.Collapsed;
-    //        //        StickyPath.Visibility = Visibility.Visible;
-    //        //        break;
-    //        //    default:
-    //        //        break;
-    //        //}
-    //    }
-
-    //    private void ColorDropPicker_SelectedColorChanged(object sender, Color? e)
-    //    {
-    //        if (e != null && AnnotEvent != null)
-    //        {
-    //            AnnotEvent.UpdateAttrib(AnnotAttrib.Color, e);
-    //            AnnotEvent.UpdateAnnot();
-    //            double? opacity = null;
-    //            if (OpacitySlider != null)
-    //            {
-    //                opacity = OpacitySlider.Value;
-    //            }
-    //            SetTextDecoratePath(e, opacity);
-    //            if (e != null)
-    //            {
-    //                Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
-    //                changeData[AnnotType] = e;
-    //                DataChanged?.Invoke(this, changeData);
-    //            }
-    //        }
-    //    }
-
-    //    private void OpacitySlider_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
-    //    {
-    //        DisableValueChange = false;
-    //        if (AnnotEvent != null)
-    //        {
-    //            AnnotEvent.UpdateAttrib(AnnotAttrib.Transparency, OpacitySlider.Value);
-    //            AnnotEvent.UpdateAnnot();
-    //            SetTextDecoratePath(null, OpacitySlider.Value);
-    //            if (e != null)
-    //            {
-    //                Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
-    //                changeData[AnnotType] = OpacitySlider.Value;
-    //                DataChanged?.Invoke(this, changeData);
-    //            }
-    //        }
-    //    }
 
 
-    //    private void OpacitySlider_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
-    //    {
-    //        DisableValueChange = true;
-    //    }
-
-    //    private void OpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
-    //    {
-    //        if (AnnotEvent != null && DisableValueChange == false)
-    //        {
-    //            AnnotEvent.UpdateAttrib(AnnotAttrib.Transparency, e.NewValue);
-    //            AnnotEvent.UpdateAnnot();
-    //            SetTextDecoratePath(null, e.NewValue);
-    //            if (e != null)
-    //            {
-    //                Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
-    //                changeData[AnnotType] = e.NewValue;
-    //                DataChanged?.Invoke(this, changeData);
-    //            }
-    //        }
-    //    }
-
-    //    private PathFigure GetSquigglyPathFigure(Point StartPoint, Point EndPoint, double PathWidth, double PathHeight)
-    //    {
-    //        PathFigure FigureData = new PathFigure();
-    //        FigureData.StartPoint = StartPoint;
-
-    //        int Radius = (int)Math.Max(2, 2);
-    //        if (PathWidth > PathHeight)
-    //        {
-    //            // 橫線
-    //            var arcCount = PathWidth / (Radius * 2);
-    //            var x = StartPoint.X;
-    //            if (EndPoint.X > StartPoint.X)
-    //            {
-    //                // left to right 
-    //                for (int i = 0; i < arcCount; i++)
-    //                {
-    //                    if (i % 2 == 0)
-    //                    {
-    //                        // 上弧
-    //                        FigureData.Segments.Add(new BezierSegment()
-    //                        {
-    //                            Point1 = new Point(x, StartPoint.Y),
-    //                            Point2 = new Point(x + Radius, StartPoint.Y - Radius),
-    //                            Point3 = new Point(x + Radius * 2, StartPoint.Y)
-    //                        });
-    //                    }
-    //                    else
-    //                    {
-    //                        // 下弧
-    //                        FigureData.Segments.Add(new BezierSegment()
-    //                        {
-    //                            Point1 = new Point(x, StartPoint.Y),
-    //                            Point2 = new Point(x + Radius, StartPoint.Y + Radius),
-    //                            Point3 = new Point(x + Radius * 2, StartPoint.Y)
-    //                        });
-    //                    }
-    //                    x += Radius * 2;
-    //                }
-    //            }
-    //            else
-    //            {
-    //                // right to left 
-    //                for (int i = 0; i < arcCount; i++)
-    //                {
-    //                    if (i % 2 == 0)
-    //                    {
-    //                        //下弧
-    //                        FigureData.Segments.Add(new BezierSegment()
-    //                        {
-    //                            Point1 = new Point(x, StartPoint.Y),
-    //                            Point2 = new Point(x - Radius, StartPoint.Y + Radius),
-    //                            Point3 = new Point(x - Radius * 2, StartPoint.Y)
-    //                        });
-    //                    }
-    //                    else
-    //                    {
-    //                        //上弧
-    //                        FigureData.Segments.Add(new BezierSegment()
-    //                        {
-    //                            Point1 = new Point(x, StartPoint.Y),
-    //                            Point2 = new Point(x - Radius, StartPoint.Y - Radius),
-    //                            Point3 = new Point(x - Radius * 2, StartPoint.Y)
-    //                        });
-    //                    }
-    //                    x -= Radius * 2;
-    //                }
-    //            }
-    //        }
-    //        else
-    //        {
-    //            // 直線
-    //            var arcCount = PathHeight / (Radius * 2);
-    //            var y = StartPoint.Y;
-    //            if (EndPoint.Y > StartPoint.Y)
-    //            {
-    //                // up to down 
-    //                for (int i = 0; i < arcCount; i++)
-    //                {
-    //                    if (i % 2 == 0)
-    //                    {
-    //                        //右弧
-    //                        FigureData.Segments.Add(new BezierSegment()
-    //                        {
-    //                            Point1 = new Point(StartPoint.X, y),
-    //                            Point2 = new Point(StartPoint.X + Radius, y + Radius),
-    //                            Point3 = new Point(StartPoint.X, y + Radius * 2)
-    //                        });
-    //                    }
-    //                    else
-    //                    {
-    //                        //左弧
-    //                        FigureData.Segments.Add(new BezierSegment()
-    //                        {
-    //                            Point1 = new Point(StartPoint.X, y),
-    //                            Point2 = new Point(StartPoint.X - Radius, y + Radius),
-    //                            Point3 = new Point(StartPoint.X, y + Radius * 2)
-    //                        });
-    //                    }
-    //                    y += Radius * 2;
-    //                }
-    //            }
-    //            else
-    //            {
-    //                // down to up
-    //                for (int i = 0; i < arcCount; i++)
-    //                {
-    //                    if (i % 2 == 0)
-    //                    {
-    //                        //左弧
-    //                        FigureData.Segments.Add(new BezierSegment()
-    //                        {
-    //                            Point1 = new Point(StartPoint.X, y),
-    //                            Point2 = new Point(StartPoint.X - Radius, y - Radius),
-    //                            Point3 = new Point(StartPoint.X, y - Radius * 2)
-    //                        });
-    //                    }
-    //                    else
-    //                    {
-    //                        //右弧
-    //                        FigureData.Segments.Add(new BezierSegment()
-    //                        {
-    //                            Point1 = new Point(StartPoint.X, y),
-    //                            Point2 = new Point(StartPoint.X + Radius, y - Radius),
-    //                            Point3 = new Point(StartPoint.X, y - Radius * 2)
-    //                        });
-    //                    }
-    //                    y -= Radius * 2;
-    //                }
-    //            }
-    //        }
-
-    //        return FigureData;
-    //    }
-
-    //    private void Button_StoreAsDefaultProperty(object sender, RoutedEventArgs e)
-    //    {
-    //        DefaultAnnotProperty defaultProperty = new DefaultAnnotProperty();
-    //        defaultProperty.AnnotToolType = AnnotType;
-    //        defaultProperty.ForgoundColor = ColorDropPicker.SelectedColor == null ? Colors.Yellow : (Color)ColorDropPicker.SelectedColor;
-    //        defaultProperty.Opacity = OpacitySlider.Value;
-    //        Helper.SettingHelper.SetAnnotDefaultProperty(defaultProperty);
-    //        DefaultStored?.Invoke(this, null);
-
-    //    }
-
-    //    private void AnnotNoteText_LostFocus(object sender, RoutedEventArgs e)
-    //    {
-    //        AnnotEvent?.UpdateAttrib(AnnotAttrib.NoteText, AnnotNoteText.Text);
-    //        AnnotEvent?.UpdateAnnot();
-    //    }
-
-    //    public void NoteFocus()
-    //    {
-    //        AnnotNoteText.Focus();
-    //    }
+        private void ChangeColorMenuItem_Click(object sender, RoutedEventArgs e)
+        {
+            var data = (sender as FrameworkElement).DataContext as string;
+            var listBoxItem = ListColor.ItemContainerGenerator.ContainerFromItem(data) as ListBoxItem;
 
 
-    //    private void OpacityItem_PreviewMouseDown(object sender, MouseButtonEventArgs e)
-    //    {
-    //        ComboBoxItem selectItem = sender as ComboBoxItem;
-    //        if (selectItem != null && selectItem.Content != null)
-    //        {
-    //            int opacity = -1;
-    //            if (int.TryParse(selectItem.Content.ToString().TrimEnd('%'), out opacity))
-    //            {
-    //                OpacitySlider.Value = opacity / 100D;
-    //            }
-    //        }
-    //    }
-    //}
+            if (listBoxItem != null)
+                ColorDropPicker?.ShowLayer(listBoxItem);
+        }
+    }
+   
 }
 }

+ 23 - 3
PDF Office/Views/PropertyPanel/AnnotPanel/ThicknessContent.xaml.cs

@@ -127,7 +127,18 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             AddToLayer();
             AddToLayer();
         }
         }
 
 
-        private void AddToLayer()
+        public void ShowLayer(DependencyObject dependencyObject = null)
+        {
+            if (layerAdded)
+            {
+                RemoveFromLayer();
+                return;
+            }
+            AddToLayer(dependencyObject);
+        }
+
+
+        private void AddToLayer(DependencyObject dependencyObject = null)
         {
         {
             Window parentWnd = Window.GetWindow(this);
             Window parentWnd = Window.GetWindow(this);
             popLayer = AdornerLayer.GetAdornerLayer(parentWnd.Content as UIElement);
             popLayer = AdornerLayer.GetAdornerLayer(parentWnd.Content as UIElement);
@@ -146,7 +157,7 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
 
 
                 //    colorPop.ColorSelected += ColorPop_ColorSelected;
                 //    colorPop.ColorSelected += ColorPop_ColorSelected;
                 }
                 }
-                Point offset = GetOffsetToWindow();
+                Point offset = GetOffsetToWindow(dependencyObject);
                 colorPop.Visibility = Visibility.Visible;
                 colorPop.Visibility = Visibility.Visible;
                 colorPop.Measure(new Size(parentWnd.ActualWidth, parentWnd.ActualHeight));
                 colorPop.Measure(new Size(parentWnd.ActualWidth, parentWnd.ActualHeight));
                 colorPop.SetValue(Canvas.TopProperty, offset.Y + this.ActualHeight + 2);
                 colorPop.SetValue(Canvas.TopProperty, offset.Y + this.ActualHeight + 2);
@@ -230,9 +241,18 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             RemoveFromLayer();
             RemoveFromLayer();
         }
         }
 
 
-        public Point GetOffsetToWindow()
+        public Point GetOffsetToWindow(DependencyObject dependencyObject = null)
         {
         {
             Window parentWnd = Window.GetWindow(this);
             Window parentWnd = Window.GetWindow(this);
+            if (dependencyObject != null)
+            {
+                var frame = dependencyObject as FrameworkElement;
+                if (frame != null)
+                {
+                    return frame.TransformToAncestor(parentWnd).Transform(new Point(0, 0));
+                }
+            }
+
             return TransformToAncestor(parentWnd).Transform(new Point(0, 0));
             return TransformToAncestor(parentWnd).Transform(new Point(0, 0));
         }
         }