Browse Source

compdfkit(win) - 测量Demo 直线,折线测量属性面板

zhuyi 1 year ago
parent
commit
aadc4bea20

+ 34 - 0
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFMeasureBarControl.xaml.cs

@@ -1,5 +1,6 @@
 using ComPDFKit.PDFAnnotation.Form;
 using Compdfkit_Tools.Measure;
+using Compdfkit_Tools.Measure.Property;
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using System;
@@ -258,16 +259,49 @@ namespace Compdfkit_Tools.PDFControl
         private void CreateMultiline()
         {
 
+            PolyLineMeasureArgs polyLineMeasureArgs = new PolyLineMeasureArgs();
+            polyLineMeasureArgs.LineColor = Colors.Red;
+            polyLineMeasureArgs.LineWidth = 2;
+            polyLineMeasureArgs.Transparency = 1;
+            polyLineMeasureArgs.FontColor = Colors.Red;
+            polyLineMeasureArgs.FontName = "Arial";
+            polyLineMeasureArgs.FontSize = 14;
+            pdfViewer?.ClearSelectAnnots();
+            pdfViewer?.SetMouseMode(MouseModes.AnnotCreate);
+            pdfViewer?.SetToolParam(polyLineMeasureArgs);
+            measurePropertyControl.SetPropertyForMeasureCreate(polyLineMeasureArgs);
         }
 
         private void CreatePolygonal()
         {
 
+            PolygonMeasureArgs polygonMeasureArgs = new PolygonMeasureArgs();
+            polygonMeasureArgs.LineColor = Colors.Red;
+            polygonMeasureArgs.LineWidth = 2;
+            polygonMeasureArgs.Transparency = 1;
+            polygonMeasureArgs.FontColor = Colors.Red;
+            polygonMeasureArgs.FontName = "Arial";
+            polygonMeasureArgs.FontSize = 14;
+            pdfViewer?.ClearSelectAnnots();
+            pdfViewer?.SetMouseMode(MouseModes.AnnotCreate);
+            pdfViewer?.SetToolParam(polygonMeasureArgs);
+            measurePropertyControl.SetPropertyForMeasureCreate(polygonMeasureArgs);
         }
 
         private void CreateRectangles()
         {
 
+            PolygonMeasureArgs rectPolygonMeasureArgs = new PolygonMeasureArgs();
+            rectPolygonMeasureArgs.LineColor = Colors.Red;
+            rectPolygonMeasureArgs.LineWidth = 2;
+            rectPolygonMeasureArgs.Transparency = 1;
+            rectPolygonMeasureArgs.FontColor = Colors.Red;
+            rectPolygonMeasureArgs.FontName = "Arial";
+            rectPolygonMeasureArgs.FontSize = 14;
+            pdfViewer?.ClearSelectAnnots();
+            pdfViewer?.SetMouseMode(MouseModes.AnnotCreate);
+            pdfViewer?.SetToolParam(rectPolygonMeasureArgs);
+            measurePropertyControl.SetPropertyForMeasureCreate(rectPolygonMeasureArgs);
         }
 
         #endregion

+ 5 - 4
Demo/Examples/Compdfkit_Tools/Measure/MeasurePropertyControl.xaml.cs

