Explorar o código

Form - 复选框

chenrongqian %!s(int64=2) %!d(string=hai) anos
pai
achega
9636ac321f

+ 210 - 72
PDF Office/ViewModels/Form/CheckBoxPropertyViewModel.cs

@@ -2,9 +2,12 @@
 using ComPDFKit.PDFAnnotation.Form;
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Helper;
 using PDF_Office.Model;
+using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Regions;
+using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -17,39 +20,27 @@ namespace PDF_Office.ViewModels.Form
 
     public class CheckBoxPropertyViewModel : FormBaseVM, INavigationAware
     {
-        #region 属性
 
-        #region 选项
-
-        //导出值
-        private string _exportValue;
-        public string ExportValue
-        {
-            get { return _exportValue; }
-            set { SetProperty(ref _exportValue, value); }
-        }
-
-        //复选框默认为选中
-        private bool _isDefaultChecked = false;
-        public bool IsDefaultChecked
-        {
-            get { return _isDefaultChecked; }
-            set { SetProperty(ref _isDefaultChecked, value); }
-        }
+        #region Command
+        public DelegateCommand<string> FieldNameTextChangedCommand { get; set; }
+        public DelegateCommand<string> ToolTipTextChangedCommand { get; set; }
 
+        //外观
 
-        #endregion
+        public DelegateCommand<object> ResetColorCommand { get; set; }
+        public DelegateCommand<object> ResetColorCheckedBtnCommand { get; set; }
 
-        #endregion
-
-        #region Command
+        public DelegateCommand<string> ExportedValuesTextChangedCommand { get; set; }
 
+        public DelegateCommand<object> LineStyleCommand { get; set; }
         #endregion
 
         #region 变量
+
         private CPDFViewer PDFViewer;
         private WidgetCheckBoxArgs checkBoxArgs;
-        private bool IsCurrentWidget = false;
+        private IDialogService dialogs;
+        public event EventHandler<int> SelectResetColorBtnHandler;
         #endregion
 
         #region 初始化
@@ -61,28 +52,182 @@ namespace PDF_Office.ViewModels.Form
 
         private void InitVariable()
         {
+            InitAllResetColor();
+        }
+
+        private void InitAllResetColor()
+        {
+            ResetColorOne = InitResetColor(Colors.Transparent, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorTwo = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorThree = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
 
+            ResetColorForth = InitResetColor(Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Colors.Transparent);
         }
 
         private void InitCommand()
         {
-            //ChangeValueHandler -= ChangeValue;
-            //ChangeValueHandler += ChangeValue;
+            //一般
+            FieldNameTextChangedCommand = new DelegateCommand<string>(FieldNameTextChanged);
+            ToolTipTextChangedCommand = new DelegateCommand<string>(ToolTipTextChanged);
+            //外观
+            ResetColorCheckedBtnCommand = new DelegateCommand<object>(ResetColorCheckedBtn);
+            ResetColorCommand = new DelegateCommand<object>(ResetColorEvent);
+            LineStyleCommand = new DelegateCommand<object>(LineStyleBtnEvent);
+
+            //选项
+            ExportedValuesTextChangedCommand = new DelegateCommand<string>(ExportedValuesTextChanged);
         }
 
         #endregion
 
+        #region 事件
 
-        #region 一般处理
 
-        #endregion
+        private void FieldNameTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+               FieldName = obj;
+
+            }
+        }
+
+        private void ToolTipTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                ToolTipStr = obj;
+            }
+        }
+
+
+        private void LineStyleBtnEvent(object obj)
+        {
+            if (obj != null)
+            {
+                switch ((string)obj)
+                {
+                    case "Solid":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
+                        break;
+                    case "Dotted":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_DASHDED;
+                        break;
+                }
+            }
+        }
+
+
+        private void ExportedValuesTextChanged(string obj)
+        {
+            if (obj != null && IsCurrentWidget == true)
+            {
+                ExportedValues = obj;
+            }
+        }
+
+
+        private void ResetColorCheckedBtn(object obj)
+        {
+            if (obj != null)
+            {
+                var str = obj as string;
+                if (str != null)
+                {
+                    switch (str)
+                    {
+                        case "One":
+                            BorderColor = ResetColorOne.BorderColor.Color;
+                            ContentColor = ResetColorOne.FontColor.Color;
+                            FillColor = ResetColorOne.FillColor.Color;
+                            break;
+
+                        case "Two":
+                            BorderColor = ResetColorTwo.BorderColor.Color;
+                            ContentColor = ResetColorTwo.FontColor.Color;
+                            FillColor = ResetColorTwo.FillColor.Color;
+                            break;
+
+                        case "Three":
+                            BorderColor = ResetColorThree.BorderColor.Color;
+                            ContentColor = ResetColorThree.FontColor.Color;
+                            FillColor = ResetColorThree.FillColor.Color;
+                            break;
+
+                        case "Forth":
+                            BorderColor = ResetColorForth.BorderColor.Color;
+                            ContentColor = ResetColorForth.FontColor.Color;
+                            FillColor = ResetColorForth.FillColor.Color;
+                            break;
+                    }
+                }
+            }
+        }
+
+        private void ResetColorEvent(object obj)
+        {
+            bool result = true;
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.PDFViewer, PDFViewer);
+            dialogs.ShowDialog(DialogNames.EditPresetColorsDialog, value, e =>
+            {
+                if (e.Result != ButtonResult.OK)
+                {
+                    result = false;
+                }
+                EditPresetColorsDialogViewModel DialogVM = e.Parameters.GetValue<EditPresetColorsDialogViewModel>(ParameterNames.DataModel);
+                if (DialogVM != null)
+                {
+                }
+            });
+            if (!result)
+            {
+                return;
+            }
+        }
 
