Browse Source

Form - 列表框、下拉菜单

chenrongqian 2 years ago
parent
commit
af5a513dc3

+ 284 - 70
PDF Office/ViewModels/Form/ComboxPropertyViewModel.cs

@@ -1,47 +1,48 @@
-using ComPDFKitViewer.AnnotEvent;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl.CompositeControl;
+using PDF_Office.Helper;
 using PDF_Office.Model;
 using PDF_Office.Model;
+using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Mvvm;
 using Prism.Regions;
 using Prism.Regions;
+using Prism.Services.Dialogs;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using System.Windows;
 using System.Windows.Media;
 using System.Windows.Media;
 
 
 namespace PDF_Office.ViewModels.Form
 namespace PDF_Office.ViewModels.Form
 {
 {
     public class ComboxPropertyViewModel : FormBaseVM, INavigationAware
     public class ComboxPropertyViewModel : FormBaseVM, INavigationAware
     {
     {
-        #region 属性
+        #region Command变量
+        public DelegateCommand<string> FieldNameTextChangedCommand { get; set; }
+        public DelegateCommand<string> ToolTipTextChangedCommand { get; set; }
 
 
-        #region 选项
-        //排序项目
-        private bool _isSortProject = false;
-        public bool IsSortProject
-        {
-            get { return _isSortProject; }
-            set { SetProperty(ref _isSortProject, value); }
-        }
-        //允许用户输入自定义文本
-        private bool _isAllowInOutText = false;
-        public bool IsAllowInOutText
-        {
-            get { return _isAllowInOutText; }
-            set { SetProperty(ref _isAllowInOutText, value); }
-        }
-        #endregion
+        //外观
 
 
-        #endregion
+        public DelegateCommand<object> ResetColorCommand { get; set; }
+        public DelegateCommand<object> ResetColorCheckedBtnCommand { get; set; }
 
 
-        #region Command
+        public DelegateCommand<string> FormContentTextChangedCommand { get; set; }
 
 
+        public DelegateCommand<object> LineStyleCommand { get; set; }
         #endregion
         #endregion
 
 
         #region 变量
         #region 变量
         private CPDFViewer PDFViewer;
         private CPDFViewer PDFViewer;
         private WidgetComboBoxArgs comboBoxArgs;
         private WidgetComboBoxArgs comboBoxArgs;
+        private IDialogService dialogs;
+        public event EventHandler<int> SelectResetColorBtnHandler;
+        public List<ComboDataItem> FontFamilyItems { get; private set; }
+        public List<ComboDataItem> FontStyleItems { get; private set; }
+        public List<ComboDataItem> AglinmentItems { get; private set; }
+
         #endregion
         #endregion
 
 
         #region 初始化
         #region 初始化
@@ -53,28 +54,223 @@ namespace PDF_Office.ViewModels.Form
 
 
         private void InitVariable()
         private void InitVariable()
         {
         {
+            InitAllResetColor();
+            InitFontFamilyComboBox();
+            InitFontStyleComboBox();
+            InitAglinmentItemsComboBox();
+        }
+
+
+        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 InitFontFamilyComboBox()
+        {
+            FontFamilyItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Courier", "Courier New");
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Helvetica", "Helvetica");
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Times Roman", "Times New Roman");
+            FontFamilyItems.Add(item);
+        }
+
+        private void InitFontStyleComboBox()
+        {
+            FontStyleItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Regular", "Regular");
+            FontStyleItems.Add(item);
+            item = new ComboDataItem("Bold", "Bold");
+            FontStyleItems.Add(item);
+            item = new ComboDataItem("Italic", "Italic");
+            FontStyleItems.Add(item);
+
+            item = new ComboDataItem("Bold Italic", "Bold Italic");
+            FontStyleItems.Add(item);
+        }
 
 
+        private void InitAglinmentItemsComboBox()
+        {
+            AglinmentItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Left", "Left");
+            AglinmentItems.Add(item);
+            item = new ComboDataItem("Center", "Center");
+            AglinmentItems.Add(item);
+            item = new ComboDataItem("Right", "Right");
+            AglinmentItems.Add(item);
         }
         }
 
 
         private void InitCommand()
         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);
+
+            //选项
+            FormContentTextChangedCommand = new DelegateCommand<string>(FormContentTextChanged);
         }
         }
 
 
         #endregion
         #endregion
 
 
 
 
-        #region 一般处理
+        #region 事件
+
+
+        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 FormContentTextChanged(string obj)
+        {
+            if (obj != null && IsCurrentWidget == true)
+            {
+                FormContent = obj;
+            }
+        }
 
 
-        #endregion
 
 
-        #region 外观处理
+        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;
+            }
+        }
+
 
 
         #endregion
         #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
         #endregion
 
 
         #region Navegation
         #region Navegation