@@ -41,17 +41,18 @@ namespace Compdfkit_Tools.Measure
             {
                 case AnnotArgsType.LineMeasure:
                     StraightnessProperty straightnessProperty = new StraightnessProperty();
-                    straightnessProperty.SetAnnotEventData((LineMeasureArgs)Args);
+                    straightnessProperty.SetAnnotArgsData((LineMeasureArgs)Args);
                      currentPanel = straightnessProperty;
                     break;
                 case AnnotArgsType.PolyLineMeasure:
                     MultilineProperty multilineProperty = new MultilineProperty();
-                    multilineProperty.SetAnnotEventData((PolyLineMeasureArgs)Args);
+                    multilineProperty.SetAnnotArgsData((PolyLineMeasureArgs)Args);
                     currentPanel = multilineProperty;
                     break;
                 case AnnotArgsType.PolygonMeasure:
-                    RectanglesProperty rectanglesProperty = new RectanglesProperty();
-                    currentPanel = rectanglesProperty;
+                    PolygonalProperty polygonalProperty = new PolygonalProperty();
+                    polygonalProperty.SetAnnotArgsData((PolygonMeasureArgs)Args);
+                    currentPanel = polygonalProperty;
                     break;
                 default:
                     break;

+ 19 - 21
Demo/Examples/Compdfkit_Tools/Measure/Property/MultilineProperty.xaml

@@ -5,7 +5,9 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:Compdfkit_Tools.Measure.Property" xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common" xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl"
              mc:Ignorable="d" 
-             d:DesignHeight="4550" d:DesignWidth="800">
+             Loaded="UserControl_Loaded"
+             Unloaded="UserControl_Unloaded"
+             >
     <UserControl.Resources>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
@@ -18,34 +20,30 @@
             <StackPanel Orientation="Vertical">
                 <Border BorderThickness="1" BorderBrush="#1A000000">
                     <Grid  Height="40" Background="White" >
-                        <TextBlock x:Name="TitleTextBlock"  HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16" FontFamily="Segoe UI"></TextBlock>
+                        <TextBlock x:Name="TitleTextBlock" Text="Multiline"  HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16" FontWeight="Bold" FontFamily="Segoe UI"></TextBlock>
                     </Grid>
                 </Border>
-                <StackPanel Height="75" Margin="5">
-                    <TextBlock Text="Line Color"></TextBlock>
-                    <cpdfcommon:ColorPickerControl x:Name="BorderColorPickerControl" Brush="Red" TransparentBtnProperty ="Collapsed" ColorChanged="BorderColorPickerControl_ColorChanged"/>
+                <StackPanel Height="68" Margin="5">
+                    <TextBlock Text="Line Color" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
+                    <cpdfcommon:ColorPickerControl x:Name="BorderColorPickerControl" Margin="0,8,0,0" Brush="Red" TransparentBtnProperty ="Collapsed" ColorChanged="BorderColorPickerControl_ColorChanged"/>
                 </StackPanel>
-                <StackPanel Height="60" Margin="5">
-                    <TextBlock Text="Opacity"></TextBlock>
-                    <cpdfcommon:CPDFOpacityControl x:Name="CPDFOpacityControl" OpacityChanged="CPDFOpacityControl_OpacityChanged"/>
+                <StackPanel Height="68" Margin="5">
+                    <TextBlock Text="Opacity" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
+                    <cpdfcommon:CPDFOpacityControl x:Name="CPDFOpacityControl" Margin="0,8,0,0" OpacityChanged="CPDFOpacityControl_OpacityChanged"/>
                 </StackPanel>
-                <StackPanel Height="60" Margin="5">
-                    <TextBlock Text="Line Width"></TextBlock>
-                    <cpdfcommon:CPDFThicknessControl x:Name="CPDFThicknessControl" ThicknessChanged="CPDFThicknessControl_ThicknessChanged"/>
+                <StackPanel Height="68" Margin="5">
+                    <TextBlock Text="Line Width" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
+                    <cpdfcommon:CPDFThicknessControl x:Name="CPDFThicknessControl" Margin="0,8,0,0" ThicknessChanged="CPDFThicknessControl_ThicknessChanged"/>
                 </StackPanel>
                 <StackPanel x:Name="LineStyleStackPanel" Height="90" Margin="5">
-                    <TextBlock Text="Line and Border Style"></TextBlock>
-                    <cpdfcommon:CPDFLineStyleControl x:Name="CPDFLineStyleControl" LineStyleChanged="CPDFLineStyleControl_LineStyleChanged"/>
-                </StackPanel>
-                <StackPanel x:Name="ArrowStackPanel" Visibility="Visible" Height="75"  Margin="5">
-                    <TextBlock Text="Start and End"></TextBlock>
-                    <cpdfcommon:CPDFArrowControl x:Name="CPDFArrowControl" ArrowChanged="CPDFArrowControl_ArrowChanged"/>
+                    <TextBlock Text="Line and Border Style" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
+                    <cpdfcommon:CPDFLineStyleControl x:Name="CPDFLineStyleControl" Margin="0,8,0,0" LineStyleChanged="CPDFLineStyleControl_LineStyleChanged"/>
                 </StackPanel>
                 <StackPanel x:Name="FontColorStackPanel" Height="75" Margin="5">
-                    <TextBlock Text="Font Color"></TextBlock>
-                    <cpdfcommon:ColorPickerControl x:Name="FillColorPickerControl" Brush="Transparent" ColorChanged="FillColorPickerControl_ColorChanged"/>
+                    <TextBlock Text="Font Color" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
+                    <cpdfcommon:ColorPickerControl Margin="0,8,0,0" x:Name="FontColorPickerControl" Brush="Transparent" ColorChanged="FontColorPickerControl_ColorChanged"/>
                 </StackPanel>
-                <StackPanel>
+                <StackPanel  Margin="5">
                     <TextBlock  Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Text="Text" FontSize="14" FontFamily="Segoe UI" FontWeight="Bold" />
                     <ComboBox x:Name="FontCombox" Margin="0,8,0,0" Style="{StaticResource ComboBoxStyle1}" SelectedIndex="0" SelectionChanged="FontCombox_SelectionChanged">
                         <ComboBoxItem Content="Arial"/>
@@ -59,7 +57,7 @@
                             <ComboBoxItem Content="Italic"/>
                             <ComboBoxItem Content="Bold Italic"/>
                         </ComboBox>
-                        <ComboBox x:Name="FontSizeCombox" Margin="4,8,0,0" Width="72" Style="{StaticResource ComboBoxStyle1}" SelectedIndex="0" SelectionChanged="FontSizeCombox_SelectionChanged"/>
+                        <ComboBox x:Name="FontSizeComboBox" Margin="4,8,0,0" Width="72" Style="{StaticResource ComboBoxStyle1}" SelectedIndex="0" SelectionChanged="FontSizeCombox_SelectionChanged"/>
                     </StackPanel>
                 </StackPanel>
                 <StackPanel Height="160" Margin="5">

+ 188 - 49
Demo/Examples/Compdfkit_Tools/Measure/Property/MultilineProperty.xaml.cs

@@ -1,7 +1,10 @@
-using ComPDFKitViewer;
+using ComPDFKit.PDFAnnotation;
+using Compdfkit_Tools.Data;
+using ComPDFKitViewer;
 using ComPDFKitViewer.AnnotEvent;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -23,6 +26,14 @@ namespace Compdfkit_Tools.Measure.Property
     public partial class MultilineProperty : UserControl
     {
         private AnnotAttribEvent MultilineEvent { get; set; }
+
+        public ObservableCollection<int> SizeList { get; set; } = new ObservableCollection<int>
+        {
+            6,8,9,10,12,14,18,20,24,26,28,32,30,32,48,72
+        };
+
+        bool IsLoadedData = false;
+
         public MultilineProperty()
         {
             InitializeComponent();
@@ -30,40 +41,46 @@ namespace Compdfkit_Tools.Measure.Property
 
         private void NoteTextBox_TextChanged(object sender, TextChangedEventArgs e)
         {
-            MultilineEvent.UpdateAttrib(AnnotAttrib.NoteText, NoteTextBox.Text);
-            MultilineEvent.UpdateAnnot();
+            if (IsLoadedData)
+            {
+                MultilineEvent.UpdateAttrib(AnnotAttrib.NoteText, NoteTextBox.Text);
+                MultilineEvent.UpdateAnnot();
+            }
         }
 
         private void FontStyleCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            int selectIndex = Math.Max(0, FontStyleCombox.SelectedIndex);
-            bool isBold = false;
-            bool isItalic = false;
-
-            switch (selectIndex)
+            if (IsLoadedData)
             {
-                case 0:
-                    isBold = false;
-                    isItalic = false;
-                    break;
-                case 1:
-                    isBold = true;
-                    isItalic = false;
-                    break;
-                case 2:
-                    isBold = false;
-                    isItalic = true;
-                    break;
-                case 3:
-                    isBold = true;
-                    isItalic = true;
-                    break;
-                default:
-                    break;
+                int selectIndex = Math.Max(0, FontStyleCombox.SelectedIndex);
+                bool isBold = false;
+                bool isItalic = false;
+
+                switch (selectIndex)
+                {
+                    case 0:
+                        isBold = false;
+                        isItalic = false;
+                        break;
+                    case 1:
+                        isBold = true;
+                        isItalic = false;
+                        break;
+                    case 2:
+                        isBold = false;
+                        isItalic = true;
+                        break;
+                    case 3:
+                        isBold = true;
+                        isItalic = true;
+                        break;
+                    default:
+                        break;
+                }
+                MultilineEvent?.UpdateAttrib(AnnotAttrib.IsBold, isBold);
+                MultilineEvent?.UpdateAttrib(AnnotAttrib.IsItalic, isItalic);
+                MultilineEvent?.UpdateAnnot();
             }
-            MultilineEvent?.UpdateAttrib(AnnotAttrib.IsBold, isBold);
-            MultilineEvent?.UpdateAttrib(AnnotAttrib.IsItalic, isItalic);
-            MultilineEvent?.UpdateAnnot();
         }
 
         private void FontCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -78,7 +95,11 @@ namespace Compdfkit_Tools.Measure.Property
 
         private void FontSizeCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-
+            if (IsLoadedData)
+            {
+                MultilineEvent.UpdateAttrib(AnnotAttrib.FontSize, (sender as ComboBox).SelectedItem);
+                MultilineEvent.UpdateAnnot();
+            }
         }
 
         private void BorderColorPickerControl_ColorChanged(object sender, EventArgs e)
@@ -93,39 +114,39 @@ namespace Compdfkit_Tools.Measure.Property
 
         private void CPDFOpacityControl_OpacityChanged(object sender, EventArgs e)
         {
-            MultilineEvent?.UpdateAttrib(AnnotAttrib.Transparency, CPDFOpacityControl.OpacityValue / 100D * 255D);
-            MultilineEvent?.UpdateAnnot();
+            if (IsLoadedData)
+            {
+                MultilineEvent?.UpdateAttrib(AnnotAttrib.Transparency, CPDFOpacityControl.OpacityValue / 100D * 255D);
+                MultilineEvent?.UpdateAnnot();
+            }
         }
 
         private void CPDFThicknessControl_ThicknessChanged(object sender, EventArgs e)
         {
-            MultilineEvent?.UpdateAttrib(AnnotAttrib.Thickness, CPDFOpacityControl.OpacityValue / 100D * 255D);
-            MultilineEvent?.UpdateAnnot();
+            if (IsLoadedData)
+            {
+                MultilineEvent?.UpdateAttrib(AnnotAttrib.Thickness, CPDFOpacityControl.OpacityValue / 100D * 255D);
+                MultilineEvent?.UpdateAnnot();
+            }
         }
 
         private void CPDFLineStyleControl_LineStyleChanged(object sender, EventArgs e)
         {
-            MultilineEvent?.UpdateAttrib(AnnotAttrib.LineStyle, CPDFLineStyleControl.DashStyle);
-            MultilineEvent?.UpdateAnnot();
-        }
-
-        private void CPDFArrowControl_ArrowChanged(object sender, EventArgs e)
-        {
-            MultilineEvent?.UpdateAttrib(AnnotAttrib.LineStart, CPDFArrowControl.LineType.HeadLineType);
-            MultilineEvent?.UpdateAttrib(AnnotAttrib.LineEnd, CPDFArrowControl.LineType.TailLineType);
-            MultilineEvent?.UpdateAnnot();
+                MultilineEvent?.UpdateAttrib(AnnotAttrib.LineStyle, CPDFLineStyleControl.DashStyle);
+                MultilineEvent?.UpdateAnnot();
         }
 
-        private void FillColorPickerControl_ColorChanged(object sender, EventArgs e)
+        private void FontColorPickerControl_ColorChanged(object sender, EventArgs e)
         {
-            SolidColorBrush checkBrush = BorderColorPickerControl.GetBrush() as SolidColorBrush;
+            SolidColorBrush checkBrush = FontColorPickerControl.GetBrush() as SolidColorBrush;
             if (checkBrush != null)
             {
                 MultilineEvent?.UpdateAttrib(AnnotAttrib.FontColor, checkBrush.Color);
                 MultilineEvent?.UpdateAnnot();
             }
         }
-        public void SetAnnotEventData(PolyLineMeasureArgs annotArgs)
+
+        public void SetAnnotArgsData(PolyLineMeasureArgs annotArgs)
         {
             Dictionary<AnnotAttrib, object> attribDict = new Dictionary<AnnotAttrib, object>();
             attribDict[AnnotAttrib.Color] = annotArgs.LineColor;
@@ -143,9 +164,127 @@ namespace Compdfkit_Tools.Measure.Property
             SetAnnotEventData(annotEvent);
         }
 
-        public void SetAnnotEventData(AnnotAttribEvent annotEvent)
-        { 
+        private void SetAnnotEventData(AnnotAttribEvent annotEvent)
+        {
+            MultilineEvent = null;
+            if (annotEvent != null)
+            {
+                foreach (AnnotAttrib attrib in annotEvent.Attribs.Keys)
+                {
+                    switch (attrib)
+                    {
+                        case AnnotAttrib.Color:
+                            BorderColorPickerControl.SetCheckedForColor((Color)annotEvent.Attribs[attrib]);
+                            break;
+                        case AnnotAttrib.Transparency:
+                            double transparennt = Convert.ToDouble(annotEvent.Attribs[attrib]);
+                            if (transparennt > 1)
+                            {
+                                transparennt = (transparennt / 255D);
+                            }
+                            CPDFOpacityControl.OpacityValue = (int)(transparennt * 100);
+                            break;
+                        case AnnotAttrib.Thickness:
+                            CPDFThicknessControl.Thickness = Convert.ToInt16(annotEvent.Attribs[attrib]);
+                            break;
+                        case AnnotAttrib.LineStyle:
+                            CPDFLineStyleControl.DashStyle = (DashStyle)(annotEvent.Attribs[attrib]);
+                            break;
+                        case AnnotAttrib.FontColor:
+                            FontColorPickerControl.SetCheckedForColor((Color)annotEvent.Attribs[attrib]);
+                            break;
+                        case AnnotAttrib.FontName:
+                            {
+                                string fontName = (string)annotEvent.Attribs[AnnotAttrib.FontName];
+                                if (fontName == "Courier New")
+                                {
+                                    FontCombox.SelectedIndex = 1;
+                                }
+                                else if (fontName == "Arial")
+                                {
+                                    FontCombox.SelectedIndex = 0;
+
+                                }
+                                else if (fontName.Contains("Times"))
+                                {   
+                                    FontCombox.SelectedIndex = 2;
+                                }
+                                else
+                                {
+                                    FontCombox.SelectedIndex = -1;
+                                }
+                            }
+                            break;
+                        case AnnotAttrib.FontSize:
+                            SetFontSize(Convert.ToDouble(annotEvent.Attribs[attrib]));
+                            break;
+                        default:
+                            break;
+                    }
+                }
+
+
+                bool isBold = false;
+                bool isItalic = false;
+                if (annotEvent.Attribs.ContainsKey(AnnotAttrib.IsBold))
+                {
+                    isBold = (bool)annotEvent.Attribs[AnnotAttrib.IsBold];
+                }
+                if (annotEvent.Attribs.ContainsKey(AnnotAttrib.IsItalic))
+                {
+                    isItalic = (bool)annotEvent.Attribs[AnnotAttrib.IsItalic];
+                }
+
+                SetFontStyle(isBold, isItalic);
+            }
+
+            MultilineEvent = annotEvent;
+        }
+
+        public void SetFontStyle(bool isBold, bool isItalic)
+        {
+            if (isBold == false && isItalic == false)
+            {
+                FontStyleCombox.SelectedIndex = 0;
+                return;
+            }
 
+            if (isBold && isItalic == false)
+            {
+                FontStyleCombox.SelectedIndex = 1;
+                return;
+            }
+
+            if (isBold == false && isItalic)
+            {
+                FontStyleCombox.SelectedIndex = 2;
+                return;
+            }
+
+            if (isBold && isItalic)
+            {
+                FontStyleCombox.SelectedIndex = 3;
+            }
+        }
+
+        private void SetFontSize(double size)
+        {
+            int index = SizeList.IndexOf((int)size);
+            FontSizeComboBox.SelectedIndex = index;
+        }
+
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            Binding SizeListbinding = new Binding();
+            SizeListbinding.Source = this;
+            SizeListbinding.Path = new System.Windows.PropertyPath("SizeList");
+            FontSizeComboBox.SetBinding(ComboBox.ItemsSourceProperty, SizeListbinding);
+            IsLoadedData = true;
+        }
+
+        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
+        {
+            IsLoadedData = false;
         }
-     }
+    }
 }