-        #region 外观处理
 
         #endregion
 
-        #region 选项处理
+        #region 外部XAML触发事件
+
+        private void UpdataSelectResetColorBtn()
+        {
+            int result = 0;
+            if (UpdataSelectResetColor(ResetColorOne))
+            {
+                result = 1;
+            }
+            else if (UpdataSelectResetColor(ResetColorTwo))
+            {
+                result = 2;
+            }
+            else if (UpdataSelectResetColor(ResetColorThree))
+            {
+                result = 3;
+            }
+            else if (UpdataSelectResetColor(ResetColorForth))
+            {
+                result = 4;
+            }
+
+            SelectResetColorBtnHandler?.Invoke(null, result);
+        }
 
+        private bool UpdataSelectResetColor(ResetColor reset)
+        {
+            if (reset.FillColor.Color == FillColor &&
+                reset.FontColor.Color == ContentColor &&
+                reset.BorderColor.Color == BorderColor
+                )
+            {
+                return true;
+            }
+
+            return false;
+        }
         #endregion
 
         #region Navegation
@@ -94,26 +239,28 @@ namespace PDF_Office.ViewModels.Form
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             checkBoxArgs = null;
+            isCreateWidget = false;
+            IsCurrentWidget = false;
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
             navigationContext.Parameters.TryGetValue<WidgetCheckBoxArgs>("WidgetArgs", out checkBoxArgs);
 
             GetWidgeText();
+            UpdataSelectResetColorBtn();
         }
 
         private void GetWidgeText()
         {
-           
+
             if (checkBoxArgs == null)
             {
                 PDFViewer.SetMouseMode(MouseModes.FormEditTool);
                 checkBoxArgs = new WidgetCheckBoxArgs();
                 WidgetCheckBoxArgs args = new WidgetCheckBoxArgs();
-
-                args.FieldName = "CheckBox1";
                 args.CheckStyle = C_CHECK_STYLE.CK_CHECK;
                 args.BorderStyle = C_BORDER_STYLE.BS_SOLID;
                 args.LineColor = Colors.Black;
@@ -121,56 +268,47 @@ namespace PDF_Office.ViewModels.Form
                 args.LineWidth = 1;
                 checkBoxArgs = args;
                 PDFViewer.SetToolParam(checkBoxArgs);
+                isCreateWidget = true;
             }
             else
             {
                 PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
+                isCreateWidget = false;
             }
 
-        }
-
-        //更改基类公共属性后,触发的事件
-        //private void ChangeValue(object sender, FormAttributeType e)
-        //{
-        //    switch (e)
-        //    {
-        //        case FormAttributeType.Name:
-        //            break;
-
-        //        case FormAttributeType.ToolTip:
-
-        //            break;
-
-        //        case FormAttributeType.IsSolid:
-        //            break;
-
-        //        case FormAttributeType.IsLocked:
-        //            break;
+            GetProperty();
 