@@ -86,22 +282,25 @@ namespace PDF_Office.ViewModels.Form
         public void OnNavigatedFrom(NavigationContext navigationContext)
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
         {
             comboBoxArgs = null;
             comboBoxArgs = null;
+            isCreateWidget = false;
+            IsCurrentWidget = false;
         }
         }
 
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<WidgetComboBoxArgs>("WidgetArgs", out comboBoxArgs);
             navigationContext.Parameters.TryGetValue<WidgetComboBoxArgs>("WidgetArgs", out comboBoxArgs);
-
+            navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
             GetWidgeText();
             GetWidgeText();
+            UpdataSelectResetColorBtn();
         }
         }
 
 
         private void GetWidgeText()
         private void GetWidgeText()
         {
         {
-            PDFViewer.SetMouseMode(MouseModes.FormEditTool);
-
+            
             if (comboBoxArgs == null)
             if (comboBoxArgs == null)
             {
             {
+                PDFViewer.SetMouseMode(MouseModes.FormEditTool);
                 comboBoxArgs = new WidgetComboBoxArgs();
                 comboBoxArgs = new WidgetComboBoxArgs();
                 comboBoxArgs.BgColor = Colors.White;
                 comboBoxArgs.BgColor = Colors.White;
                 comboBoxArgs.FontFamily = "Courier New";
                 comboBoxArgs.FontFamily = "Courier New";
@@ -111,58 +310,73 @@ namespace PDF_Office.ViewModels.Form
                 comboBoxArgs.LineWidth = 1;
                 comboBoxArgs.LineWidth = 1;
                 comboBoxArgs.FieldName = "ComBox";
                 comboBoxArgs.FieldName = "ComBox";
                 PDFViewer.SetToolParam(comboBoxArgs);
                 PDFViewer.SetToolParam(comboBoxArgs);
+                isCreateWidget = true;
             }
             }
             else
             else
             {
             {
                 PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
                 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;
+            GetProperty();
 
 
-        //        case FormAttributeType.IsLocked:
-        //            break;
-
-        //        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 (comboBoxArgs != null)
+            {
+                IsLocked = comboBoxArgs.Locked;
+                FieldName = comboBoxArgs.FieldName;
+                ToolTipStr = comboBoxArgs.Tooltip;
+                IsReadOnly = comboBoxArgs.ReadOnly;
+
+                FillColor = comboBoxArgs.BgColor;
+                ContentColor = comboBoxArgs.FontColor;
+                BorderColor = comboBoxArgs.LineColor;
+                BorderThiness = comboBoxArgs.LineWidth;
+                BorderStyle = comboBoxArgs.BorderStyle;
+
+                string fontWeightStyleStr = "";
+                if (comboBoxArgs.FontStyle == FontStyles.Normal)
+                {
+                    if (comboBoxArgs.FontWeight == FontWeights.Normal)
+                        fontWeightStyleStr = "Regular";
+                    else
+                        fontWeightStyleStr = "Bold";
+                }
+                else
+                {
+                    if (comboBoxArgs.FontWeight == FontWeights.Normal)
+                        fontWeightStyleStr = "Italic";
+                    else
+                        fontWeightStyleStr = "Bold Italic";
+                }
+                FontWeightStyleItem = new ComboDataItem(fontWeightStyleStr);
+
+                FontFamilyData = new ComboDataItem(comboBoxArgs.FontFamily);
+                //避免BorderStyle跟上一个值相同,而没触发更改IsSolid属性
+                if (BorderStyle == C_BORDER_STYLE.BS_SOLID)
+                    IsSolid = true;
+                else
+                    IsSolid = false;
+
+                FontSizeData = new ComboDataItem(comboBoxArgs.FontSize);
+                if (isCreateWidget == false)
+                {
+                    HeightSize = comboBoxArgs.Height;
+                    WidthSize = comboBoxArgs.Width;
+                }
+
+                //FormContent = listBoxArgs.Text;
+                //IsMultiLine = listBoxArgs.IsMultiLine;
+                //IsScrollText = listBoxArgs.ScrollFlag;
 
 
-        //}
+            }
+        }
         #endregion
         #endregion
     }
     }
 }
 }