+ 21 - 19
Demo/Examples/Compdfkit_Tools/Measure/Property/PolygonalProperty.xaml

@@ -5,7 +5,9 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:Compdfkit_Tools.Measure.Property" xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl" xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common"
              mc:Ignorable="d" 
-             d:DesignHeight="4550" d:DesignWidth="800">
+             Loaded="UserControl_Loaded"
+             Unloaded="UserControl_Unloaded"
+             >
     <UserControl.Resources>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
@@ -18,33 +20,33 @@
             <StackPanel Orientation="Vertical">
                 <Border BorderThickness="1" BorderBrush="#1A000000">
                     <Grid  Height="40" Background="White" >
-                        <TextBlock x:Name="TitleTextBlock" Text="Polygonal"  HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16" FontFamily="Segoe UI"></TextBlock>
+                        <TextBlock x:Name="TitleTextBlock" Text="Polygonal"  HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"  FontWeight="Bold" FontFamily="Segoe UI"></TextBlock>
                     </Grid>
                 </Border>
-                <StackPanel Height="75" Margin="5">
-                    <TextBlock Text="Line Color"></TextBlock>
-                    <cpdfcommon:ColorPickerControl x:Name="BorderColorPickerControl" Brush="Red" TransparentBtnProperty ="Collapsed"></cpdfcommon:ColorPickerControl>
+                <StackPanel Height="68" Margin="5">
+                    <TextBlock Text="Line Color" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
+                    <cpdfcommon:ColorPickerControl x:Name="BorderColorPickerControl" Margin="0,8,0,0" Brush="Red" TransparentBtnProperty ="Collapsed" ColorChanged="BorderColorPickerControl_ColorChanged"/>
                 </StackPanel>
