Procházet zdrojové kódy

Form - 选中表单表单域同步变化、列表框下拉框的Option选项设置

chenrongqian před 2 roky
rodič
revize
83c593e273

+ 1 - 0
PDF Office/App.xaml.cs

@@ -256,6 +256,7 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<ButtonProperty>();
             containerRegistry.RegisterForNavigation<CheckBoxProperty>();
             containerRegistry.RegisterForNavigation<ListBoxProperty>();
+            containerRegistry.RegisterForNavigation<ComboxProperty>();
             containerRegistry.RegisterForNavigation<RadioButtonProperty>();
             containerRegistry.RegisterForNavigation<SignProperty>();
 

+ 10 - 2
PDF Office/CustomControl/Form/FormFieldCombox.xaml.cs

@@ -38,9 +38,17 @@ namespace PDF_Office.CustomControl.Form
 
         // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty TypeProperty =
-            DependencyProperty.Register("Type", typeof(FormFieldType), typeof(FormFieldCombox), new PropertyMetadata(FormFieldType.visible));
-
+            DependencyProperty.Register("Type", typeof(FormFieldType), typeof(FormFieldCombox), new PropertyMetadata(FormFieldType.visible, FormFieldTypePropertyChanged));
 
+        private static void FormFieldTypePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+        {
+            var control = d as FormFieldCombox;
+            var type = (FormFieldType)e.NewValue;
+            if (control != null)
+            {
+                control.Combox.SelectedIndex = (int)type;
+            }
+        }
 
         public FormFieldType SetType
         {

+ 181 - 8
PDF Office/ViewModels/Form/ComboxPropertyViewModel.cs

@@ -1,4 +1,5 @@
 using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer;
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Office.CustomControl.CompositeControl;
@@ -10,6 +11,8 @@ using Prism.Regions;
 using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -32,6 +35,16 @@ namespace PDF_Office.ViewModels.Form
         public DelegateCommand<string> FormContentTextChangedCommand { get; set; }
 
         public DelegateCommand<object> LineStyleCommand { get; set; }
+        //选项
+        public DelegateCommand<object> AddOptionCommand { get; set; }
+        public DelegateCommand<object> RemoveOptionCommand { get; set; }
+        public DelegateCommand<object> UpItemOptionCommand { get; set; }
+        public DelegateCommand<object> DownItemOptionCommand { get; set; }
+        public DelegateCommand<string> OptionKeyTextChangedCommand { get; set; }
+
+        public DelegateCommand<string> OptionKeyValueTextChangedCommand { get; set; }
+        public DelegateCommand<object> OptionSelectionChangedCommand { get; set; }
+        
         #endregion
 
         #region 变量
@@ -42,6 +55,7 @@ namespace PDF_Office.ViewModels.Form
         public List<ComboDataItem> FontFamilyItems { get; private set; }
         public List<ComboDataItem> FontStyleItems { get; private set; }
         public List<ComboDataItem> AglinmentItems { get; private set; }
+        public ObservableCollection<ComboDataItem> OptionItems { get; private set; }
 
         #endregion
 
@@ -58,8 +72,21 @@ namespace PDF_Office.ViewModels.Form
             InitFontFamilyComboBox();
             InitFontStyleComboBox();
             InitAglinmentItemsComboBox();
+            InitOptionItems();
         }
 
+        private void InitOptionItems()
+        {
+            OptionItems = new ObservableCollection<ComboDataItem>();
+            OptionItems.CollectionChanged -= OptionItems_CollectionChanged;
+            OptionItems.CollectionChanged += OptionItems_CollectionChanged;
+        }
+
+        private void OptionItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+        {
+           if(OptionItems.Count == 0)
+                IsRemoveOption = false;
+        }
 
         private void InitAllResetColor()
         {
@@ -79,7 +106,7 @@ namespace PDF_Office.ViewModels.Form
             FontFamilyItems.Add(item);
             item = new ComboDataItem("Helvetica", "Helvetica");
             FontFamilyItems.Add(item);
-            item = new ComboDataItem("Times Roman", "Times New Roman");
+            item = new ComboDataItem("Times", "Times New Roman");
             FontFamilyItems.Add(item);
         }
 