+ 279 - 96
PDF Office/ViewModels/Form/ListBoxPropertyViewModel.cs

@@ -1,14 +1,19 @@
-using ComPDFKitViewer.AnnotEvent;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl.CompositeControl;
 using PDF_Office.Helper;
 using PDF_Office.Helper;
 using PDF_Office.Model;
 using PDF_Office.Model;
+using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Mvvm;
 using Prism.Regions;
 using Prism.Regions;
+using Prism.Services.Dialogs;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using System.Windows;
 using System.Windows.Media;
 using System.Windows.Media;
 
 
 namespace PDF_Office.ViewModels.Form
 namespace PDF_Office.ViewModels.Form
@@ -16,40 +21,32 @@ namespace PDF_Office.ViewModels.Form
 
 
     public class ListBoxPropertyViewModel : FormBaseVM, INavigationAware
     public class ListBoxPropertyViewModel : FormBaseVM, INavigationAware
     {
     {
-        #region 属性
+        #region Command变量
+        public DelegateCommand<string> FieldNameTextChangedCommand { get; set; }
+        public DelegateCommand<string> ToolTipTextChangedCommand { get; set; }
 
 
-        #region 选项
+        //外观
 
 
-        //排序项目
-        private bool _isSortProject = false;
-        public bool IsSortProject
-        {
-            get { return _isSortProject; }
-            set { SetProperty(ref _isSortProject, value); }
-        }
-
-        //多重选择的
-        private bool _multipleSelection = false;
-        public bool MultipleSelection
-        {
-            get { return _multipleSelection; }
-            set { SetProperty(ref _multipleSelection, value); }
-        }
-
-        #endregion
-
-        #endregion
+        public DelegateCommand<object> ResetColorCommand { get; set; }
+        public DelegateCommand<object> ResetColorCheckedBtnCommand { get; set; }
 
 
-        #region Command
+        public DelegateCommand<string> FormContentTextChangedCommand { get; set; }
 
 
+        public DelegateCommand<object> LineStyleCommand { get; set; }
         #endregion
         #endregion
 
 
         #region 变量
         #region 变量
         private CPDFViewer PDFViewer;
         private CPDFViewer PDFViewer;
         private WidgetListBoxArgs listBoxArgs;
         private WidgetListBoxArgs listBoxArgs;
-        public UpdateAttributeHelper AttribEvent;
+        private IDialogService dialogs;
+        public event EventHandler<int> SelectResetColorBtnHandler;
+        public List<ComboDataItem> FontFamilyItems { get; private set; }
+        public List<ComboDataItem> FontStyleItems { get; private set; }
+        public List<ComboDataItem> AglinmentItems { get; private set; }
+
         #endregion
         #endregion
 
 
+
         #region 初始化
         #region 初始化
         public ListBoxPropertyViewModel()
         public ListBoxPropertyViewModel()
         {
         {
@@ -60,54 +57,222 @@ namespace PDF_Office.ViewModels.Form
         private void InitVariable()
         private void InitVariable()
         {
         {
 
 
-            ResetColorOne = new ResetColor()
-            {
-                BorderColor = new SolidColorBrush(Colors.Transparent),
-                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00))
-            };
+            InitAllResetColor();
+            InitFontFamilyComboBox();
+            InitFontStyleComboBox();
+            InitAglinmentItemsComboBox();
+        }
+
+        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 InitFontFamilyComboBox()
+        {
+            FontFamilyItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Courier", "Courier New");
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Helvetica", "Helvetica");
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Times Roman", "Times New Roman");
+            FontFamilyItems.Add(item);
+        }
+
+        private void InitFontStyleComboBox()
+        {
+            FontStyleItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Regular", "Regular");
+            FontStyleItems.Add(item);
+            item = new ComboDataItem("Bold", "Bold");
+            FontStyleItems.Add(item);
+            item = new ComboDataItem("Italic", "Italic");
+            FontStyleItems.Add(item);
+
+            item = new ComboDataItem("Bold Italic", "Bold Italic");
+            FontStyleItems.Add(item);
+        }
+
+        private void InitAglinmentItemsComboBox()
+        {
+            AglinmentItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Left", "Left");
+            AglinmentItems.Add(item);
+            item = new ComboDataItem("Center", "Center");
+            AglinmentItems.Add(item);
+            item = new ComboDataItem("Right", "Right");
+            AglinmentItems.Add(item);
+        }
+
+        private void InitCommand()
+        {
+            //一般
+            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);
+
+            //选项
+            FormContentTextChangedCommand = new DelegateCommand<string>(FormContentTextChanged);
+        }
+
+        #endregion
+
+
+        #region 事件
 
 
-            ResetColorTwo = new ResetColor()
+
+        private void FieldNameTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
             {
             {
-                BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00))
-            };
+                FieldName = obj;
+
+            }
+        }
 
 
-            ResetColorThree = new ResetColor()
+        private void ToolTipTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
             {
             {
-                BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xBD, 0xDF, 0xFD))
-            };
+                ToolTipStr = obj;
+            }
+        }
+
 
 
-            ResetColorForth = new ResetColor()
+        private void LineStyleBtnEvent(object obj)
+        {
+            if (obj != null)
             {
             {
-                BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
-                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
-                FillColor = new SolidColorBrush(Colors.Transparent)
-            };
+                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 InitCommand()
+
+        private void FormContentTextChanged(string obj)
         {
         {
-            //ChangeValueHandler -= ChangeValue;
-            //ChangeValueHandler += ChangeValue;
+            if (obj != null && IsCurrentWidget == true)
+            {
+                FormContent = obj;
+            }
         }
         }
 
 
-        #endregion
 
 
+        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
         #endregion
 
 
-        #region 外观处理
+        #region 外部XAML触发事件
 
 
-        #endregion
+        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;
+            }
 
 
-        #region 选项处理
+            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
         #endregion
 
 
         #region Navegation
         #region Navegation
@@ -119,6 +284,8 @@ namespace PDF_Office.ViewModels.Form
         public void OnNavigatedFrom(NavigationContext navigationContext)
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
         {
             listBoxArgs = null;
             listBoxArgs = null;
+            isCreateWidget = false;
+            IsCurrentWidget = false;
         }
         }
 
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         public void OnNavigatedTo(NavigationContext navigationContext)
@@ -128,12 +295,12 @@ namespace PDF_Office.ViewModels.Form
             navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
             navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
 
 
             GetWidgeText();
             GetWidgeText();