-        //        case FormAttributeType.HeightSize:
-        //            break;
-
-        //        case FormAttributeType.BorderThiness:
-        //            break;
-
-        //        case FormAttributeType.BorderColor:
-        //            break;
-
-        //        case FormAttributeType.ContentColor:
-        //            break;
-
-        //        case FormAttributeType.IsReadOnly:
-        //            break;
-
-        //        case FormAttributeType.WidthSize:
-        //            break;
+            IsCurrentWidget = true;
+        }
 
-        //        case FormAttributeType.IsRequiredField:
-        //            break;
+        private void GetProperty()
+        {
+            if (checkBoxArgs != null)
+            {
+                IsLocked = checkBoxArgs.Locked;
+                FieldName = checkBoxArgs.FieldName;
+                ToolTipStr = checkBoxArgs.Tooltip;
+                IsReadOnly = checkBoxArgs.ReadOnly;
+                IsRequiredField = checkBoxArgs.IsRequired;
+
+                FillColor = checkBoxArgs.BgColor;
+                ContentColor = checkBoxArgs.FontColor;
+                BorderColor = checkBoxArgs.LineColor;
+                BorderThiness = checkBoxArgs.LineWidth;
+                BorderStyle = checkBoxArgs.BorderStyle;
+                ExportedValues = checkBoxArgs.ExportValue;
+                //避免BorderStyle跟上一个值相同,而没触发更改IsSolid属性
+                if (BorderStyle == C_BORDER_STYLE.BS_SOLID)
+                    IsSolid = true;
+                else
+                    IsSolid = false;
+     
+                IsDefaultCheckBox = checkBoxArgs.IsChecked;
+            }
+        }
 
-        //    }
+     
 
-        //}
         #endregion
     }
 }

+ 15 - 1
PDF Office/ViewModels/Form/FormBaseVM.cs

@@ -296,6 +296,13 @@ namespace PDF_Office.ViewModels.Form
             get { return _content; }
             set { SetProperty(ref _content, value); ChangeValue(AnnotAttrib.Text, value); }
         }
+
+        private string _exportedValues;
+        public string ExportedValues
+        {
+            get { return _exportedValues; }
+            set { SetProperty(ref _exportedValues, value); ChangeValue(AnnotAttrib.ExportValue, value); }
+        }
         //默认值
         private string _defaultValue;
         public string DefaultValue
@@ -319,7 +326,14 @@ namespace PDF_Office.ViewModels.Form
             get { return _isScrollText; }
             set { SetProperty(ref _isScrollText, value); ChangeValue(AnnotAttrib.ScrollFlag, value); }
         }
-
+        //下拉框Form,
+        private bool _isDefaultCheckBox = false;
+        public bool IsDefaultCheckBox
+        {
+            get { return _isDefaultCheckBox; }
+            set { SetProperty(ref _isDefaultCheckBox, value); ChangeValue(AnnotAttrib.IsChecked, value); }
+        }
+        
         #endregion
 
         private void ChangeValue(AnnotAttrib annotAttrib,object obj)

+ 13 - 136
PDF Office/Views/Form/CheckBoxProperty.xaml

@@ -84,10 +84,10 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Name" />
-                    <cus:TextBoxEx x:Name="TbName" Height="32" CornerRadius="4" Text="{Binding NameStr,Mode=TwoWay}" >
+                    <cus:TextBoxEx x:Name="TbName" Height="32" CornerRadius="4" Text="{Binding FieldName,Mode=TwoWay}" >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="TextChanged">
-                                <i:InvokeCommandAction Command="{Binding NameTextChangedCommand}" CommandParameter="{Binding ElementName=TbName,Path=Text}"/>
+                                <i:InvokeCommandAction Command="{Binding FieldNameTextChangedCommand}" CommandParameter="{Binding ElementName=TbName,Path=Text}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>
                     </cus:TextBoxEx>