-                <StackPanel Height="60" Margin="5">
-                    <TextBlock Text="Opacity"></TextBlock>
-                    <cpdfcommon:CPDFOpacityControl x:Name="CPDFOpacityControl"></cpdfcommon:CPDFOpacityControl>
+                <StackPanel Height="68" Margin="5">
+                    <TextBlock Text="Opacity" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
+                    <cpdfcommon:CPDFOpacityControl x:Name="CPDFOpacityControl" Margin="0,8,0,0" OpacityChanged="CPDFOpacityControl_OpacityChanged"/>
                 </StackPanel>
 
-                <StackPanel Height="75" Margin="5">
-                    <TextBlock Text="Line Color"></TextBlock>
-                    <cpdfcommon:ColorPickerControl x:Name="LineColorPickerControl" Brush="Red" TransparentBtnProperty ="Collapsed"></cpdfcommon:ColorPickerControl>
+                <StackPanel Height="68" Margin="5">
+                    <TextBlock Text="Line Color"  FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
+                    <cpdfcommon:ColorPickerControl x:Name="LineColorPickerControl" Margin="0,8,0,0" Brush="Red" TransparentBtnProperty ="Collapsed" ColorChanged="LineColorPickerControl_ColorChanged"/>
                 </StackPanel>
-                <StackPanel Height="60" Margin="5">
-                    <TextBlock Text="Opacity"></TextBlock>
-                    <cpdfcommon:CPDFOpacityControl x:Name="CPDFLineOpacityControl"></cpdfcommon:CPDFOpacityControl>
+                <StackPanel Height="68" Margin="5">
+                    <TextBlock Text="Opacity" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
+                    <cpdfcommon:CPDFOpacityControl x:Name="CPDFLineOpacityControl" Margin="0,8,0,0" OpacityChanged="CPDFLineOpacityControl_OpacityChanged"/>
                 </StackPanel>
                 <StackPanel x:Name="LineStyleStackPanel" Height="90" Margin="5">