+            UpdataSelectResetColorBtn();
         }
         }
 
 
         private void GetWidgeText()
         private void GetWidgeText()
         {
         {
-          
-
+         
             if (listBoxArgs == null)
             if (listBoxArgs == null)
             {
             {
                 PDFViewer.SetMouseMode(MouseModes.FormEditTool);
                 PDFViewer.SetMouseMode(MouseModes.FormEditTool);
@@ -144,61 +311,77 @@ namespace PDF_Office.ViewModels.Form
                 listBoxArgs.FontColor = Colors.Black;
                 listBoxArgs.FontColor = Colors.Black;
                 listBoxArgs.LineColor = Colors.Black;
                 listBoxArgs.LineColor = Colors.Black;
                 listBoxArgs.LineWidth = 1;
                 listBoxArgs.LineWidth = 1;
-                listBoxArgs.FieldName = "ListBox1";
 
 
                 PDFViewer.SetToolParam(listBoxArgs);
                 PDFViewer.SetToolParam(listBoxArgs);
+                isCreateWidget = true;
             }
             }
             else
             else
             {
             {
                 PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
                 PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
+                isCreateWidget = false;
             }
             }
 
 
-            
-            
-        }
-
-        //更改基类公共属性后,触发的事件
-        //private void ChangeValue(object sender, FormAttributeType e)
-        //{
-        //    switch (e)
-        //    {
-        //        case FormAttributeType.Name:
-        //            break;
-
-        //        case FormAttributeType.ToolTip:
+            GetProperty();
 
 
-        //            break;
+            IsCurrentWidget = true;
 
 
-        //        case FormAttributeType.IsSolid:
-        //            break;
-
-        //        case FormAttributeType.IsLocked:
-        //            break;
-
-        //        case FormAttributeType.HeightSize:
-        //            break;
-
-        //        case FormAttributeType.BorderThiness:
-        //            break;
-
-        //        case FormAttributeType.BorderColor:
-        //            break;
-
-        //        case FormAttributeType.ContentColor:
-        //            break;
-
-        //        case FormAttributeType.IsReadOnly:
-        //            break;
+        }
 
 
-        //        case FormAttributeType.WidthSize:
-        //            break;
+        private void GetProperty()
+        {
+            if (listBoxArgs != null)
+            {
+                IsLocked = listBoxArgs.Locked;
+                FieldName = listBoxArgs.FieldName;
+                ToolTipStr = listBoxArgs.Tooltip;
+                IsReadOnly = listBoxArgs.ReadOnly;
+
+                FillColor = listBoxArgs.BgColor;
+                ContentColor = listBoxArgs.FontColor;
+                BorderColor = listBoxArgs.LineColor;
+                BorderThiness = listBoxArgs.LineWidth;
+                BorderStyle = listBoxArgs.BorderStyle;
+
+                string fontWeightStyleStr = "";
+                if (listBoxArgs.FontStyle == FontStyles.Normal)
+                {
+                    if (listBoxArgs.FontWeight == FontWeights.Normal)
+                        fontWeightStyleStr = "Regular";
+                    else
+                        fontWeightStyleStr = "Bold";
+                }
+                else
+                {
+                    if (listBoxArgs.FontWeight == FontWeights.Normal)
+                        fontWeightStyleStr = "Italic";
+                    else
+                        fontWeightStyleStr = "Bold Italic";
+                }
+                FontWeightStyleItem = new ComboDataItem(fontWeightStyleStr);
+
+                FontFamilyData = new ComboDataItem(listBoxArgs.FontFamily);
+                //避免BorderStyle跟上一个值相同,而没触发更改IsSolid属性
+                if (BorderStyle == C_BORDER_STYLE.BS_SOLID)
+                    IsSolid = true;
+                else
+                    IsSolid = false;
+                FontSizeData = new ComboDataItem(listBoxArgs.FontSize);
+                if (isCreateWidget == false)
+                {
+                    HeightSize = listBoxArgs.Height;
+                    WidthSize = listBoxArgs.Width;
+                }
+
+           
 
 
-        //        case FormAttributeType.IsRequiredField:
-        //            break;
+            
 
 
-        //    }
+                //FormContent = listBoxArgs.Text;
+                //IsMultiLine = listBoxArgs.IsMultiLine;
+                //IsScrollText = listBoxArgs.ScrollFlag;
 
 
-        //}
+            }
+        }
         #endregion
         #endregion
     }
     }
 }
 }