@@ -106,9 +106,9 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Form Field" />
-                    <form:FormFieldCombox x:Name="formCombox" Type="{Binding FormPos,Mode=OneWay}" Height="32" Margin="0,8,0,16" />
-                    <CheckBox x:Name="ReadOnlyCheckBox" Content="Read Only" Command="{Binding IsReadOnlyCheckedCommand}" CommandParameter="{Binding ElementName=ReadOnlyCheckBox,Path=IsChecked}"/>
-                    <CheckBox x:Name="RequiredFieldCheckBox" Margin="0,8" Content="Required field"  Command="{Binding RequiredFieldCheckedCommand}" CommandParameter="{Binding ElementName=RequiredFieldCheckBox,Path=IsChecked}"/>
+                    <form:FormFieldCombox x:Name="formCombox" Type="{Binding FormField,Mode=OneWay}" Height="32" Margin="0,8,0,16" />
+                    <CheckBox x:Name="ReadOnlyCheckBox" Content="Read Only" IsChecked="{Binding IsReadOnly,Mode=TwoWay}"/>
+                    <CheckBox x:Name="RequiredFieldCheckBox" Margin="0,8" Content="Required field" IsChecked="{Binding IsRequiredField,Mode=TwoWay}" />
                 </StackPanel>
             </TabItem>
             <TabItem>
@@ -206,14 +206,7 @@
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Line" />
 
-
-                            <CompositeControl:SlidComboControl x:Name="thickness">
-                                <i:Interaction.Triggers>
-                                    <i:EventTrigger EventName="ValueChanged">
-                                        <i:InvokeCommandAction Command="{Binding ThicknessChangedCommand}" CommandParameter="{Binding ElementName=thickness,Path=Value}"/>
-                                    </i:EventTrigger>
-                                </i:Interaction.Triggers>
-                            </CompositeControl:SlidComboControl>
+                            <CompositeControl:SlidComboControl x:Name="thickness" Value="{Binding BorderThiness,Mode=TwoWay}"/>
 
                             <StackPanel
                 x:Name="PnlLineStyle"
@@ -226,7 +219,7 @@
                     Click="BtnLineStyle_Click"
                     Command="{Binding LineStyleCommand}"
                     CommandParameter="{Binding ElementName=BtnSolidLine, Path=Tag}"
-                    Style="{StaticResource ToggleBtnViewModeStyle}"
+                    Style="{StaticResource ToggleBtnViewModeStyle}" IsChecked="{Binding IsSolid}"
                     Tag="Solid">
                                     <Border
                         Width="108"
@@ -250,7 +243,7 @@
                     Click="BtnLineStyle_Click"
                     Command="{Binding LineStyleCommand}"
                     CommandParameter="{Binding ElementName=BtnDottedLine, Path=Tag}"
-                    Style="{StaticResource ToggleBtnViewModeStyle}"
+                    Style="{StaticResource ToggleBtnViewModeStyle}" IsChecked="{Binding IsSolid,Converter={StaticResource InvertBoolConvert}}"
                     Tag="Dotted">
                                     <Border
                         Width="108"
@@ -271,122 +264,6 @@
                             </StackPanel>
                         </StackPanel>
 