@@ -120,6 +147,13 @@ namespace PDF_Office.ViewModels.Form
 
             //选项
             FormContentTextChangedCommand = new DelegateCommand<string>(FormContentTextChanged);
+            AddOptionCommand = new DelegateCommand<object>(AddOption);
+            RemoveOptionCommand = new DelegateCommand<object>(RemoveOption);
+            UpItemOptionCommand = new DelegateCommand<object>(UpItemOption);
+            DownItemOptionCommand = new DelegateCommand<object>(DownItemOption);
+            OptionKeyTextChangedCommand = new DelegateCommand<string>(OptionKeyTextChanged);
+            OptionKeyValueTextChangedCommand = new DelegateCommand<string>(OptionKeyValueTextChanged);
+            OptionSelectionChangedCommand = new DelegateCommand<object>(OptionSelectionChanged);
         }
 
         #endregion
@@ -171,6 +205,142 @@ namespace PDF_Office.ViewModels.Form
             }
         }
 
+        private void OptionKeyValueTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                OptionKeyValue = obj;
+            }
+            UpdateIsInputOption();
+        }
+
+        private void OptionKeyTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                OptionKey = obj;
+            }
+
+            UpdateIsInputOption();
+        }
+
+        private void OptionSelectionChanged(object obj)
+        {
+            if(obj != null && obj is int == true)
+            {
+                UpdateAllOptionBtn((int)obj);
+            }
+
+        }
+
+        //刷新所有Option有关的按钮状态
+        private void UpdateAllOptionBtn(int SelectedIndex)
+        {
+            var count = OptionItems.Count;
+            if (SelectedIndex <= -1)
+            {
+                IsDownOption = false;
+                IsUpOption = false;
+                IsRemoveOption = false;
+            }
+            else
+            {
+                IsRemoveOption = true;
+                IsUpOption = SelectedIndex == 0 ? false : true;
+                IsDownOption = (SelectedIndex == count - 1)?false:true;
+            }
+            OptionSelectedIndex = SelectedIndex;
+        }
+
+        //Option是否可输入内容
+        private void UpdateIsInputOption()
+        {
+            if (string.IsNullOrEmpty(OptionKeyValue) || string.IsNullOrEmpty(OptionKey))
+            {
+                IsInputOption = false;
+            }
+            else
+            {
+                foreach (var item in OptionItems)
+                {
+                    if (item.ValueStr == OptionKeyValue || item.Content == OptionKey)
+                    {
+                        IsInputOption = false;
+                        return;
+                    }
+                }
+
+                IsInputOption = true;
+            }
+        }
+        //新增Option项
+        private void AddOption(object obj)
+        {
+
+            if (string.IsNullOrEmpty(OptionKey) || string.IsNullOrEmpty(OptionKeyValue))
+                return;
+
+            var item = new ComboDataItem(OptionKeyValue,OptionKey);
+            OptionItems.Add(item);
+            OptionsList[item.Content] = item.ValueStr;
+            ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+            OptionKey = "";
+            OptionKeyValue = "";
+            UpdateAllOptionBtn(OptionSelectedIndex);
+        }
+        //移除Option项
+        private void RemoveOption(object obj)
+        {
+            if(obj != null)
+            {
+                var item = (ComboDataItem)obj;
+                OptionsList.Remove(item.Content);
+                OptionItems.Remove(item);
+                ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+                UpdateAllOptionBtn(-1);
+            }
+        }
+        //向下移项
+        private void DownItemOption(object obj)
+        {
+            if(obj != null)
+            {
+                var item = (ComboDataItem)obj;
+               var index =  OptionItems.IndexOf(item);
+                if(index < OptionItems.Count - 1)
+                {
+                    OptionItems.Move(index, index + 1);
+                    UpdateAllOptionBtn(index + 1);
+                    OptionsList.Clear();
+                    foreach(var itemOption in OptionItems)
+                    {
+                        OptionsList[itemOption.Content] = itemOption.ValueStr;
+                    }
+                    ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+                }
+            }
+        }
+        //向上移项
+        private void UpItemOption(object obj)
+        {
+            if (obj != null)
+            {
+                var item = (ComboDataItem)obj;
+                var index = OptionItems.IndexOf(item);
+                if (index > 0)
+                {
+                    OptionItems.Move(index, index - 1);
+                    UpdateAllOptionBtn(index - 1);
+                    OptionsList.Clear();
+                    foreach (var itemOption in OptionItems)
+                    {
+                        OptionsList[itemOption.Content] = itemOption.ValueStr;
+                    }
+                    ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+                }
+            }
+        }
+
 
         private void ResetColorCheckedBtn(object obj)
         {
@@ -282,8 +452,7 @@ namespace PDF_Office.ViewModels.Form
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             comboBoxArgs = null;
-            isCreateWidget = false;
-            IsCurrentWidget = false;
+            ClearVMData();
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
@@ -291,6 +460,7 @@ namespace PDF_Office.ViewModels.Form
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<WidgetComboBoxArgs>("WidgetArgs", out comboBoxArgs);
             navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
+            OptionsList = new Dictionary<string, string>();
             GetWidgeText();
             UpdataSelectResetColorBtn();
         }
