Procházet zdrojové kódy

注释 - 优化形状注释属性面板

chenrongqian@kdanmobile.com před 2 roky
rodič
revize
0d6893b851

+ 1 - 1
PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreehandAnnotPropertyViewModel.cs

@@ -273,7 +273,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                             }
                         }
                     }
-
+                    
                     BasicVm.SetStrDashStyle(isSolid ? "Solid" : "Dash");
                     IsPen = true;
                 }

+ 106 - 180
PDF Office/ViewModels/PropertyPanel/AnnotPanel/SharpsAnnotPropertyViewModel.cs

@@ -50,87 +50,11 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
     public class SharpsAnnotPropertyViewModel : BindableBase, INavigationAware
     {
         #region 属性
-
-        private AnnotArgsType annotType;
-        public AnnotArgsType AnnotType
-        {
-            get { return annotType; }
-            set
-            {
-                SetProperty(ref annotType, value);
-                SetAnnotType();
-            }
-        }
-
-        private string annotTypeTitle;
-        public string AnnotTypeTitle
+        private AnnotBasePropertyVM _basicVm = new AnnotBasePropertyVM();
+        public AnnotBasePropertyVM BasicVm
         {
-            get { return annotTypeTitle; }
-            set
-            {
-                SetProperty(ref annotTypeTitle, value);
-            }
-        }
-
-        private Brush selectColor = new SolidColorBrush(Colors.Transparent);
-        public Brush SelectColor
-        {
-            get { return selectColor; }
-            set
-            {
-                SetProperty(ref selectColor, value);
-                AnnotEvent?.UpdateAttrib(AnnotAttrib.Color, (selectColor as SolidColorBrush).Color);
-                AnnotEvent?.UpdateAnnot();
-            }
-        }
-
-        private Brush fillColor = new SolidColorBrush(Colors.Transparent);
-        public Brush FillColor
-        {
-            get { return fillColor; }
-            set
-            {
-                SetProperty(ref fillColor, value);
-                AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, (fillColor as SolidColorBrush).Color);
-                AnnotEvent?.UpdateAnnot();
-            }
-        }
-
-        private double borderOpacity = 1;
-        public double BorderOpacity
-        {
-            get { return borderOpacity; }
-            set
-            {
-                SetProperty(ref borderOpacity, value);
-            }
-        }
-
-        private double fillOpacity = 1;
-        public double FillOpacity
-        {
-            get { return fillOpacity; }
-            set
-            {
-                SetProperty(ref fillOpacity, value);
-            }
-        }
-
-        private double lineWidth = 1;
-        public double LineWidth
-        {
-            get { return lineWidth; }
-            set
-            {
-                SetProperty(ref lineWidth, value);
-
-                if (annotType == AnnotArgsType.AnnotLine)
-                    AnnotEvent?.UpdateAttrib(AnnotAttrib.Thickness, lineWidth);
-                else
-                    AnnotEvent?.UpdateAttrib(AnnotAttrib.Thickness, lineWidth);
-
-                AnnotEvent?.UpdateAnnot();
-            }
+            get { return _basicVm; }
+            set => SetProperty(ref _basicVm, value);
         }
 
         private Geometry dataPath = null;
@@ -150,19 +74,6 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             set
             {
                 SetProperty(ref dash, value);
-                if (IsMultiSelected)
-                {
-                    foreach (var item in PropertyPanel.AnnotEvents)
-                    {
-                        UpdateDash(item);
-                    }
-                }
-                else
-                {
-                    UpdateDash(AnnotEvent);
-                }
-
-               
             }
         }
 
@@ -189,17 +100,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             attribEvent?.UpdateAnnot();
         }
 
-        private bool _isMultiSelected = false;
-        public bool IsMultiSelected
-        {
-            get { return _isMultiSelected; }
-            set => SetProperty(ref _isMultiSelected, value);
-        }
-
         #endregion
 
         public DelegateCommand<object> SelectedThickCommand { get; set; }