-
-
-                        <StackPanel>
-                            <TextBlock
-                        Margin="0,18,0,10"
-                        Style="{StaticResource PropertyHeaderLv2}"
-                        Text="文本" />
-
-                            <Grid Margin="0,6,0,0">
-                                <Grid.ColumnDefinitions>
-                                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                                </Grid.ColumnDefinitions>
-                                <Grid.RowDefinitions>
-                                    <RowDefinition Height="auto"></RowDefinition>
-                                    <RowDefinition Height="auto"></RowDefinition>
-                                    <RowDefinition Height="auto"></RowDefinition>
-                                </Grid.RowDefinitions>
-
-                                <Border BorderBrush="#E2E3E6" Grid.ColumnSpan="2"  Width="228" Height="32" Margin="12,0,4,0"  BorderThickness="0">
-                                    <Grid>
-                                        <ComboBox IsReadOnly="True" Name="FontFamilyBox" Background="Transparent" Padding="10 10 0 0"  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="Courier New" FontFamily="Courier New" Tag="Courier"  FontSize="14"/>
-                                            </ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                                <TextBlock Text="Arial" FontFamily="Arial" Tag="Helvetica" FontSize="14"/>
-                                            </ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                                <TextBlock Text="Times New Roman" FontFamily="Times New Roman" Tag="Times Roman" FontSize="14"/>
-                                            </ComboBoxItem>
-                                            <i:Interaction.Triggers>
-                                                <i:EventTrigger EventName="SelectionChanged">
-                                                    <i:InvokeCommandAction Command="{Binding FontFamilyChangedCommand}" CommandParameter="{Binding ElementName=FontFamilyBox,Path=SelectedIndex}"/>
-                                                </i:EventTrigger>
-                                            </i:Interaction.Triggers>
-                                        </ComboBox>
-
-                                        <TextBox Name="FontFamilyText" FontFamily="Segoe UI" FontSize="14" Background="White"  Padding="10 0 0 0" Margin="2,0,25,0" IsReadOnly="True"
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left">
-                                        </TextBox>
-                                    </Grid>
-                                </Border>
-
-
-                                <Border Grid.Row="1" BorderBrush="#E2E3E6"  Width="148" Height="32" Margin="12,8,4,0"  BorderThickness="0">
-                                    <Grid>
-                                        <ComboBox Name="FontStyleBox" IsReadOnly="True" 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 x:Name="RegularItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Regular</ComboBoxItem>
-                                            <ComboBoxItem x:Name="BoldItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold</ComboBoxItem>
-                                            <ComboBoxItem x:Name="ItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Italic</ComboBoxItem>
-                                            <ComboBoxItem x:Name="BoldItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold Italic</ComboBoxItem>
-
-                                            <i:Interaction.Triggers>
-                                                <i:EventTrigger EventName="SelectionChanged">
-                                                    <i:InvokeCommandAction Command="{Binding FontStyleChangedCommand}" CommandParameter="{Binding ElementName=FontStyleBox,Path=SelectedItem}"/>
-                                                </i:EventTrigger>
-                                            </i:Interaction.Triggers>
-                                        </ComboBox>
-                                        <TextBox Name="FontStyleText" IsReadOnly="True" FontFamily="Segoe UI" FontSize="14" Background="White" Padding="10 0 0 0" Height="20" Margin="2,0,35,0" 
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left">
-                                        </TextBox>
-                                    </Grid>
-                                </Border>
-
-                                <Border Grid.Row="1" Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="-1,8,0,0"  BorderThickness="0">
-                                    <Grid>
-                                        <ComboBox Name="FontSizeBox" BorderThickness="1" Background="Transparent" BorderBrush="#FFE2E3E6"
-                                  MaxDropDownHeight="200">
-                                            <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}">6</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">8</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">9</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">10</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">12</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">14</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">18</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">20</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">22</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">24</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">26</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">28</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">32</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">36</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">48</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">72</ComboBoxItem>
-                                            <i:Interaction.Triggers>
-                                                <i:EventTrigger EventName="SelectionChanged">
-                                                    <i:InvokeCommandAction Command="{Binding FontSizeChangedCommand}" CommandParameter="{Binding ElementName=FontSizeBox,Path=SelectedItem}"/>
-                                                </i:EventTrigger>
-                                            </i:Interaction.Triggers>
-                                        </ComboBox>
-                                        <TextBox Name="FontSizeText" FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Padding="10 0 0 0" Margin="2,0,35,0" 
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" IsReadOnly="True">
-                                        </TextBox>
-                                    </Grid>
-                                </Border>
-
-                            </Grid>
-
-                        </StackPanel>
-
                         <StackPanel>
 
                             <TextBlock
@@ -395,10 +272,10 @@
                         Text="大小" />
                             <StackPanel Orientation="Horizontal">
                                 <Path Data="M12.9999 8.75012V10.8285L15.8284 8.00006L12.9999 5.17163V7.25012H2.82843V5.17175L0 8.00017L2.82843 10.8286V8.75012H12.9999Z" Fill="#616469"/>