@@ -370,11 +540,14 @@ namespace PDF_Office.ViewModels.Form
                     HeightSize = comboBoxArgs.Height;
                     WidthSize = comboBoxArgs.Width;
                 }
-
-                //FormContent = listBoxArgs.Text;
-                //IsMultiLine = listBoxArgs.IsMultiLine;
-                //IsScrollText = listBoxArgs.ScrollFlag;
-
+                OptionsList = comboBoxArgs.ListOptions;
+                OptionItems.Clear();
+                foreach (string key in OptionsList.Keys)
+                {
+                    var item = new ComboDataItem(OptionsList[key], key);
+                    OptionItems.Add(item);
+                }
+                
             }
         }
         #endregion

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

@@ -352,9 +352,62 @@ namespace PDF_Office.ViewModels.Form
             set { SetProperty(ref _radioMemberName, value); ChangeValue(AnnotAttrib.RadioMemberName, value); }
         }
 
+        //Option
+        //是否可以输入内容
+        private bool _isInputOption = false;
+        public bool IsInputOption
+        {
+            get { return _isInputOption; }
+            set { SetProperty(ref _isInputOption, value); }
+        }
+
+        private bool _isUpOption = false;
+        public bool IsUpOption
+        {
+            get { return _isUpOption; }
+            set{ SetProperty(ref _isUpOption, value);  }
+        }
+
+        private bool _isDownOption = false;
+        public bool IsDownOption
+        {
+            get { return _isDownOption; }
+            set { SetProperty(ref _isDownOption, value); }
+        }
+
+        private bool _isRemoveOption = false;
+        public bool IsRemoveOption
+        {
+            get { return _isRemoveOption; }
+            set { SetProperty(ref _isRemoveOption, value); }
+        }
+
+        public int OptionSelectedIndex = -1;
+
+        private string _optionKey;
+        public string OptionKey
+        {
+            get { return _optionKey; }
+            set { SetProperty(ref _optionKey, value); }
+        }
+
+        private string _optionKeyValue;
+        public string OptionKeyValue
+        {
+            get { return _optionKeyValue; }
+            set { SetProperty(ref _optionKeyValue, value); }
+        }
+
+        private Dictionary<string, string> _optionsList;
+        public Dictionary<string, string> OptionsList
+        {
+            get { return _optionsList; }
+            set { SetProperty(ref _optionsList, value); }
+        }
+
         #endregion
 
-        private void ChangeValue(AnnotAttrib annotAttrib,object obj)
+        public void ChangeValue(AnnotAttrib annotAttrib,object obj)
         {
        
             if(AttribEvent != null && IsCurrentWidget && AttribEvent.IsCreateForm() == false)
@@ -376,6 +429,20 @@ namespace PDF_Office.ViewModels.Form
             };
         }
 