-                    <TextBlock Text="Line and Border Style"></TextBlock>
-                    <cpdfcommon:CPDFLineStyleControl x:Name="CPDFLineStyleControl"></cpdfcommon:CPDFLineStyleControl>
+                    <TextBlock Text="Line and Border Style"/>
+                    <cpdfcommon:CPDFLineStyleControl x:Name="CPDFLineStyleControl" Margin="0,8,0,0" LineStyleChanged="CPDFLineStyleControl_LineStyleChanged"/>
                 </StackPanel>
                 <StackPanel x:Name="FontColorStackPanel" Height="75" Margin="5">
-                    <TextBlock Text="Font Color"></TextBlock>
-                    <cpdfcommon:ColorPickerControl x:Name="FillColorPickerControl" Brush="Transparent"></cpdfcommon:ColorPickerControl>
+                    <TextBlock Text="Font Color" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
+                    <cpdfcommon:ColorPickerControl x:Name="FontColorPickerControl" Brush="Transparent" Margin="0,8,0,0" ColorChanged="FontColorPickerControl_ColorChanged"/>
                 </StackPanel>
                 <StackPanel>
                     <TextBlock  Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Text="Text" FontSize="14" FontFamily="Segoe UI" FontWeight="Bold" />
@@ -60,7 +62,7 @@
                             <ComboBoxItem Content="Italic"/>
                             <ComboBoxItem Content="Bold Italic"/>
                         </ComboBox>
-                        <ComboBox x:Name="FontSizeCombox" Margin="4,8,0,0" Width="72" Style="{StaticResource ComboBoxStyle1}" SelectedIndex="0" SelectionChanged="FontSizeCombox_SelectionChanged"/>
+                        <ComboBox x:Name="FontSizeComboBox" Margin="4,8,0,0" Width="72" Style="{StaticResource ComboBoxStyle1}" SelectedIndex="0" SelectionChanged="FontSizeCombox_SelectionChanged"/>
                     </StackPanel>
                 </StackPanel>
                 <StackPanel Height="160" Margin="5">

+ 254 - 3
Demo/Examples/Compdfkit_Tools/Measure/Property/PolygonalProperty.xaml.cs

@@ -1,5 +1,9 @@
-using System;
+using Compdfkit_Tools.Common;
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
+using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -20,6 +24,16 @@ namespace Compdfkit_Tools.Measure.Property
     /// </summary>
     public partial class PolygonalProperty : UserControl
     {
+        public ObservableCollection<int> SizeList { get; set; } = new ObservableCollection<int>
+        {
+            6,8,9,10,12,14,18,20,24,26,28,32,30,32,48,72
+        };
+
+        bool IsLoadedData = false;
+
+
+        private AnnotAttribEvent PolygonalEvent { get; set; }
+
         public PolygonalProperty()
         {
             InitializeComponent();
@@ -27,22 +41,259 @@ namespace Compdfkit_Tools.Measure.Property
 
         private void NoteTextBox_TextChanged(object sender, TextChangedEventArgs e)
         {
-
+            if (IsLoadedData)
+            {
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.NoteText, NoteTextBox.Text);
+                PolygonalEvent?.UpdateAnnot();
+            }
         }
 
         private void FontStyleCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
+            if (IsLoadedData)
+            {
+                int selectIndex = Math.Max(0, FontStyleCombox.SelectedIndex);
+                bool isBold = false;
+                bool isItalic = false;
 
+                switch (selectIndex)
+                {
+                    case 0:
+                        isBold = false;
+                        isItalic = false;
+                        break;
+                    case 1:
+                        isBold = true;
+                        isItalic = false;
+                        break;
+                    case 2:
+                        isBold = false;
+                        isItalic = true;
+                        break;
+                    case 3:
+                        isBold = true;
+                        isItalic = true;
+                        break;
+                    default:
+                        break;
+                }
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.IsBold, isBold);
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.IsItalic, isItalic);
+                PolygonalEvent?.UpdateAnnot();
+            }
         }
 
         private void FontSizeCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-