-        public DelegateCommand<object> SelectedColorCommand { get; set; }
+        public DelegateCommand<object> SelectedBorderColorCommand { get; set; }
 
         public DelegateCommand<object> SelectedFillOpacityCommand { get; set; }
         public DelegateCommand<object> SelectedFillColorCommand { get; set; }
@@ -214,15 +118,16 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         public event EventHandler<object> LoadPropertyHandler;
         public SharpsAnnotPropertyViewModel()
         {
-            SelectedThickCommand = new DelegateCommand<object>(SelectedThick_Command);
-            SelectedColorCommand = new DelegateCommand<object>(SelectedColor_Command);
+            SharpsTypeCommand = new DelegateCommand<object>(SharpsType_Command);
             SelectedFillOpacityCommand = new DelegateCommand<object>(SelectedFillOpacity_Command);
             SelectedFillColorCommand = new DelegateCommand<object>(SelectedFillColor_Command);
-            LineStyleCommand = new DelegateCommand<object>(LineStyle_Command);
-            SharpsTypeCommand = new DelegateCommand<object>(SharpsType_Command);
-            ThicknessChangedCommand = new DelegateCommand<object>(ThicknessChanged_Command);
+
+            SelectedThickCommand = new DelegateCommand<object>(SelectedThick_Command);
+            SelectedBorderColorCommand = new DelegateCommand<object>(SelectedBorderColor);
             SelectedOpacityValueCommand = new DelegateCommand<object>(SelectedOpacityValue);
 
+            ThicknessChangedCommand = new DelegateCommand<object>(ThicknessChanged_Command);
+            LineStyleCommand = new DelegateCommand<object>(LineStyle_Command);
         }
 
         private void ThicknessChanged_Command(object obj)
@@ -234,7 +139,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                 if (content != null)
                 {
                     var intData = int.Parse(content);
-                    LineWidth = intData;
+                    BasicVm.AnnotThickness = intData; 
                 }
             }
         }
@@ -313,34 +218,34 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     dashAnnot.Dashes.Add(0);
                     dashAnnot.Dashes.Add(0);
                     Dash = dashAnnot;
+                    PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.LineStyle, DashStyles.Solid);
                 }
                 else
                 {
-                  
                     DashStyle dashAnnot = new DashStyle();
                     dashAnnot.Dashes.Add(1);
                     dashAnnot.Dashes.Add(1);
                     Dash = dashAnnot;
+                    PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.LineStyle, dash);
                 }
             }
         }
 
+
+
         private void SelectedFillColor_Command(object obj)
         {
-            if (obj != null)
+            if (obj != null && PropertyPanel != null)
             {
                 var colorValue = (Color)obj;
                 if (colorValue != null)
                 {
-
-                    FillColor = new SolidColorBrush(colorValue);
-                    FillColor.Opacity = FillOpacity;
-
-                    Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
-                    changeData[AnnotArgsType.AnnotFreehand] = obj;
-                    PropertyPanel.InvokeToMyTools(this, changeData);
+                    BasicVm.FillColor = new SolidColorBrush(colorValue);
+                    BasicVm.FillColor.Opacity = BasicVm.FillOpacity;
+                    PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.FillColor, colorValue);
                 }
             }
+
            
         }
 
@@ -348,14 +253,12 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         {
             if (obj != null)
             {
-                FillOpacity = (double)obj;
-                SelectColor.Opacity = FillOpacity;
-
-                AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, FillOpacity);
-                AnnotEvent?.UpdateAnnot();
-                Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
-                changeData[AnnotArgsType.AnnotFreehand] = FillOpacity;
-                PropertyPanel.InvokeToMyTools(this, changeData);
+                BasicVm.FillOpacity = (double)obj;
+                BasicVm.FillColor.Opacity = BasicVm.FillOpacity;
+
+                PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, BasicVm.FillOpacity);
+                PropertyPanel.InvokeToMyTools(AnnotArgsType.AnnotFreehand, BasicVm.FillOpacity);
+               
             }
 
         }