+        //退出或切换属性面板,清除数据
+        public void ClearVMData()
+        {
+            isCreateWidget = false;
+            IsCurrentWidget = false;
+            OptionsList = null;
+            IsRemoveOption = false;
+            IsInputOption = false;
+            IsUpOption = false;
+            IsDownOption = false;
+            OptionSelectedIndex = -1;
+            OptionKey = "";
+            OptionKeyValue = "";
+        }
         #endregion
     }
 

+ 180 - 9
PDF Office/ViewModels/Form/ListBoxPropertyViewModel.cs

@@ -1,4 +1,5 @@
 using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer;
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Office.CustomControl.CompositeControl;
@@ -10,6 +11,8 @@ using Prism.Regions;
 using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -33,6 +36,15 @@ namespace PDF_Office.ViewModels.Form
         public DelegateCommand<string> FormContentTextChangedCommand { get; set; }
 
         public DelegateCommand<object> LineStyleCommand { get; set; }
+        //选项
+        public DelegateCommand<object> AddOptionCommand { get; set; }
+        public DelegateCommand<object> RemoveOptionCommand { get; set; }
+        public DelegateCommand<object> UpItemOptionCommand { get; set; }
+        public DelegateCommand<object> DownItemOptionCommand { get; set; }
+        public DelegateCommand<string> OptionKeyTextChangedCommand { get; set; }
+
+        public DelegateCommand<string> OptionKeyValueTextChangedCommand { get; set; }
+        public DelegateCommand<object> OptionSelectionChangedCommand { get; set; }
         #endregion
 
         #region 变量
@@ -43,6 +55,7 @@ namespace PDF_Office.ViewModels.Form
         public List<ComboDataItem> FontFamilyItems { get; private set; }
         public List<ComboDataItem> FontStyleItems { get; private set; }
         public List<ComboDataItem> AglinmentItems { get; private set; }
+        public ObservableCollection<ComboDataItem> OptionItems { get; private set; }
 
         #endregion
 
@@ -61,6 +74,20 @@ namespace PDF_Office.ViewModels.Form
             InitFontFamilyComboBox();
             InitFontStyleComboBox();
             InitAglinmentItemsComboBox();
+            InitOptionItems();
+        }
+
+        private void InitOptionItems()
+        {
+            OptionItems = new ObservableCollection<ComboDataItem>();
+            OptionItems.CollectionChanged -= OptionItems_CollectionChanged;
+            OptionItems.CollectionChanged += OptionItems_CollectionChanged;
+        }
+
+        private void OptionItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+        {
+            if (OptionItems.Count == 0)
+                IsRemoveOption = false;
         }
 
         private void InitAllResetColor()
@@ -122,6 +149,13 @@ namespace PDF_Office.ViewModels.Form
 
             //选项
             FormContentTextChangedCommand = new DelegateCommand<string>(FormContentTextChanged);
+            AddOptionCommand = new DelegateCommand<object>(AddOption);
+            RemoveOptionCommand = new DelegateCommand<object>(RemoveOption);
+            UpItemOptionCommand = new DelegateCommand<object>(UpItemOption);
+            DownItemOptionCommand = new DelegateCommand<object>(DownItemOption);
+            OptionKeyTextChangedCommand = new DelegateCommand<string>(OptionKeyTextChanged);
+            OptionKeyValueTextChangedCommand = new DelegateCommand<string>(OptionKeyValueTextChanged);
+            OptionSelectionChangedCommand = new DelegateCommand<object>(OptionSelectionChanged);
         }
 
         #endregion
@@ -174,6 +208,143 @@ namespace PDF_Office.ViewModels.Form
         }
 
 