+            if (IsLoadedData)
+            {
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.FontSize, (sender as ComboBox).SelectedItem);
+                PolygonalEvent?.UpdateAnnot();
+            }
         }
 
         private void FontCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
+            ComboBoxItem selectItem = FontCombox.SelectedItem as ComboBoxItem;
+            if (selectItem != null && selectItem.Content != null)
+            {
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.FontName, selectItem.Content.ToString());
+                PolygonalEvent?.UpdateAnnot();
+            }
+        }
+
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            Binding SizeListbinding = new Binding();
+            SizeListbinding.Source = this;
+            SizeListbinding.Path = new System.Windows.PropertyPath("SizeList");
+            FontSizeComboBox.SetBinding(ComboBox.ItemsSourceProperty, SizeListbinding);
+            IsLoadedData = true;
+        }
+
+        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
+        {
+            IsLoadedData = false;
+        }
+
+        private void BorderColorPickerControl_ColorChanged(object sender, EventArgs e)
+        {
+            SolidColorBrush checkBrush = BorderColorPickerControl.GetBrush() as SolidColorBrush;
+            if (checkBrush != null)
+            {
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.Color, checkBrush.Color);
+                PolygonalEvent?.UpdateAnnot();
+            }
+        }
+
+        private void CPDFOpacityControl_OpacityChanged(object sender, EventArgs e)
+        {
+            if (IsLoadedData)
+            {
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.Transparency, CPDFOpacityControl.OpacityValue / 100D * 255D);
+                PolygonalEvent?.UpdateAnnot();
+            }
+        }
+
+        private void LineColorPickerControl_ColorChanged(object sender, EventArgs e)
+        {
+            SolidColorBrush checkBrush = LineColorPickerControl.GetBrush() as SolidColorBrush;
+            if (checkBrush != null)
+            {
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.Color, checkBrush.Color);
+                PolygonalEvent?.UpdateAnnot();
+            }
+        }
+
+        private void CPDFLineOpacityControl_OpacityChanged(object sender, EventArgs e)
+        {
+            if (IsLoadedData)
+            {
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.Transparency, CPDFLineOpacityControl.OpacityValue / 100D * 255D);
+                PolygonalEvent?.UpdateAnnot();
+            }
+        }
+
+        private void CPDFLineStyleControl_LineStyleChanged(object sender, EventArgs e)
+        {
+            if (IsLoadedData)
+            {
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.LineStyle, CPDFLineStyleControl.DashStyle);
+                PolygonalEvent?.UpdateAnnot();
+            }
+        }
+
+        private void FontColorPickerControl_ColorChanged(object sender, EventArgs e)
+        {
+            SolidColorBrush checkBrush = FontColorPickerControl.GetBrush() as SolidColorBrush;
+            if (checkBrush != null)
+            {
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.FontColor, checkBrush.Color);
+                PolygonalEvent?.UpdateAnnot();
+            }
+        }
+        public void SetAnnotArgsData(PolygonMeasureArgs annotArgs)
+        {
+            Dictionary<AnnotAttrib, object> attribDict = new Dictionary<AnnotAttrib, object>();
+            attribDict[AnnotAttrib.Color] = annotArgs.LineColor;
+            attribDict[AnnotAttrib.Transparency] = annotArgs.Transparency;
+            attribDict[AnnotAttrib.Thickness] = annotArgs.LineWidth;
+            attribDict[AnnotAttrib.LineStyle] = annotArgs.LineDash;
+            attribDict[AnnotAttrib.FontColor] = annotArgs.FontColor;
+            attribDict[AnnotAttrib.FontName] = annotArgs.FontName;
+            attribDict[AnnotAttrib.IsBold] = annotArgs.IsBold;
+            attribDict[AnnotAttrib.IsItalic] = annotArgs.IsItalic;
+            attribDict[AnnotAttrib.FontSize] = annotArgs.FontSize;
+            attribDict[AnnotAttrib.NoteText] = annotArgs.Content;
+
+            AnnotAttribEvent annotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annotArgs, attribDict);
+            SetAnnotEventData(annotEvent);
+        }
+
+        private void SetAnnotEventData(AnnotAttribEvent annotEvent)
+        {
+            PolygonalEvent = null;
+            if (annotEvent != null)
+            {
+                foreach (AnnotAttrib attrib in annotEvent.Attribs.Keys)
+                {
+                    switch (attrib)
+                    {
+                        case AnnotAttrib.Color:
+                            BorderColorPickerControl.SetCheckedForColor((Color)annotEvent.Attribs[attrib]);
+                            break;
+                        case AnnotAttrib.Transparency:
+                            double transparennt = Convert.ToDouble(annotEvent.Attribs[attrib]);
+                            if (transparennt > 1)
+                            {
+                                transparennt = (transparennt / 255D);
+                            }
+                            CPDFOpacityControl.OpacityValue = (int)(transparennt * 100);
+                            break;
+                        case AnnotAttrib.LineStyle:
+                            CPDFLineStyleControl.DashStyle = (DashStyle)(annotEvent.Attribs[attrib]);
+                            break;
+                        case AnnotAttrib.FontColor:
+                            FontColorPickerControl.SetCheckedForColor((Color)annotEvent.Attribs[attrib]);
+                            break;
+                        case AnnotAttrib.FontName:
+                            {
+                                string fontName = (string)annotEvent.Attribs[AnnotAttrib.FontName];
+                                if (fontName == "Courier New")
+                                {
+                                    FontCombox.SelectedIndex = 1;
+                                }
+                                else if (fontName == "Arial")
+                                {
+                                    FontCombox.SelectedIndex = 0;
+
+                                }
+                                else if (fontName.Contains("Times"))
+                                {
+                                    FontCombox.SelectedIndex = 2;
+                                }
+                                else
+                                {
+                                    FontCombox.SelectedIndex = -1;
+                                }
+                            }
+                            break;
+                        case AnnotAttrib.FontSize:
+                            SetFontSize(Convert.ToDouble(annotEvent.Attribs[attrib]));
+                            break;
+                        default:
+                            break;
+                    }
+                }
 
+
+                bool isBold = false;
+                bool isItalic = false;
+                if (annotEvent.Attribs.ContainsKey(AnnotAttrib.IsBold))
+                {
+                    isBold = (bool)annotEvent.Attribs[AnnotAttrib.IsBold];
+                }
+                if (annotEvent.Attribs.ContainsKey(AnnotAttrib.IsItalic))
+                {
+                    isItalic = (bool)annotEvent.Attribs[AnnotAttrib.IsItalic];
+                }
+
+                SetFontStyle(isBold, isItalic);
+            }
+
+            PolygonalEvent = annotEvent;
+        }
+
+        public void SetFontStyle(bool isBold, bool isItalic)
+        {
+            if (isBold == false && isItalic == false)
+            {
+                FontStyleCombox.SelectedIndex = 0;
+                return;
+            }
+
+            if (isBold && isItalic == false)
+            {
+                FontStyleCombox.SelectedIndex = 1;
+                return;
+            }
+
+            if (isBold == false && isItalic)
+            {
+                FontStyleCombox.SelectedIndex = 2;
+                return;
+            }
+
+            if (isBold && isItalic)
+            {
+                FontStyleCombox.SelectedIndex = 3;
+            }
+        }
+
+        private void SetFontSize(double size)
+        {
+            int index = SizeList.IndexOf((int)size);
+            FontSizeComboBox.SelectedIndex = index;
         }
     }
 }