@@ -364,36 +267,29 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         {
             if (obj != null)
             {
-                FillOpacity = (double)obj;
-                SelectColor.Opacity = FillOpacity;
-
-                AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, FillOpacity);
-                AnnotEvent?.UpdateAnnot();
-                Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
-                changeData[AnnotArgsType.AnnotFreehand] = FillOpacity;
-                PropertyPanel.InvokeToMyTools(this, changeData);
+                BasicVm.FillOpacity = (double)obj;
+                BasicVm.FillColor.Opacity = BasicVm.FillOpacity;
+
+                PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, BasicVm.FillOpacity);
+                PropertyPanel.InvokeToMyTools(AnnotArgsType.AnnotFreehand, BasicVm.FillOpacity);
             }
 
         }
 
         
 
-        private void SelectedColor_Command(object obj)
+        private void SelectedBorderColor(object obj)
         {
-            if (obj != null)
+
+            if (obj != null && PropertyPanel != null)
             {
                 var colorValue = (Color)obj;
                 if (colorValue != null)
                 {
-
-                    SelectColor = new SolidColorBrush(colorValue);
-                    SelectColor.Opacity = FillOpacity;
-
-                    Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
-                    changeData[AnnotArgsType.AnnotFreehand] = obj;
-                    PropertyPanel.InvokeToMyTools(this, changeData);
+                    BasicVm.BorderColor = new SolidColorBrush(colorValue);
+                    BasicVm.BorderColor.Opacity = BasicVm.BorderOpacity;
+                    PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Color, colorValue);
                 }
-
             }
 
         }
@@ -403,11 +299,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             if (obj is double)
             {
                 var tran = (double)obj;
-                BorderOpacity = tran;
-                SelectColor.Opacity = tran;
-
-                AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, tran);
-                AnnotEvent?.UpdateAnnot();
+                BasicVm.AnnotThickness = tran;
+                PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, tran);
             }
         }
 