+        private void OptionKeyValueTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                OptionKeyValue = obj;
+            }
+            UpdateIsInputOption();
+        }
+
+        private void OptionKeyTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                OptionKey = obj;
+            }
+
+            UpdateIsInputOption();
+        }
+
+        private void OptionSelectionChanged(object obj)
+        {
+            if (obj != null && obj is int == true)
+            {
+                UpdateAllOptionBtn((int)obj);
+            }
+
+        }
+
+        //刷新所有Option有关的按钮状态
+        private void UpdateAllOptionBtn(int SelectedIndex)
+        {
+            var count = OptionItems.Count;
+            if (SelectedIndex <= -1)
+            {
+                IsDownOption = false;
+                IsUpOption = false;
+                IsRemoveOption = false;
+            }
+            else
+            {
+                IsRemoveOption = true;
+                IsUpOption = SelectedIndex == 0 ? false : true;
+                IsDownOption = (SelectedIndex == count - 1) ? false : true;
+            }
+            OptionSelectedIndex = SelectedIndex;
+        }
+
+        //Option是否可输入内容
+        private void UpdateIsInputOption()
+        {
+            if (string.IsNullOrEmpty(OptionKeyValue) || string.IsNullOrEmpty(OptionKey))
+            {
+                IsInputOption = false;
+            }
+            else
+            {
+                foreach (var item in OptionItems)
+                {
+                    if (item.ValueStr == OptionKeyValue || item.Content == OptionKey)
+                    {
+                        IsInputOption = false;
+                        return;
+                    }
+                }
+
+                IsInputOption = true;
+            }
+        }
+        //新增Option项
+        private void AddOption(object obj)
+        {
+
+            if (string.IsNullOrEmpty(OptionKey) || string.IsNullOrEmpty(OptionKeyValue))
+                return;
+
+            var item = new ComboDataItem(OptionKeyValue, OptionKey);
+            OptionItems.Add(item);
+            OptionsList[item.Content] = item.ValueStr;
+            ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+            OptionKey = "";
+            OptionKeyValue = "";
+            UpdateAllOptionBtn(OptionSelectedIndex);
+        }
+        //移除Option项
+        private void RemoveOption(object obj)
+        {
+            if (obj != null)
+            {
+                var item = (ComboDataItem)obj;
+                OptionsList.Remove(item.Content);
+                OptionItems.Remove(item);
+                ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+                UpdateAllOptionBtn(-1);
+            }
+        }
+        //向下移项
+        private void DownItemOption(object obj)
+        {
+            if (obj != null)
+            {
+                var item = (ComboDataItem)obj;
+                var index = OptionItems.IndexOf(item);
+                if (index < OptionItems.Count - 1)
+                {
+                    OptionItems.Move(index, index + 1);
+                    UpdateAllOptionBtn(index + 1);
+                    OptionsList.Clear();
+                    foreach (var itemOption in OptionItems)
+                    {
+                        OptionsList[itemOption.Content] = itemOption.ValueStr;
+                    }
+                    ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+                }
+            }
+        }
+        //向上移项
+        private void UpItemOption(object obj)
+        {
+            if (obj != null)
+            {
+                var item = (ComboDataItem)obj;
+                var index = OptionItems.IndexOf(item);
+                if (index > 0)
+                {
+                    OptionItems.Move(index, index - 1);
+                    UpdateAllOptionBtn(index - 1);
+                    OptionsList.Clear();
+                    foreach (var itemOption in OptionItems)
+                    {
+                        OptionsList[itemOption.Content] = itemOption.ValueStr;
+                    }
+                    ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+                }
+            }
+        }
+
+
         private void ResetColorCheckedBtn(object obj)
         {
             if (obj != null)
@@ -284,8 +455,7 @@ namespace PDF_Office.ViewModels.Form
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             listBoxArgs = null;
-            isCreateWidget = false;
-            IsCurrentWidget = false;
+            ClearVMData();
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
@@ -293,6 +463,7 @@ namespace PDF_Office.ViewModels.Form
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<WidgetListBoxArgs>("WidgetArgs", out listBoxArgs);
             navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
+            OptionsList = new Dictionary<string, string>();
 
             GetWidgeText();
             UpdataSelectResetColorBtn();
@@ -372,13 +543,13 @@ namespace PDF_Office.ViewModels.Form
                     WidthSize = listBoxArgs.Width;
                 }
 