File diff suppressed because it is too large
+ 410 - 2
PDF Office/Views/Form/ComboxProperty.xaml


+ 76 - 1
PDF Office/Views/Form/ComboxProperty.xaml.cs

@@ -1,4 +1,6 @@
-using System;
+using PDF_Office.CustomControl;
+using PDF_Office.ViewModels.Form;
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
@@ -20,9 +22,82 @@ namespace PDF_Office.Views.Form
     /// </summary>
     /// </summary>
     public partial class ComboxProperty : UserControl
     public partial class ComboxProperty : UserControl
     {
     {
+        public ComboxPropertyViewModel ViewModel => DataContext as ComboxPropertyViewModel;
         public ComboxProperty()
         public ComboxProperty()
         {
         {
             InitializeComponent();
             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;
+            if (Btnitem == null) return;
+            if (ViewModel != null)
+            {
+                // ViewModel.ResetColorCommand?.Execute(Btnitem);
+            }
+        }
+
+        private void BtnLineStyle_Click(object sender, RoutedEventArgs e)
+        {
+            var btn = sender as CustomIconToggleBtn;
+            foreach (var item in PnlLineStyle.Children)
+            {
+                var btnItem = item as CustomIconToggleBtn;
+                if (btnItem != null)
+                {
+                    if (btn != btnItem)
+                        btnItem.IsChecked = false;
+                    else
+                        btnItem.IsChecked = true;
+                }
+            }
         }
         }
     }
     }
 }
 }