@@ -418,18 +311,18 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
-            IsMultiSelected = false;
+            BasicVm.IsMultiSelected = false;
         }
 
         private void SetAnnotType()
         {
-            switch (AnnotType)
+            switch (BasicVm.AnnotType)
             {
                 case AnnotArgsType.AnnotCircle:
-                    AnnotTypeTitle = "圆";
+                    BasicVm.AnnotTypeTitle = "圆";
                     break;
                 case AnnotArgsType.AnnotSquare:
-                    AnnotTypeTitle = "矩形";
+                    BasicVm.AnnotTypeTitle = "矩形";
                     break;
                 case AnnotArgsType.AnnotLine:
                 
@@ -437,9 +330,9 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     if (annotLine != null)
                     {
                         if (annotLine.TailLineType == C_LINE_TYPE.LINETYPE_ARROW && annotLine.HeadLineType == C_LINE_TYPE.LINETYPE_NONE)
-                            AnnotTypeTitle = "箭头";
+                            BasicVm.AnnotTypeTitle = "箭头";
                         else
-                            AnnotTypeTitle = "线";
+                            BasicVm.AnnotTypeTitle = "线";
                     }
                     break;
             }
@@ -455,18 +348,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             if (PropertyPanel != null)
             {
                 AnnotEvent = PropertyPanel.AnnotEvent;
-                AnnotType = PropertyPanel.annot.EventType;
+                BasicVm.AnnotType = PropertyPanel.annot.EventType;
                 Annot = PropertyPanel.annot;
-                if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count > 1)
-                {
-                    IsMultiSelected = true;
-                }
-                else
-                {
-                    IsMultiSelected = false;
-                }
-
-                if(IsMultiSelected)
+                BasicVm.IsMultiSelected = PropertyPanel.IsMultiSelected;
+                if(BasicVm.IsMultiSelected)
                 {
 
                 }
@@ -484,20 +369,34 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         {
             if (Annot != null)
             {
+                bool isSolid = true;
                 switch (Annot.EventType)
                 {
                     case AnnotArgsType.AnnotSquare:
                         if (Annot is SquareAnnotArgs)
                         {
                             var Square = Annot as SquareAnnotArgs;
-                            SelectColor = new SolidColorBrush(Square.LineColor);
-                            FillColor = new SolidColorBrush(Square.BgColor);
-                            BorderOpacity = Square.Transparency;
-                            FillOpacity = Square.Transparency;
-                            LineWidth = Square.LineWidth;
+                            BasicVm.BorderColor = new SolidColorBrush(Square.LineColor);
+                            BasicVm.FillColor = new SolidColorBrush(Square.BgColor);
+                            BasicVm.BorderOpacity = Square.Transparency;
+                            BasicVm.FillOpacity = Square.Transparency;
+                            BasicVm.AnnotThickness = Square.LineWidth;
                             Dash = Square.LineDash;
                             SharpsType("Rect",true);
-                            
+                           
+                            if (Square.LineDash != null && Square.LineDash.Dashes.Count > 0)
+                            {
+                                foreach (var item in Square.LineDash.Dashes)
+                                {
+                                    if (item > 0)
+                                    {
+                                        isSolid = false;
+                                        break;
+                                    }
+                                }
+                            }
+
+                           
                         }
                         break;
 
@@ -505,13 +404,26 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                         if (Annot is CircleAnnotArgs)
                         {
                             var Circle = Annot as CircleAnnotArgs;
-                            SelectColor = new SolidColorBrush(Circle.LineColor);
-                            FillColor = new SolidColorBrush(Circle.BgColor);
-                            BorderOpacity = Circle.Transparency;
-                            FillOpacity = Circle.Transparency;
-                            LineWidth = Circle.LineWidth;
+                            BasicVm.BorderColor = new SolidColorBrush(Circle.LineColor);
+                            BasicVm.FillColor = new SolidColorBrush(Circle.BgColor);
+                            BasicVm.BorderOpacity = Circle.Transparency;
+                            BasicVm.FillOpacity = Circle.Transparency;
+                            BasicVm.AnnotThickness = Circle.LineWidth;
                             Dash = Circle.LineDash;
                             SharpsType("Circle", true);
+
+                            if (Circle.LineDash != null && Circle.LineDash.Dashes.Count > 0)
+                            {
+                                foreach (var item in Circle.LineDash.Dashes)
+                                {
+                                    if (item > 0)
+                                    {
+                                        isSolid = false;
+                                        break;
+                                    }
+                                }
+                            }
+
                         }
                         break;
 
@@ -519,22 +431,36 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                         if (Annot is LineAnnotArgs)
                         {
                             var line = Annot as LineAnnotArgs;
-                            SelectColor = new SolidColorBrush(line.LineColor);
-                            FillColor = new SolidColorBrush(line.LineColor);
-                            BorderOpacity = line.Transparency;
-                            FillOpacity = line.Transparency;
-                            LineWidth = line.LineWidth;
+                            BasicVm.BorderColor = new SolidColorBrush(line.LineColor);
+                            BasicVm.FillColor = new SolidColorBrush(line.LineColor);
+                            BasicVm.BorderOpacity = line.Transparency;
+                            BasicVm.FillOpacity = line.Transparency;
+                            BasicVm.AnnotThickness = line.LineWidth;
                             Dash = line.LineDash;
 
                             if (line.TailLineType == C_LINE_TYPE.LINETYPE_ARROW && line.HeadLineType == C_LINE_TYPE.LINETYPE_NONE)
                                 SharpsType("Arrow", true);
                             else
                                 SharpsType("Line", true);
+
+                            if (line.LineDash != null && line.LineDash.Dashes.Count > 0)
+                            {
+                                foreach (var item in line.LineDash.Dashes)
+                                {
+                                    if (item > 0)
+                                    {
+                                        isSolid = false;
+                                        break;
+                                    }
+                                }
+                            }
                         }
 
                         break;
                 }
 
+                BasicVm.SetStrDashStyle(isSolid ? "Solid" : "Dash");
+
             }
 
         }

+ 39 - 13
PDF Office/Views/PropertyPanel/AnnotPanel/SharpsAnnotProperty.xaml

@@ -68,7 +68,7 @@
                 FontSize="18"
                 FontWeight="Bold"
                 LineHeight="24"
-                Text="{Binding AnnotTypeTitle}" />
+                Text="{Binding BasicVm.AnnotTypeTitle}" />
             <Border
                 Width="228"
                 Height="100"
@@ -77,7 +77,7 @@
                 BorderBrush="#DDDDDD"
                 BorderThickness="1"
                 CornerRadius="2"
-                Visibility="{Binding IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}"
+                Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}"
                 >
                 <Grid>
                     <Path