-           
-
-            
-
-                //FormContent = listBoxArgs.Text;
-                //IsMultiLine = listBoxArgs.IsMultiLine;
-                //IsScrollText = listBoxArgs.ScrollFlag;
+                OptionsList = listBoxArgs.ListOptions;
+                OptionItems.Clear();
+                foreach (string key in OptionsList.Keys)
+                {
+                    var item = new ComboDataItem(OptionsList[key], key);
+                    OptionItems.Add(item);
+                }
 
             }
         }

+ 2 - 0
PDF Office/ViewModels/Form/TextFieldPropertyViewModel.cs

@@ -340,6 +340,8 @@ namespace PDF_Office.ViewModels.Form
                 BorderThiness = textBoxArgs.LineWidth;
                 BorderStyle = textBoxArgs.BorderStyle;
 
+                FormField = (FormFieldType)textBoxArgs.FormField;
+
                 string fontWeightStyleStr = "";
                 if (textBoxArgs.FontStyle == FontStyles.Normal)
                 {

+ 1 - 1
PDF Office/Views/Form/CheckBoxProperty.xaml

@@ -298,7 +298,7 @@
                         <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}"/>
+                                    <i:InvokeCommandAction Command="{Binding ExportedValuesTextChangedCommand}" CommandParameter="{Binding ElementName=DefaultValueBox,Path=Text}"/>
                                 </i:EventTrigger>
                             </i:Interaction.Triggers>
                         </cus:TextBoxEx>

+ 39 - 15
PDF Office/Views/Form/ComboxProperty.xaml

@@ -53,6 +53,11 @@
                     IsEnabled="True" />
 
             </ContextMenu>
+            <DataTemplate x:Key="numberData">
+                <Grid>
+                    <TextBlock Text="{Binding Content}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
+                </Grid>
+            </DataTemplate>
         </ResourceDictionary>
     </UserControl.Resources>
     <Grid ScrollViewer.VerticalScrollBarVisibility="Auto">
@@ -67,7 +72,7 @@
             FontFamily="Segoe UI"
             FontSize="14"
             FontWeight="SemiBold"
-            Text="Text Field" />
+            Text="Combox" />
         <TabControl
             Grid.Row="1"
             Margin="16,0"
@@ -335,11 +340,6 @@
                             </StackPanel>
                         </StackPanel>
 
-
-
-
-
-
                     </StackPanel>
                 </Grid>
             </TabItem>
@@ -356,15 +356,21 @@
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Projects" />
                         <Grid>
-                            <cus:TextBoxEx
+                            <cus:TextBoxEx x:Name="TbOptionKey"
                             Width="188"
                             Height="32"
                             HorizontalAlignment="Left"
-                            CornerRadius="4" />
+                            CornerRadius="4"  Text="{Binding OptionKey,Mode=TwoWay}">
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="TextChanged">
+                                        <i:InvokeCommandAction Command="{Binding OptionKeyTextChangedCommand}" CommandParameter="{Binding ElementName=TbOptionKey,Path=Text}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </cus:TextBoxEx>
                             <Button
                             Width="32"
-                            HorizontalAlignment="Right"
-                            Style="{StaticResource btn.sec-icon}">
+                            HorizontalAlignment="Right" Command="{Binding AddOptionCommand}"
+                            Style="{StaticResource btn.sec-icon}" IsEnabled="{Binding IsInputOption}">
                                 <Path Data="M7.25 8.75V14H8.75V8.75H14V7.25H8.75V2H7.25V7.25H2V8.75H7.25Z" />
                             </Button>
                         </Grid>
@@ -372,26 +378,44 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Exported Values" />
-                        <cus:TextBoxEx Height="32" CornerRadius="4" />
-                        <ListBox Height="98" Margin="0,8" />
+                        <cus:TextBoxEx x:Name="TbOptionKeyValue" Height="32" CornerRadius="4"  Text="{Binding OptionKeyValue,Mode=TwoWay}">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="TextChanged">
+                                    <i:InvokeCommandAction Command="{Binding OptionKeyValueTextChangedCommand}" CommandParameter="{Binding ElementName=TbOptionKeyValue,Path=Text}"/>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </cus:TextBoxEx>
+                        <ListBox x:Name="optionList" Height="98" Margin="0,8" ItemsSource="{Binding OptionItems}" ItemTemplate="{StaticResource numberData}">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="SelectionChanged">
+                                    <i:InvokeCommandAction Command="{Binding OptionSelectionChangedCommand}" CommandParameter="{Binding ElementName=optionList,Path=SelectedIndex}"/>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </ListBox>
                         <StackPanel Margin="0,0,0,8" Orientation="Horizontal">
                             <Button
                             Width="32"
                             Height="32"