+ 30 - 112
PDF Office/Views/Form/ListBoxProperty.xaml

@@ -84,10 +84,10 @@
                         Margin="0,18,0,10"
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Name" />
                         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:Interaction.Triggers>
                             <i:EventTrigger EventName="TextChanged">
                             <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:EventTrigger>
                         </i:Interaction.Triggers>
                         </i:Interaction.Triggers>
                     </cus:TextBoxEx>
                     </cus:TextBoxEx>
@@ -106,8 +106,9 @@
                         Margin="0,18,0,10"
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Form Field" />
                         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}"/>
+                    <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>
                 </StackPanel>
             </TabItem>
             </TabItem>
             <TabItem>
             <TabItem>
@@ -214,7 +215,6 @@
 
 
                             </Grid>
                             </Grid>
 
 
-
                         </StackPanel>
                         </StackPanel>
 
 
                         <StackPanel>
                         <StackPanel>
@@ -223,15 +223,7 @@
                         Style="{StaticResource PropertyHeaderLv2}"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Line" />
                         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
                             <StackPanel
                 x:Name="PnlLineStyle"
                 x:Name="PnlLineStyle"
                 Margin="0,20,0,0"
                 Margin="0,20,0,0"
@@ -243,7 +235,7 @@
                     Click="BtnLineStyle_Click"
                     Click="BtnLineStyle_Click"
                     Command="{Binding LineStyleCommand}"
                     Command="{Binding LineStyleCommand}"
                     CommandParameter="{Binding ElementName=BtnSolidLine, Path=Tag}"
                     CommandParameter="{Binding ElementName=BtnSolidLine, Path=Tag}"
-                    Style="{StaticResource ToggleBtnViewModeStyle}"
+                    Style="{StaticResource ToggleBtnViewModeStyle}" IsChecked="{Binding IsSolid}"
                     Tag="Solid">
                     Tag="Solid">
                                     <Border
                                     <Border
                         Width="108"
                         Width="108"
@@ -267,7 +259,7 @@
                     Click="BtnLineStyle_Click"
                     Click="BtnLineStyle_Click"
                     Command="{Binding LineStyleCommand}"
                     Command="{Binding LineStyleCommand}"
                     CommandParameter="{Binding ElementName=BtnDottedLine, Path=Tag}"
                     CommandParameter="{Binding ElementName=BtnDottedLine, Path=Tag}"
-                    Style="{StaticResource ToggleBtnViewModeStyle}"
+                    Style="{StaticResource ToggleBtnViewModeStyle}" IsChecked="{Binding IsSolid,Converter={StaticResource InvertBoolConvert}}"
                     Tag="Dotted">
                     Tag="Dotted">
                                     <Border
                                     <Border
                         Width="108"
                         Width="108"
@@ -307,98 +299,22 @@
                                     <RowDefinition Height="auto"></RowDefinition>
                                     <RowDefinition Height="auto"></RowDefinition>
                                 </Grid.RowDefinitions>
                                 </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>