@@ -87,12 +87,12 @@
                         HorizontalAlignment="Center"
                         VerticalAlignment="Center"
                         Data="{Binding DataPath}"
-                        Fill="{Binding FillColor}"
-                        Opacity="{Binding FillOpacity}"
-                        Stroke="{Binding SelectColor}"
+                        Fill="{Binding BasicVm.FillColor}"
+                        Opacity="{Binding BasicVm.FillOpacity}"
+                        Stroke="{Binding BasicVm.BorderColor}"
                         StrokeDashArray="{Binding Dash, Converter={StaticResource DashStyleConverter}}"
                         StrokeStartLineCap="Flat"
-                        StrokeThickness="{Binding LineWidth}">
+                        StrokeThickness="{Binding BasicVm.AnnotThickness}">
                         <!--  ,Converter={StaticResource ColorToBrushConvert}  -->
                     </Path>
                 </Grid>
@@ -105,7 +105,7 @@
                 Margin="0,12,0,0"
                 BorderBrush="#FFE2E3E6"
                 BorderThickness="1" 
-                Visibility="{Binding IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}"
+                Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}"
                 >
                 <Grid Name="ToolGrid">
                     <Grid.ColumnDefinitions>
@@ -244,7 +244,8 @@
                 </Grid.RowDefinitions>
                 <TextBlock Text="Fill" VerticalAlignment="Center"/>
                 <CompositeControl:SlidContent x:Name="layerFill" HorizontalAlignment="Right"
-                                              Visibility="{Binding IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}"
+                                              InitValue="{Binding BasicVm.FillOpacity,Mode=OneWay}"
+                                              Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}"
                                               >
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="SelectedValueChanged">
@@ -252,7 +253,14 @@
                         </i:EventTrigger>
                     </i:Interaction.Triggers>
                 </CompositeControl:SlidContent>
-                <CompositeControl:ColorContent x:Name="cusFillColor" Grid.Row="1" />
+                <CompositeControl:ColorContent x:Name="cusFillColor" Grid.Row="1" 
+                                               UIColor="{Binding BasicVm.CurrentFillColor,Mode=OneWay}" >
+                    <i:Interaction.Triggers>
+                        <i:EventTrigger EventName="SelectedColorInvoke">
+                            <i:InvokeCommandAction Command="{Binding SelectedFillColorCommand}" CommandParameter="{Binding ElementName=cusFillColor,Path=SelectedColor}"/>
+                        </i:EventTrigger>
+                    </i:Interaction.Triggers>
+                </CompositeControl:ColorContent>
             </Grid>
 
             <Grid Margin="0,18,0,0">
@@ -262,13 +270,31 @@
                 </Grid.RowDefinitions>
                 <TextBlock Text="Border" VerticalAlignment="Center"/>
                 <CompositeControl:SlidContent x:Name="layerThick" HorizontalAlignment="Right" 
-                                              Visibility="{Binding IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}"
+                                              InitValue="{Binding BasicVm.BorderOpacity,Mode=OneWay}"
+                                              Visibility="{Binding BasicVm.IsMultiSelected,Converter={StaticResource InvertBoolToVisibleConvert}}"
                                               />