-                            Style="{StaticResource btn.sec-icon}">
+                            Style="{StaticResource btn.sec-icon}" IsEnabled="{Binding IsRemoveOption}"
+                              Command="{Binding RemoveOptionCommand}" CommandParameter="{Binding ElementName=optionList,Path=SelectedItem}"  
+                                >
                                 <Path Data="M6 1.75H10V0.25H6V1.75ZM1 4.25H2.25V15C2.25 15.4142 2.58579 15.75 3 15.75H13C13.4142 15.75 13.75 15.4142 13.75 15V4.25H15V2.75H1V4.25ZM3.75 14.25V4.25H12.25V14.25H3.75ZM7.25 6.5V11.5H8.75V6.5H7.25Z" />
                             </Button>
                             <Button
                             Width="32"
                             Height="32"
                             Margin="8,0"
-                            Style="{StaticResource btn.sec-icon}">
+                            Style="{StaticResource btn.sec-icon}"  IsEnabled="{Binding IsDownOption}"
+                             Command="{Binding DownItemOptionCommand}" CommandParameter="{Binding ElementName=optionList,Path=SelectedItem}"    
+                                >
                                 <Path Data="M8.72505 12.4147L8.72505 1.02539L7.22505 1.02539L7.22505 12.4147L4.9054 10.0951L3.84474 11.1557L7.44471 14.7557C7.7376 15.0486 8.21248 15.0486 8.50537 14.7557L12.1053 11.1557L11.0447 10.0951L8.72505 12.4147Z" />
                             </Button>
                             <Button
                             Width="32"
                             Height="32"
-                            Style="{StaticResource btn.sec-icon}">
+                            Style="{StaticResource btn.sec-icon}"  IsEnabled="{Binding IsUpOption}"
+                             Command="{Binding UpItemOptionCommand}" CommandParameter="{Binding ElementName=optionList,Path=SelectedItem}"    
+                                >
                                 <Path Data="M8.77509 3.58605L11.0947 5.9057L12.1554 4.84504L8.55542 1.24506C8.26253 0.952167 7.78765 0.952167 7.49476 1.24506L3.89478 4.84504L4.95544 5.9057L7.27509 3.58605L7.27509 14.9754L8.77509 14.9754L8.77509 3.58605Z" />
                             </Button>
                         </StackPanel>

+ 35 - 6
PDF Office/Views/Form/ListBoxProperty.xaml

@@ -53,6 +53,11 @@
                     IsEnabled="True" />
 
             </ContextMenu>
+            <DataTemplate x:Key="numberData">
+                <Grid>
+                    <TextBlock Text="{Binding Content}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
+                </Grid>
+            </DataTemplate>
         </ResourceDictionary>
     </UserControl.Resources>
     <Grid ScrollViewer.VerticalScrollBarVisibility="Auto">
@@ -356,14 +361,20 @@
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Projects" />
                         <Grid>
-                            <cus:TextBoxEx
+                            <cus:TextBoxEx x:Name="TbOptionKey"
                             Width="188"
                             Height="32"
                             HorizontalAlignment="Left"
-                            CornerRadius="4" />
-                            <Button
+                            CornerRadius="4" Text="{Binding OptionKey,Mode=TwoWay}">
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="TextChanged">
+                                        <i:InvokeCommandAction Command="{Binding OptionKeyTextChangedCommand}" CommandParameter="{Binding ElementName=TbOptionKey,Path=Text}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </cus:TextBoxEx>
+                            <Button 
                             Width="32"