+                                <CompositeControl:CustomComboControl x:Name="FontFamilyBox" 
+                                                                     ItemSource="{Binding FontFamilyItems}" SelectedItems="{Binding FontFamilyData,Mode=TwoWay}"
+                                                                     IsValueContent="True" Grid.ColumnSpan="2"  Width="228" Height="32">
+                                </CompositeControl:CustomComboControl>
+
+                                <CompositeControl:CustomComboControl x:Name="FontStyleBox" Grid.Row="1"
+                                                                     Width="148" Height="32" Margin="12,8,4,0"
+                                                                     ItemSource="{Binding FontStyleItems}"  SelectedItems="{Binding FontWeightStyleItem,Mode=TwoWay}"
+                                                                     IsValueContent="True" Grid.Column="0">
+                                </CompositeControl:CustomComboControl>
+
+
+                                <CompositeControl:CustomComboControl x:Name="FontSizeBox" Grid.Row="1" Grid.Column="1" SelectedItems="{Binding FontSizeData,Mode=TwoWay}"
+                                                                     Width="80" Height="32" Margin="-1,8,0,0"
+                                                                     >
+                                </CompositeControl:CustomComboControl>
 
 
                             </Grid>
                             </Grid>
 
 
@@ -412,10 +328,10 @@
                         Text="大小" />
                         Text="大小" />
                             <StackPanel Orientation="Horizontal">
                             <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"/>
                                 <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"/>
                                 <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>
                         </StackPanel>
                         </StackPanel>
 
 
@@ -433,7 +349,7 @@
                     <Path Data="M4.91675 3.75V5H6.41675V1H4.91675V2.25H1.66675V3.75H4.91675ZM15.6667 3.75L7.66675 3.75V2.25L15.6667 2.25V3.75ZM1.66675 7.25V8.75H8.91675V10H10.4167V6H8.91675V7.25H1.66675ZM15.6667 8.75L11.6667 8.75V7.25L15.6667 7.25V8.75ZM7.66675 12.25V13.75L15.6667 13.75V12.25L7.66675 12.25ZM4.91675 13.75H1.66675V12.25H4.91675V11H6.41675V15H4.91675V13.75Z" Fill="{StaticResource color.light.gray.11}" />
                     <Path Data="M4.91675 3.75V5H6.41675V1H4.91675V2.25H1.66675V3.75H4.91675ZM15.6667 3.75L7.66675 3.75V2.25L15.6667 2.25V3.75ZM1.66675 7.25V8.75H8.91675V10H10.4167V6H8.91675V7.25H1.66675ZM15.6667 8.75L11.6667 8.75V7.25L15.6667 7.25V8.75ZM7.66675 12.25V13.75L15.6667 13.75V12.25L7.66675 12.25ZM4.91675 13.75H1.66675V12.25H4.91675V11H6.41675V15H4.91675V13.75Z" Fill="{StaticResource color.light.gray.11}" />
                 </TabItem.Header>
                 </TabItem.Header>
                 <Grid>
                 <Grid>
-                  
+
                     <StackPanel  IsEnabled="{Binding ElementName=ChkLock, Path=IsChecked, Converter={StaticResource InvertBoolConvert}}">
                     <StackPanel  IsEnabled="{Binding ElementName=ChkLock, Path=IsChecked, Converter={StaticResource InvertBoolConvert}}">
                         <TextBlock
                         <TextBlock
                         Margin="0,18,0,10"
                         Margin="0,18,0,10"
@@ -498,7 +414,9 @@
             <CheckBox
             <CheckBox
                 Name="ChkLock"
                 Name="ChkLock"
                 Margin="16"
                 Margin="16"
-                Content="Locked" />
+                Content="Locked" IsChecked="{Binding IsLocked,Mode=TwoWay}">
+
+            </CheckBox>
         </Border>
         </Border>
     </Grid>
     </Grid>
 </UserControl>
 </UserControl>

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

@@ -26,8 +26,54 @@ namespace PDF_Office.Views.Form
         public ListBoxProperty()
         public ListBoxProperty()
         {
         {
             InitializeComponent();
             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)
         private void EditMenuItem_Click(object sender, RoutedEventArgs e)
         {
         {
             var Btnitem = sender as MenuItem;
             var Btnitem = sender as MenuItem;