+ 9 - 30
Demo/Examples/Compdfkit_Tools/Measure/Property/StraightnessProperty.xaml

@@ -6,7 +6,10 @@
              xmlns:local="clr-namespace:Compdfkit_Tools.Measure.Property" 
              xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common" 
              xmlns:cpdftools="clr-namespace:Compdfkit_Tools.PDFControl"
-             mc:Ignorable="d"  >
+             mc:Ignorable="d"
+             Loaded="UserControl_Loaded"
+             Unloaded="UserControl_Unloaded"
+             >
     <UserControl.Resources>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
@@ -25,7 +28,7 @@
                 <StackPanel Height="68" Margin="5">
                     <TextBlock Text="Line Color" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
                     <cpdfcommon:ColorPickerControl Margin="0,8,0,0" x:Name="BorderColorPickerControl" Brush="Red" TransparentBtnProperty ="Collapsed"
-                                                   ColorChanged="BorderColorPickerControl_ColorChanged"></cpdfcommon:ColorPickerControl>
+                                                   ColorChanged="BorderColorPickerControl_ColorChanged"/>
                 </StackPanel>
                 <StackPanel Height="68" Margin="5">
                     <TextBlock Text="Opacity" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
@@ -45,14 +48,14 @@
                     </cpdfcommon:CPDFLineStyleControl>
                 </StackPanel>
                 <StackPanel x:Name="ArrowStackPanel" Visibility="Visible" Height="75"  Margin="5">
-                    <TextBlock Text="Start and End" Margin="0,0,0,10"></TextBlock>
+                    <TextBlock Text="Start and End" Margin="0,0,0,10" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
                     <cpdfcommon:CPDFArrowControl x:Name="CPDFArrowControl" ArrowChanged="CPDFArrowControl_ArrowChanged">
                     </cpdfcommon:CPDFArrowControl>
                 </StackPanel>
                 <StackPanel x:Name="FontColorStackPanel" Height="75" Margin="5">
                     <TextBlock Text="Font Color" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
-                    <cpdfcommon:ColorPickerControl Margin="0,8,0,0" x:Name="FillColorPickerControl" Brush="Transparent"
-                                                   ColorChanged="FillColorPickerControl_ColorChanged"></cpdfcommon:ColorPickerControl>
+                    <cpdfcommon:ColorPickerControl Margin="0,8,0,0" x:Name="FontColorPickerControl" Brush="Transparent"
+                                                   ColorChanged="FontColorPickerControl_ColorChanged"></cpdfcommon:ColorPickerControl>
                 </StackPanel>
                 <StackPanel Margin="5">
                     <TextBlock  Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Text="Text" FontSize="14" FontFamily="Segoe UI" FontWeight="Bold" />
@@ -70,31 +73,7 @@
                         </ComboBox>
                         <Grid Grid.Row="1" Grid.Column="1" Margin="8,8,0,0">
                             <ComboBox Name="FontSizeComboBox" Width="72" Height="28" BorderThickness="1" MaxDropDownHeight="200" Foreground="#43474D" FontSize="14"
-                                      SelectionChanged="FontSizeComboBox_SelectionChanged" Style="{StaticResource ComboBoxStyle1}">
-                                <ComboBoxItem>6</ComboBoxItem>
-                                <ComboBoxItem>8</ComboBoxItem>
-                                <ComboBoxItem>9</ComboBoxItem>
-                                <ComboBoxItem>10</ComboBoxItem>
-                                <ComboBoxItem>12</ComboBoxItem>
-                                <ComboBoxItem>14</ComboBoxItem>
-                                <ComboBoxItem>18</ComboBoxItem>
-                                <ComboBoxItem>20</ComboBoxItem>
-                                <ComboBoxItem>22</ComboBoxItem>
-                                <ComboBoxItem>24</ComboBoxItem>
-                                <ComboBoxItem>26</ComboBoxItem>
-                                <ComboBoxItem>28</ComboBoxItem>
-                                <ComboBoxItem>32</ComboBoxItem>
-                                <ComboBoxItem>36</ComboBoxItem>
-                                <ComboBoxItem>48</ComboBoxItem>
-                                <ComboBoxItem>72</ComboBoxItem>
-                            </ComboBox>
-                            <TextBox Name="FontSizeTextBox" IsHitTestVisible="False" Width="72" Height="28" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" BorderThickness="1"
-                                     IsReadOnly="True"  Padding="0,0,15,0" FontSize="14"></TextBox>
-                            <Path Fill="#43474D" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,5,0" IsHitTestVisible="False">
-                                <Path.Data>
-                                    M0.5 0.510248L4.5041 5.5L8.5 0.5L0.5 0.510248Z
-                                </Path.Data>
-                            </Path>
+                                      SelectionChanged="FontSizeComboBox_SelectionChanged" Style="{StaticResource ComboBoxStyle1}"/>
                         </Grid>
                     </StackPanel>
                 </StackPanel>