-                <CompositeControl:ColorContent x:Name="cusColor" Grid.Row="1" />
+
+                <CompositeControl:ColorContent x:Name="cusColor" Grid.Row="1"
+                                               UIColor="{Binding BasicVm.CurrentBorderColor,Mode=OneWay}" >
+                    <i:Interaction.Triggers>
+                        <i:EventTrigger EventName="SelectedColorInvoke">
+                            <i:InvokeCommandAction Command="{Binding SelectedBorderColorCommand}" CommandParameter="{Binding ElementName=cusColor,Path=SelectedColor}"/>
+                        </i:EventTrigger>
+                    </i:Interaction.Triggers>
+                </CompositeControl:ColorContent>
 
             </Grid>
 
-            <Grid>
+            <CompositeControl:SlidComboControl x:Name="thickness" Margin="12,0,12,0" Value="{Binding  BasicVm.AnnotThickness,Mode=TwoWay}">
+                <i:Interaction.Triggers>
+                    <i:EventTrigger EventName="ValueChanged">
+                        <i:InvokeCommandAction Command="{Binding SelectedThickCommand}" CommandParameter="{Binding ElementName=thickness,Path=Value}"/>
+                    </i:EventTrigger>
+                </i:Interaction.Triggers>
+            </CompositeControl:SlidComboControl>
+
+
+            <!--<Grid>
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="*" />
                     <ColumnDefinition Width="auto" />
@@ -354,7 +380,7 @@
                             TextAlignment="Left" />
                     </Grid>
                 </Border>
-            </Grid>
+            </Grid>-->
 
             <StackPanel  x:Name="PnlLineStyle" Orientation="Horizontal" Margin="0,20,0,0">
 

+ 22 - 36
PDF Office/Views/PropertyPanel/AnnotPanel/SharpsAnnotProperty.xaml.cs

@@ -29,12 +29,28 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
         public SharpsAnnotProperty()
         {
             InitializeComponent();
-            cusColor.SelectedColorHandler += cusColor_SelectedColor;
-            //layerThick.SelectedValueChanged += layerThick_SelectedValue;
+            this.Loaded += Usercontrol_Loaded;
+        }
 
-            cusFillColor.SelectedColorHandler += cusFillColor_SelectedColor;
-          //  layerFill.SelectedValueChanged += layerFill_SelectedValue;
-            ViewModel.LoadPropertyHandler += ViewModel_LoadPropertyHandler;
+        private void Usercontrol_Loaded(object sender, RoutedEventArgs e)
+        {
+            if(ViewModel != null)
+            {
+                var str = ViewModel.BasicVm.strDashStyle;
+                if (str == "Solid")
+                {
+                    BtnSolid.IsChecked = true;
+                }
+                else if (str == "Dash")
+                {
+                    BtnDashed.IsChecked = true;
+                }
+                else
+                {
+                    BtnSolid.IsChecked = false;
+                    BtnDashed.IsChecked = false;
+                }
+            }
         }
 
         private void ViewModel_LoadPropertyHandler(object sender, object e)
@@ -106,38 +122,8 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             }
         }
 
-        private void layerFill_SelectedValue(object sender, double e)
-        {
-            if (ViewModel != null)
-            {
-                ViewModel.SelectedFillOpacityCommand?.Execute(e);
-            }
-        }
-
-        private void cusFillColor_SelectedColor(object sender, Color e)
-        {
-            if (ViewModel != null)
-            {
-                ViewModel.SelectedFillColorCommand?.Execute(e);
-            }
-        }
-
-        private void layerThick_SelectedValue(object sender, double e)
-        {
-            if (ViewModel != null)
-            {
-                ViewModel.SelectedThickCommand?.Execute(e);
-            }
-        }
-
-        private void cusColor_SelectedColor(object sender, Color e)
-        {
-            if (ViewModel != null)
-            {
-                ViewModel.SelectedColorCommand?.Execute(e);
-            }
-        }
 
+ 
         private void SharpsBtn_Click(object sender, RoutedEventArgs e)
         {
             var btn = sender as ToggleButton;