-                                <cus:NumericUpDown Height="32" Width="90"/>
+                                <cus:NumericUpDown Height="32" Width="90"  Value="{Binding WidthSize,Mode=TwoWay}"/>
 
                                 <Path Data="M10.8284 2.82843H8.74999L8.74999 12.9999H10.8285L8.00005 15.8284L5.17163 12.9999H7.24999L7.24999 2.82843H5.17151L7.99994 0L10.8284 2.82843Z" Fill="#616469"/>
-                                <cus:NumericUpDown Height="32" Width="90"/>
+                                <cus:NumericUpDown Height="32" Width="90" Value="{Binding HeightSize,Mode=TwoWay}"/>
                             </StackPanel>
                         </StackPanel>
 
@@ -418,7 +295,7 @@
                 <Grid>
                     <StackPanel IsEnabled="{Binding ElementName=ChkLock, Path=IsChecked, Converter={StaticResource InvertBoolConvert}}">
                         <TextBlock Text="Default Value"/>
-                        <cus:TextBoxEx x:Name="DefaultValueBox" Height="32" CornerRadius="4" Text="{Binding FormContent,Mode=TwoWay}" >
+                        <cus:TextBoxEx x:Name="DefaultValueBox" Height="32" CornerRadius="4" Text="{Binding ExportedValues,Mode=TwoWay}" >
                             <i:Interaction.Triggers>
                                 <i:EventTrigger EventName="TextChanged">
                                     <i:InvokeCommandAction Command="{Binding FormContentTextChangedCommand}" CommandParameter="{Binding ElementName=DefaultValueBox,Path=Text}"/>
@@ -426,7 +303,7 @@
                             </i:Interaction.Triggers>
                         </cus:TextBoxEx>
 
-                        <CheckBox x:Name="DefaultCheckBox" Content="The checkbox is checked by default"  Command="{Binding DefaultCheckBoxCheckedCommand}" CommandParameter="{Binding ElementName=DefaultCheckBox,Path=IsChecked}"/>
+                        <CheckBox x:Name="DefaultCheckBox" Content="The checkbox is checked by default" IsChecked="{Binding IsDefaultCheckBox}"/>
 
                     </StackPanel>
                 </Grid>
@@ -446,7 +323,7 @@
             <CheckBox
                 Name="ChkLock"
                 Margin="16"
-                Content="Locked" />
+                Content="Locked" IsChecked="{Binding IsLocked,Mode=TwoWay}"/>
         </Border>
     </Grid>
 </UserControl>

+ 46 - 0
PDF Office/Views/Form/CheckBoxProperty.xaml.cs

@@ -26,8 +26,54 @@ namespace PDF_Office.Views.Form
         public CheckBoxProperty()
         {
             InitializeComponent();
+            this.Loaded += usercontrol_Loaded;
+            BindingEvent();
         }
 
+        private void usercontrol_Loaded(object sender, RoutedEventArgs e)
+        {
+            BindingEvent();
+        }
+
+        private void BindingEvent()
+        {
+            if (ViewModel != null)
+            {
+                ViewModel.SelectResetColorBtnHandler -= ViewModel_SelectResetColorBtnHandler;
+                ViewModel.SelectResetColorBtnHandler += ViewModel_SelectResetColorBtnHandler;
+            }
+        }
+
+        private void ViewModel_SelectResetColorBtnHandler(object sender, int e)
+        {
+            switch (e)
+            {
+                case 0:
+                    OneBtn.IsChecked = false;
+                    TwoBtn.IsChecked = false;
+                    ThreeBtn.IsChecked = false;
+                    ForthBtn.IsChecked = false;
+                    break;
+
+                case 1:
+                    OneBtn.IsChecked = true;
+                    break;
+
+                case 2:
+                    TwoBtn.IsChecked = true;
+                    break;
+
+                case 3:
+                    ThreeBtn.IsChecked = true;
+                    break;
+
+                case 4:
+                    ForthBtn.IsChecked = true;
+                    break;
+            }
+        }
+
+
         private void EditMenuItem_Click(object sender, RoutedEventArgs e)
         {
             var Btnitem = sender as MenuItem;