+ 33 - 25
Demo/Examples/Compdfkit_Tools/Measure/Property/StraightnessProperty.xaml.cs

@@ -5,6 +5,7 @@ using ComPDFKitViewer;
 using ComPDFKitViewer.AnnotEvent;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Diagnostics;
 using System.Linq;
 using System.Text;
@@ -27,6 +28,13 @@ namespace Compdfkit_Tools.Measure.Property
     public partial class StraightnessProperty : UserControl
     {
         private AnnotAttribEvent LineEvent { get; set; }
+        public ObservableCollection<int> SizeList { get; set; } = new ObservableCollection<int>
+        {
+            6,8,9,10,12,14,18,20,24,26,28,32,30,32,48,72
+        };
+
+        bool IsLoadedData = false;
+
         public StraightnessProperty()
         {
             InitializeComponent();
@@ -72,15 +80,10 @@ namespace Compdfkit_Tools.Measure.Property
 
         private void FontSizeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            ComboBoxItem selectItem = FontSizeComboBox.SelectedItem as ComboBoxItem;
-            if (selectItem != null && selectItem.Content != null)
+            if (IsLoadedData)
             {
-                if (int.TryParse(selectItem.Content.ToString(), out int newFontSize))
-                {
-                    FontSizeTextBox.Text = (newFontSize).ToString();
-                    LineEvent?.UpdateAttrib(AnnotAttrib.FontSize, newFontSize);
-                    LineEvent?.UpdateAnnot();
-                }
+                LineEvent.UpdateAttrib(AnnotAttrib.FontSize, (sender as ComboBox).SelectedItem);
+                LineEvent.UpdateAnnot();
             }
         }
 
@@ -110,7 +113,7 @@ namespace Compdfkit_Tools.Measure.Property
             LineEvent?.UpdateAnnot();
         }
 
-        public void SetAnnotEventData(AnnotAttribEvent annotEvent)
+        private void SetAnnotEventData(AnnotAttribEvent annotEvent)
         {
             LineEvent = null;
             if(annotEvent!=null)
@@ -137,7 +140,7 @@ namespace Compdfkit_Tools.Measure.Property
                             CPDFLineStyleControl.DashStyle= (DashStyle)(annotEvent.Attribs[attrib]);
                             break;
                         case AnnotAttrib.FontColor:
-                            FillColorPickerControl.SetCheckedForColor((Color)annotEvent.Attribs[attrib]);
+                            FontColorPickerControl.SetCheckedForColor((Color)annotEvent.Attribs[attrib]);
                             break;
                         case AnnotAttrib.FontName:
                             {
@@ -204,7 +207,7 @@ namespace Compdfkit_Tools.Measure.Property
             LineEvent =annotEvent;
         }
 
-        public void SetAnnotEventData(LineMeasureArgs annotArgs)
+        public void SetAnnotArgsData(LineMeasureArgs annotArgs)
         {
             Dictionary<AnnotAttrib, object> attribDict = new Dictionary<AnnotAttrib, object>();
             attribDict[AnnotAttrib.Color] = annotArgs.LineColor;
@@ -250,19 +253,10 @@ namespace Compdfkit_Tools.Measure.Property
             }
         }
 
-        public void SetFontSize(double newFontSize)
+        private void SetFontSize(double size)
         {
-            if (FontSizeTextBox != null)
-            {
-                if (newFontSize - (int)(newFontSize) > 0)
-                {
-                    FontSizeTextBox.Text = ((int)newFontSize).ToString();
-                }
-                else
-                {
-                    FontSizeTextBox.Text = ((int)(newFontSize)).ToString();
-                }
-            }
+            int index = SizeList.IndexOf((int)size);
+            FontSizeComboBox.SelectedIndex = index;
         }
 
         private void CPDFThicknessControl_ThicknessChanged(object sender, EventArgs e)
@@ -284,14 +278,28 @@ namespace Compdfkit_Tools.Measure.Property
             LineEvent?.UpdateAnnot();
         }
 
-        private void FillColorPickerControl_ColorChanged(object sender, EventArgs e)
+        private void FontColorPickerControl_ColorChanged(object sender, EventArgs e)
         {
-            SolidColorBrush checkBrush = BorderColorPickerControl.GetBrush() as SolidColorBrush;
+            SolidColorBrush checkBrush = FontColorPickerControl.GetBrush() as SolidColorBrush;
             if (checkBrush != null)
             {
                 LineEvent?.UpdateAttrib(AnnotAttrib.FontColor, checkBrush.Color);
                 LineEvent?.UpdateAnnot();
             }
         }
+
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            Binding SizeListbinding = new Binding();
+            SizeListbinding.Source = this;
+            SizeListbinding.Path = new System.Windows.PropertyPath("SizeList");
+            FontSizeComboBox.SetBinding(ComboBox.ItemsSourceProperty, SizeListbinding);
+            IsLoadedData = true;
+        }
+
+        private void UserControl_Unloaded(object sender, RoutedEventArgs e)
+        {
+            IsLoadedData = false;
+        }
     }
 }