-                            HorizontalAlignment="Right"
+                            HorizontalAlignment="Right"  Command="{Binding AddOptionCommand}" IsEnabled="{Binding IsInputOption}"
                             Style="{StaticResource btn.sec-icon}">
                                 <Path Data="M7.25 8.75V14H8.75V8.75H14V7.25H8.75V2H7.25V7.25H2V8.75H7.25Z" />
                             </Button>
@@ -372,12 +383,26 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Exported Values" />
-                        <cus:TextBoxEx Height="32" CornerRadius="4" />
-                        <ListBox Height="98" Margin="0,8" />
+                        <cus:TextBoxEx x:Name="TbOptionKeyValue" Height="32" CornerRadius="4" Text="{Binding OptionKeyValue,Mode=TwoWay}">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="TextChanged">
+                                    <i:InvokeCommandAction Command="{Binding OptionKeyValueTextChangedCommand}" CommandParameter="{Binding ElementName=TbOptionKeyValue,Path=Text}"/>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </cus:TextBoxEx>
+                        <ListBox x:Name="optionList" Height="98" Margin="0,8" ItemsSource="{Binding OptionItems}" ItemTemplate="{StaticResource numberData}">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="SelectionChanged">
+                                    <i:InvokeCommandAction Command="{Binding OptionSelectionChangedCommand}" CommandParameter="{Binding ElementName=optionList,Path=SelectedIndex}"/>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </ListBox>
                         <StackPanel Margin="0,0,0,8" Orientation="Horizontal">
                             <Button
                             Width="32"
                             Height="32"
+                                IsEnabled="{Binding IsRemoveOption}"
+                              Command="{Binding RemoveOptionCommand}" CommandParameter="{Binding ElementName=optionList,Path=SelectedItem}" 
                             Style="{StaticResource btn.sec-icon}">
                                 <Path Data="M6 1.75H10V0.25H6V1.75ZM1 4.25H2.25V15C2.25 15.4142 2.58579 15.75 3 15.75H13C13.4142 15.75 13.75 15.4142 13.75 15V4.25H15V2.75H1V4.25ZM3.75 14.25V4.25H12.25V14.25H3.75ZM7.25 6.5V11.5H8.75V6.5H7.25Z" />
                             </Button>
@@ -385,12 +410,16 @@
                             Width="32"
                             Height="32"
                             Margin="8,0"
+                                IsEnabled="{Binding IsDownOption}"
+                             Command="{Binding DownItemOptionCommand}" CommandParameter="{Binding ElementName=optionList,Path=SelectedItem}"    
                             Style="{StaticResource btn.sec-icon}">
                                 <Path Data="M8.72505 12.4147L8.72505 1.02539L7.22505 1.02539L7.22505 12.4147L4.9054 10.0951L3.84474 11.1557L7.44471 14.7557C7.7376 15.0486 8.21248 15.0486 8.50537 14.7557L12.1053 11.1557L11.0447 10.0951L8.72505 12.4147Z" />
                             </Button>
                             <Button
                             Width="32"
                             Height="32"
+                            IsEnabled="{Binding IsUpOption}"
+                             Command="{Binding UpItemOptionCommand}" CommandParameter="{Binding ElementName=optionList,Path=SelectedItem}"
                             Style="{StaticResource btn.sec-icon}">
                                 <Path Data="M8.77509 3.58605L11.0947 5.9057L12.1554 4.84504L8.55542 1.24506C8.26253 0.952167 7.78765 0.952167 7.49476 1.24506L3.89478 4.84504L4.95544 5.9057L7.27509 3.58605L7.27509 14.9754L8.77509 14.9754L8.77509 3.58605Z" />
                             </Button>

+ 1 - 1
PDF Office/Views/Form/TextFieldProperty.xaml

@@ -109,7 +109,7 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Form Field" />
-                    <form:FormFieldCombox x:Name="formCombox" Type="{Binding FormField,Mode=TwoWay}" Height="32" Margin="0,8,0,16" />
+                    <form:FormFieldCombox x:Name="formCombox" Type="{Binding FormField,Mode=TwoWay}"  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>