Browse Source

Merge branch 'dev' of http://git.kdan.cc:8865/Windows/PDFOffice_Windows_exe into dev

zhuyi 2 years ago
parent
commit
3f3b329bf9

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

@@ -256,7 +256,7 @@ namespace PDF_Office
             containerRegistry.RegisterDialog<ConverterProgressBarDialog>(DialogNames.ConverterProgressBarDialog);
             containerRegistry.RegisterDialog<ScreenAnnotationDialog>(DialogNames.ScreenAnnotationDialog);
             containerRegistry.RegisterDialog<AddBookmarkDialog>(DialogNames.AddBookmarkDialog);
-
+            containerRegistry.RegisterDialog<EditPresetColorsDialog>(DialogNames.EditPresetColorsDialog);
             #endregion 注册弹窗
         }
 

+ 9 - 4
PDF Office/CustomControl/CompositeControl/SlidComboControl.xaml.cs

@@ -1,4 +1,5 @@
-using System;
+using Prism.Commands;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -15,6 +16,7 @@ using System.Windows.Shapes;
 
 namespace PDF_Office.CustomControl.CompositeControl
 {
+   
     public class ComboNumberItem
     {
         public double Value { get; set; }
@@ -31,10 +33,12 @@ namespace PDF_Office.CustomControl.CompositeControl
     public partial class SlidComboControl : UserControl
     {
         public List<ComboNumberItem> Items { get;private set; }    
-        public event EventHandler<double> ValueChanged;
+        public event RoutedEventHandler ValueChanged;
+        
         public SlidComboControl()
         {
             InitializeComponent();
+           
             Items = new List<ComboNumberItem>();
             DefaultItems();
         }
@@ -100,6 +104,7 @@ namespace PDF_Office.CustomControl.CompositeControl
             {
                 Value = item.Value;
                 ThicknessText.Text = item.Content;
+                ValueChanged?.Invoke(Value, e);
             }
            
 
@@ -112,14 +117,14 @@ namespace PDF_Office.CustomControl.CompositeControl
         }
         public static readonly DependencyProperty ValueProperty =
            DependencyProperty.Register("Value", typeof(double), typeof(SlidComboControl), new PropertyMetadata(1.0, SelectedValuePropertyChanged));
-
+       
         private static void SelectedValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
         {
             var control = d as SlidComboControl;
             var value = (double)e.NewValue;
             if (control != null)
             {
-                control.ValueChanged?.Invoke(control, value);
+                control.ValueChanged?.Invoke(value, null);
             }
         }
     }

+ 1 - 0
PDF Office/PDF Office.csproj

@@ -392,6 +392,7 @@
     <Compile Include="ViewModels\Form\ButtonPropertyViewModel.cs" />
     <Compile Include="ViewModels\Form\CheckBoxPropertyViewModel.cs" />
     <Compile Include="ViewModels\Form\ComboxPropertyViewModel.cs" />
+    <Compile Include="ViewModels\Form\EditPresetColorsDialogViewModel.cs" />
     <Compile Include="ViewModels\Form\FormBaseVM.cs" />
     <Compile Include="ViewModels\Form\FormsToolContentViewModel.cs" />
     <Compile Include="ViewModels\Form\ListBoxPropertyViewModel.cs" />

+ 82 - 0
PDF Office/ViewModels/Form/EditPresetColorsDialogViewModel.cs

@@ -0,0 +1,82 @@
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+
+namespace PDF_Office.ViewModels.Form
+{
+    public class EditPresetColorsDialogViewModel : BindableBase, IDialogAware
+    {
+        private SolidColorBrush _borderColor;
+        public SolidColorBrush BorderColor
+        {
+            get { return _borderColor; }
+            set { SetProperty(ref _borderColor, value); }
+        }
+
+        private SolidColorBrush _fontColor;
+        public SolidColorBrush FontColor
+        {
+            get { return _fontColor; }
+            set { SetProperty(ref _fontColor, value); }
+        }
+
+
+        private SolidColorBrush _fillColor;
+        public SolidColorBrush FillColor
+        {
+            get { return _fillColor; }
+            set { SetProperty(ref _fillColor, value); }
+        }
+        public EditPresetColorsDialogViewModel()
+        {
+            BorderColor = new SolidColorBrush(Colors.Transparent);
+            FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00));
+            FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00));
+        }
+
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+
+        #region Navegation
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+            return;
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            return;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+           
+        }
+
+        #endregion
+
+    }
+}

+ 25 - 0
PDF Office/ViewModels/Form/FormBaseVM.cs

@@ -124,4 +124,29 @@ namespace PDF_Office.ViewModels.Form
 
         #endregion
     }
+
+    public class ResetColor: BindableBase
+    {
+        private SolidColorBrush _borderColor;
+        public SolidColorBrush BorderColor
+        {
+            get { return _borderColor; }
+            set { SetProperty(ref _borderColor, value); }
+        }
+
+        private SolidColorBrush _fontColor;
+        public SolidColorBrush FontColor
+        {
+            get { return _fontColor; }
+            set { SetProperty(ref _fontColor, value); }
+        }
+
+
+        private SolidColorBrush _fillColor;
+        public SolidColorBrush FillColor
+        {
+            get { return _fillColor; }
+            set { SetProperty(ref _fillColor, value); }
+        }
+    }
 }

+ 309 - 6
PDF Office/ViewModels/Form/TextFieldPropertyViewModel.cs

@@ -14,6 +14,8 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
 using System.Windows.Media;
 
 namespace PDF_Office.ViewModels.Form
@@ -46,7 +48,7 @@ namespace PDF_Office.ViewModels.Form
         public bool IsMultiLine
         {
             get { return _isMultiline; }
-            set { SetProperty(ref _isMultiline, value); }
+            set { SetProperty(ref _isMultiline, value); ChangeFieldValue("IsMultiLine"); }
         }
 
         //滚动显示长文本
@@ -54,11 +56,75 @@ namespace PDF_Office.ViewModels.Form
         public bool IsScrollText
         {
             get { return _isScrollText; }
-            set { SetProperty(ref _isScrollText, value); }
+            set { SetProperty(ref _isScrollText, value); ChangeFieldValue("IsScrollText"); }
         }
 
+        private ResetColor _resetColorOne = new ResetColor();
+        public ResetColor ResetColorOne
+        {
+            get { return _resetColorOne; }
+            set { SetProperty(ref _resetColorOne, value); }
+        }
+
+        private ResetColor _resetColorTwo = new ResetColor();
+        public ResetColor ResetColorTwo
+        {
+            get { return _resetColorTwo; }
+            set { SetProperty(ref _resetColorTwo, value); }
+        }
+
+        private ResetColor _resetColorThree = new ResetColor();
+        public ResetColor ResetColorThree
+        {
+            get { return _resetColorThree; }
+            set { SetProperty(ref _resetColorThree, value); }
+        }
+
+        private ResetColor _resetColorForth = new ResetColor();
+        public ResetColor ResetColorForth
+        {
+            get { return _resetColorForth; }
+            set { SetProperty(ref _resetColorForth, value); }
+        }
+
+
         #endregion
 
+        private FontFamily _fontFamily;
+        public FontFamily FontFamilyItem
+        {
+            get { return _fontFamily; }
+            set { SetProperty(ref _fontFamily, value); ChangeFieldValue("FontFamilyItem"); }
+        }
+
+        private FontStyle _fontStyle;
+        public FontStyle FontStyleItem
+        {
+            get { return _fontStyle; }
+            set { SetProperty(ref _fontStyle, value); ChangeFieldValue("FontStyleItem"); }
+        }
+
+        private FontWeight _fontWeight;
+        public FontWeight FontWeightItem
+        {
+            get { return _fontWeight; }
+            set { SetProperty(ref _fontWeight, value); ChangeFieldValue("FontWeightItem"); }
+        }
+
+        private C_TEXT_ALIGNMENT _textAlignment;
+        public C_TEXT_ALIGNMENT TextAlignmentItem
+        {
+            get { return _textAlignment; }
+            set { SetProperty(ref _textAlignment, value); ChangeFieldValue("TextAlignmentItem"); }
+        }
+
+        private string _content;
+        public string FormContent
+        {
+            get { return _content; }
+            set { SetProperty(ref _content, value); ChangeFieldValue("FormContent"); }
+        }
+
         #endregion
 
         #region Command变量
@@ -70,8 +136,17 @@ namespace PDF_Office.ViewModels.Form
 
         //外观
         public DelegateCommand<object> ThicknessChangedCommand { get; set; }
-        
 
+        public DelegateCommand<object> ResetColorCommand { get; set; }
+        public DelegateCommand<object> ResetColorCheckedBtnCommand { get; set; }
+        public DelegateCommand<object> FontFamilyChangedCommand { get; set; }
+        public DelegateCommand<object> FontStyleChangedCommand { get; set; }
+
+        public DelegateCommand<object> AlignmentChangedCommand { get; set; }
+        public DelegateCommand<string> FormContentTextChangedCommand { get; set; }
+
+        public DelegateCommand<object> IsMultiLineCheckedCommand { get; set; }
+        public DelegateCommand<object> IsScrollToDisplayCheckedCommand { get; set; }
         #endregion
 
         #region 变量
@@ -80,6 +155,7 @@ namespace PDF_Office.ViewModels.Form
         private WidgetTextBoxArgs textBoxArgs;
         private bool IsCurrentWidget = false;
         private IDialogService dialogs;
+
         #endregion
 
         #region 初始化
@@ -92,7 +168,32 @@ namespace PDF_Office.ViewModels.Form
 
         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))
+            };
+
+            ResetColorTwo = new ResetColor()
+            {
+                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))
+            };
 
+            ResetColorThree = new ResetColor()
+            {
+                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))
+            };
+
+            ResetColorForth = new ResetColor()
+            {
+                BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
+                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
+                FillColor = new SolidColorBrush(Colors.Transparent)
+            };
         }
 
         private void InitCommand()
@@ -103,16 +204,190 @@ namespace PDF_Office.ViewModels.Form
             RequiredFieldCheckedCommand = new DelegateCommand<object>(RequiredFieldChecked);
             //外观
             ThicknessChangedCommand = new DelegateCommand<object>(ThicknessChanged);
+            ResetColorCommand = new DelegateCommand<object>(ResetColorEvent);
 
+            ResetColorCheckedBtnCommand = new DelegateCommand<object>(ResetColorCheckedBtn);
+            FontFamilyChangedCommand = new DelegateCommand<object>(FontFamilyChanged);
+            FontStyleChangedCommand = new DelegateCommand<object>(FontStyleChanged);
+            AlignmentChangedCommand = new DelegateCommand<object>(AlignmentChanged);
+            FormContentTextChangedCommand = new DelegateCommand<string>(FormContentTextChanged);
+
+            IsMultiLineCheckedCommand = new DelegateCommand<object>(IsMultiLineChecked);
+            IsScrollToDisplayCheckedCommand = new DelegateCommand<object>(IsScrollToDisplayChecked);
             ChangeValueHandler -= ChangeValue;
             ChangeValueHandler += ChangeValue;
         }
 
+        private void IsScrollToDisplayChecked(object obj)
+        {
+           if(obj != null)
+            {
+                IsScrollText = (bool)obj;
+            }
+        }
+
+        private void IsMultiLineChecked(object obj)
+        {
+            if (obj != null)
+            {
+                IsMultiLine = (bool)obj;
+            }
+        }
+
+        private void FormContentTextChanged(string obj)
+        {
+            if(obj != null)
+            {
+                FormContent = obj;
+            }
+        }
+
+        private void AlignmentChanged(object obj)
+        {
+            if (obj != null)
+            {
+                var combo = (ComboBoxItem)obj;
+                if (combo != null)
+                {
+                    switch (combo.Content)
+                    {
+                        case "Left":
+                            TextAlignmentItem = C_TEXT_ALIGNMENT.ALIGNMENT_LEFT;
+                            break;
+
+                        case "Center":
+                            TextAlignmentItem = C_TEXT_ALIGNMENT.ALIGNMENT_CENTER;
+                            break;
+
+                        case "Right":
+                            TextAlignmentItem = C_TEXT_ALIGNMENT.ALIGNMENT_RIGHT;
+                            break;
+
+                    }
+                }
+            }
+        }
+
+        private void FontStyleChanged(object obj)
+        {
+           if(obj != null)
+            {
+                var combo = (ComboBoxItem)obj;
+                if(combo != null)
+                {
+                    switch(combo.Content)
+                    {
+                        case "Regular":
+                            FontStyleItem = FontStyles.Normal;
+                            FontWeightItem = FontWeights.Normal;
+                            break;
+
+                        case "Bold":
+                            FontStyleItem = FontStyles.Normal;
+                            FontWeightItem = FontWeights.Bold;
+                            break;
+
+                        case "Italic":
+                            FontStyleItem = FontStyles.Italic;
+                            FontWeightItem = FontWeights.Normal;
+                            break;
+
+                        case "Bold Italic":
+                            FontStyleItem = FontStyles.Italic;
+                            FontWeightItem = FontWeights.Bold;
+                            break;
+                    }
+                }
+            }
+        }
+
+        private void FontFamilyChanged(object obj)
+        {
+           if(obj!= null)
+            {
+                switch((int)obj)
+                {
+                    case 0:
+                        FontFamilyItem = new FontFamily("Courier");
+                        break;
+                    case 1:
+                        FontFamilyItem = new FontFamily("Helvetica");
+                        break;
+                    case 2:
+                        FontFamilyItem = new FontFamily("Times Roman");
+                        break;
+                }
+            }
+        }
+
+        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;
+                            
+                            break;
+
+                        case "Two":
+                            BorderColor = ResetColorTwo.BorderColor.Color;
+                            ContentColor = ResetColorTwo.FontColor.Color;
+                            break;
+
+                        case "Three":
+                            BorderColor = ResetColorThree.BorderColor.Color;
+                            ContentColor = ResetColorThree.FontColor.Color;
+                            break;
+
+                        case "Forth":
+                            BorderColor = ResetColorForth.BorderColor.Color;
+                            ContentColor = ResetColorForth.FontColor.Color;
+                            break;
+                    }
+                }
+            }
+        }
+
+        private void ResetColorEvent(object obj)
+        {
+            //if(obj != null && (ResetColor)obj != null)
+            // {
+            //     var resetcolor = obj as ResetColor;
+
+            // }
+
+            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)
+                {
+                   // CreateSignature(DialogVM);
+                }
+            });
+            if (!result)
+            {
+                return;
+            }
+        }
+
         private void ThicknessChanged(object obj)
         {
             if(obj != null)
             {
-                var str = (double)obj;
+                BorderThiness = (double)obj;
             }
         }
 
@@ -253,8 +528,8 @@ namespace PDF_Office.ViewModels.Form
                     break;
 
                 case FormAttributeType.HeightSize:
-                   // textBoxArgs.DefaultWidth = HeightSize;
-                    //AttribEvent?.UpdateAttrib(, BorderThiness);
+                    textBoxArgs.DefaultWidth = HeightSize;
+                 //   AttribEvent?.UpdateAttrib(AnnotAttrib.h, HeightSize);
                     break;
 
                 case FormAttributeType.BorderThiness:
@@ -300,6 +575,34 @@ namespace PDF_Office.ViewModels.Form
                     textBoxArgs.FormField = FormField.Visible;
                     AttribEvent?.UpdateAttrib(AnnotAttrib.FormField,FormPos);
                     break;
+                case "FontFamilyItem":
+                    textBoxArgs.FontFamily = FontFamilyItem.Source;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.FontFamily, FontFamilyItem.Source);
+                    break;
+                case "FontStyleItem":
+                    textBoxArgs.FontStyle = FontStyleItem;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.FontStyle, FontStyleItem);
+                    break;
+                case "FontWeightItem":
+                    textBoxArgs.FontWeight = FontWeightItem;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.FontWeight, FontWeightItem);
+                    break;
+                case "TextAlignmentItem":
+                    textBoxArgs.Alignment = TextAlignmentItem;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.TextAlign, TextAlignmentItem);
+                    break;
+                case "FormContent":
+                    textBoxArgs.Content = FormContent;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.Text, FormContent);
+                    break;
+                case "IsScrollText":
+                    textBoxArgs.ScrollFlag = IsScrollText;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.ScrollFlag, IsScrollText);
+                    break;
+                case "IsMultiLine":
+                    textBoxArgs.IsMultiLine = IsMultiLine;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.IsMutilLine, IsMultiLine);
+                    break;
             }
             AttribEvent?.UpdateAnnot();
         }

+ 7 - 6
PDF Office/Views/Form/EditPresetColorsDialog.xaml

@@ -6,6 +6,8 @@
              xmlns:local="clr-namespace:PDF_Office.Views.Form"
              xmlns:cus="clr-namespace:PDF_Office.CustomControl"
              xmlns:cusColor="clr-namespace:PDF_Office.CustomControl.CompositeControl"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <cus:DialogContent Header="Edit Preset Colors" Width="468" Height="258">
@@ -17,8 +19,9 @@
                 </Grid.ColumnDefinitions>
 
                 <Border Width="162" Height="144" BorderThickness="1" CornerRadius="8" Background="#F7F8FA">
-                    <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
-                        <TextBlock Text="Text"/>
+                    <Grid Width="78" Height="18">
+                        <Rectangle x:Name="rect" Fill="{Binding FillColor}" Stroke="{Binding BorderColor}" StrokeThickness="1" VerticalAlignment="Stretch"/>
+                        <TextBlock x:Name="text" Text="Text" FontSize="14" LineHeight="22" FontFamily="Segoe UI" Foreground="{Binding FontColor,Mode=OneWay}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                     </Grid>
                 </Border>
 
@@ -50,11 +53,9 @@
                     
                     <TextBlock Text="Text Color:" Grid.Row="3" VerticalAlignment="Center"/>
                     <StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="1">
-                        <RadioButton Style="{StaticResource RectangleRadionButtonWithCorner}">
-                            <cusColor:ColorSubContent x:Name="TextColorBox" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left"
+                        <cusColor:ColorSubContent x:Name="TextColorBox" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left"
                                    ></cusColor:ColorSubContent>
-                        </RadioButton>
-                       
+
                     </StackPanel>
                 </Grid>
             </Grid>

+ 43 - 1
PDF Office/Views/Form/EditPresetColorsDialog.xaml.cs

@@ -1,4 +1,5 @@
-using System;
+using PDF_Office.ViewModels.Form;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -20,9 +21,50 @@ namespace PDF_Office.Views.Form
     /// </summary>
     public partial class EditPresetColorsDialog : UserControl
     {
+        public EditPresetColorsDialogViewModel ViewModel =>DataContext as EditPresetColorsDialogViewModel;
         public EditPresetColorsDialog()
         {
             InitializeComponent();
+            this.Loaded += userControl_Loaded;
+        }
+
+        private void userControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            if (ViewModel != null)
+            {
+                BorderColorBox.SelectedColorHandler -= BorderColorBox_SelectedColorHandler;
+                BorderColorBox.SelectedColorHandler += BorderColorBox_SelectedColorHandler;
+
+                BgColorBox.SelectedColorHandler -= BgColorBox_SelectedColorHandler;
+                BgColorBox.SelectedColorHandler += BgColorBox_SelectedColorHandler;
+
+                TextColorBox.SelectedColorHandler -= TextColorBox_SelectedColorHandler;
+                TextColorBox.SelectedColorHandler += TextColorBox_SelectedColorHandler;
+            }
+        }
+
+        private void TextColorBox_SelectedColorHandler(object sender, Color e)
+        {
+            if (ViewModel != null)
+            {
+                ViewModel.FontColor = new SolidColorBrush(e);
+            }
+        }
+
+        private void BgColorBox_SelectedColorHandler(object sender, Color e)
+        {
+            if (ViewModel != null)
+            {
+                ViewModel.FillColor = new SolidColorBrush(e);
+            }
+        }
+
+        private void BorderColorBox_SelectedColorHandler(object sender, Color e)
+        {
+            if (ViewModel != null)
+            {
+                ViewModel.BorderColor = new SolidColorBrush(e);
+            }
         }
     }
 }

+ 133 - 49
PDF Office/Views/Form/TextFieldProperty.xaml

@@ -42,6 +42,20 @@
                     <TextBlock Text="Text"/>
                 </Grid>
             </DataTemplate>
+            <ContextMenu x:Key="ColorBtnFlyoutMenu" FontSize="14">
+                <ContextMenu.ItemContainerStyle>
+                    <Style TargetType="MenuItem">
+                        <Setter Property="Padding" Value="0,7,0,7" />
+                        <Setter Property="VerticalContentAlignment" Value="Center" />
+                    </Style>
+                </ContextMenu.ItemContainerStyle>
+                <MenuItem
+                    Name="EditMenuItem"
+                    Click="EditMenuItem_Click"
+                    Header="Edit"
+                    IsEnabled="True" />
+              
+            </ContextMenu>
         </ResourceDictionary>
     </UserControl.Resources>
     <Grid ScrollViewer.VerticalScrollBarVisibility="Auto">
@@ -122,36 +136,64 @@
                                     <ColumnDefinition Width="*"/>
                                 </Grid.ColumnDefinitions>
 
-                                <RadioButton  BorderThickness="1" Width="84" Height="24" Grid.Row="0" Grid.Column="0"
-                                          Style="{StaticResource BlueBorderRadionButtonWithCorner}">
-                                    <Grid Width="84" Height="24" Margin="3">
-                                        <Rectangle Fill="BlueViolet" Stroke="Black" StrokeThickness="1" VerticalAlignment="Stretch"/>
-                                        <TextBlock Text="Text" FontSize="14" LineHeight="22" FontFamily="Segoe UI" Foreground="Red" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                                <RadioButton x:Name="OneBtn" BorderThickness="1" Width="84" Height="24" Grid.Row="0" Grid.Column="0" Tag="One"
+                                          Style="{StaticResource BlueBorderRadionButtonWithCorner}" Padding="3"
+                                              ContextMenu="{StaticResource ColorBtnFlyoutMenu}"
+                                              >
+                                    <Grid Width="78" Height="18">
+                                        <Rectangle Fill="{Binding ResetColorOne.FillColor}" Stroke="{Binding ResetColorOne.BorderColor}" StrokeThickness="1" VerticalAlignment="Stretch"/>
+                                        <TextBlock Text="Text" FontSize="14" LineHeight="22" FontFamily="Segoe UI" Foreground="{Binding ResetColorOne.FontColor}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                     </Grid>
+                                    <i:Interaction.Triggers>
+                                        <i:EventTrigger EventName="Checked">
+                                            <i:InvokeCommandAction Command="{Binding ResetColorCheckedBtnCommand}" CommandParameter="{Binding ElementName=OneBtn,Path=Tag}"/>
+                                        </i:EventTrigger>
+                                    </i:Interaction.Triggers>
                                 </RadioButton>
 
-                                <RadioButton BorderThickness="1" Width="84" Height="24" Grid.Row="0" Grid.Column="1"
-                                          Style="{StaticResource BlueBorderRadionButtonWithCorner}">
-                                    <Grid Width="84" Height="24" Margin="3">
-                                        <Rectangle Fill="BlueViolet" Stroke="Black" StrokeThickness="1" VerticalAlignment="Stretch"/>
-                                        <TextBlock Text="Text" FontSize="14" LineHeight="22" FontFamily="Segoe UI" Foreground="Red" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                                <RadioButton x:Name="TwoBtn" BorderThickness="1" Width="84" Height="24" Grid.Row="0" Grid.Column="1" Tag="Two"
+                                          Style="{StaticResource BlueBorderRadionButtonWithCorner}"
+                                          ContextMenu="{StaticResource ColorBtnFlyoutMenu}"  
+                                             >
+                                    <Grid Width="78" Height="18">
+                                        <Rectangle Fill="{Binding ResetColorTwo.FillColor}" Stroke="{Binding ResetColorTwo.BorderColor}" StrokeThickness="1" VerticalAlignment="Stretch"/>
+                                        <TextBlock Text="Text" FontSize="14" LineHeight="22" FontFamily="Segoe UI" Foreground="{Binding ResetColorTwo.FontColor}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                     </Grid>
+                                    <i:Interaction.Triggers>
+                                        <i:EventTrigger EventName="Checked">
+                                            <i:InvokeCommandAction Command="{Binding ResetColorCheckedBtnCommand}" CommandParameter="{Binding ElementName=TwoBtn,Path=Tag}"/>
+                                        </i:EventTrigger>
+                                    </i:Interaction.Triggers>
                                 </RadioButton>
 
-                                <RadioButton  BorderThickness="1" Width="84" Height="24" Grid.Row="1" Grid.Column="0"
-                                          Style="{StaticResource BlueBorderRadionButtonWithCorner}">
-                                    <Grid Width="84" Height="24" Margin="3">
-                                        <Rectangle Fill="BlueViolet" Stroke="Black" StrokeThickness="1" VerticalAlignment="Stretch"/>
-                                        <TextBlock Text="Text" FontSize="14" LineHeight="22" FontFamily="Segoe UI" Foreground="Red" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                                <RadioButton x:Name="ThreeBtn" BorderThickness="1" Width="84" Height="24" Grid.Row="1" Grid.Column="0" Tag="Three"
+                                          Style="{StaticResource BlueBorderRadionButtonWithCorner}"
+                                           ContextMenu="{StaticResource ColorBtnFlyoutMenu}"    
+                                              >
+                                    <Grid Width="78" Height="18">
+                                        <Rectangle Fill="{Binding ResetColorThree.FillColor}" Stroke="{Binding ResetColorThree.BorderColor}" StrokeThickness="1" VerticalAlignment="Stretch"/>
+                                        <TextBlock Text="Text" FontSize="14" LineHeight="22" FontFamily="Segoe UI" Foreground="{Binding ResetColorThree.FontColor}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                     </Grid>
+                                    <i:Interaction.Triggers>
+                                        <i:EventTrigger EventName="Checked">
+                                            <i:InvokeCommandAction Command="{Binding ResetColorCheckedBtnCommand}" CommandParameter="{Binding ElementName=ThreeBtn,Path=Tag}"/>
+                                        </i:EventTrigger>
+                                    </i:Interaction.Triggers>
                                 </RadioButton>
 
-                                <RadioButton  BorderThickness="1" Width="84" Height="24" Grid.Row="1" Grid.Column="1"
-                                          Style="{StaticResource BlueBorderRadionButtonWithCorner}">
-                                    <Grid Width="84" Height="24" Margin="3">
-                                        <Rectangle Fill="BlueViolet" Stroke="Black" StrokeThickness="1" VerticalAlignment="Stretch"/>
-                                        <TextBlock Text="Text" FontSize="14" LineHeight="22" FontFamily="Segoe UI" Foreground="Red" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                                <RadioButton x:Name="ForthBtn" BorderThickness="1" Width="84" Height="24" Grid.Row="1" Grid.Column="1" Tag="Forth"
+                                          Style="{StaticResource BlueBorderRadionButtonWithCorner}"
+                                           ContextMenu="{StaticResource ColorBtnFlyoutMenu}"    
+                                              >
+                                    <Grid Width="78" Height="18">
+                                        <Rectangle Fill="{Binding ResetColorForth.FillColor}" Stroke="{Binding ResetColorForth.BorderColor}" StrokeThickness="1" VerticalAlignment="Stretch"/>
+                                        <TextBlock Text="Text" FontSize="14" LineHeight="22" FontFamily="Segoe UI" Foreground="{Binding ResetColorForth.FontColor}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                     </Grid>
+                                    <i:Interaction.Triggers>
+                                        <i:EventTrigger EventName="Checked">
+                                            <i:InvokeCommandAction Command="{Binding ResetColorCheckedBtnCommand}" CommandParameter="{Binding ElementName=ForthBtn,Path=Tag}"/>
+                                        </i:EventTrigger>
+                                    </i:Interaction.Triggers>
                                 </RadioButton>
                                 
                             </Grid>
@@ -196,8 +238,7 @@
 
                                 <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 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"/>
@@ -320,57 +361,100 @@
                 <TabItem.Header>
                     <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>
-                <StackPanel IsEnabled="{Binding ElementName=ChkLock, Path=IsChecked, Converter={StaticResource InvertBoolConvert}}">
-                    <TextBlock
+                <Grid>
+                    <StackPanel IsEnabled="{Binding ElementName=ChkLock, Path=IsChecked, Converter={StaticResource InvertBoolConvert}}">
+                        <TextBlock Text="Alignment"/>
+                        <ComboBox Name="AlignmentBox" 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}">Left</ComboBoxItem>
+                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Center</ComboBoxItem>
+                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Right</ComboBoxItem>
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="SelectionChanged">
+                                    <i:InvokeCommandAction Command="{Binding AlignmentChangedCommand}" CommandParameter="{Binding ElementName=AlignmentBox,Path=SelectedItem}"/>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </ComboBox>
+
+                        <TextBlock Text="Default Value"/>
+                        <cus:TextBoxEx x:Name="DefaultValueBox" Height="150" CornerRadius="4" Text="{Binding FormContent,Mode=TwoWay}" >
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="TextChanged">
+                                    <i:InvokeCommandAction Command="{Binding FormContentTextChangedCommand}" CommandParameter="{Binding ElementName=DefaultValueBox,Path=Text}"/>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </cus:TextBoxEx>
+
+                        <CheckBox x:Name="MultiLineCheck" Content="Nulti-line"  Command="{Binding IsMultiLineCheckedCommand}" CommandParameter="{Binding ElementName=MultiLineCheck,Path=IsChecked}"/>
+                        <CheckBox x:Name="ScrollToDisplayLongCheck" Content="Scroll to display long text"  Command="{Binding IsScrollToDisplayCheckedCommand}" CommandParameter="{Binding ElementName=ScrollToDisplayLongCheck,Path=IsChecked}"/>
+                    </StackPanel>
+                    
+                    
+                    
+
+                    <StackPanel Visibility="Collapsed" IsEnabled="{Binding ElementName=ChkLock, Path=IsChecked, Converter={StaticResource InvertBoolConvert}}">
+                        <TextBlock
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Projects" />
-                    <Grid>
-                        <cus:TextBoxEx
+                        <Grid>
+                            <cus:TextBoxEx
                             Width="188"
                             Height="32"
                             HorizontalAlignment="Left"
                             CornerRadius="4" />
-                        <Button
+                            <Button
                             Width="32"
                             HorizontalAlignment="Right"
                             Style="{StaticResource btn.sec-icon}">
-                            <Path Data="M7.25 8.75V14H8.75V8.75H14V7.25H8.75V2H7.25V7.25H2V8.75H7.25Z" />
-                        </Button>
-                    </Grid>
-                    <TextBlock
+                                <Path Data="M7.25 8.75V14H8.75V8.75H14V7.25H8.75V2H7.25V7.25H2V8.75H7.25Z" />
+                            </Button>
+                        </Grid>
+                        <TextBlock
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Exported Values" />
-                    <cus:TextBoxEx Height="32" CornerRadius="4" />
-                    <ListBox Height="98" Margin="0,8" />
-                    <StackPanel Margin="0,0,0,8" Orientation="Horizontal">
-                        <Button
+                        <cus:TextBoxEx Height="32" CornerRadius="4" />
+                        <ListBox Height="98" Margin="0,8" />
+                        <StackPanel Margin="0,0,0,8" Orientation="Horizontal">
+                            <Button
                             Width="32"
                             Height="32"
                             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>
-                        <Button
+                                <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}">
-                            <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
+                                <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}">
-                            <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>
+                                <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>
+                        <CheckBox Margin="0,8,0,4" Content="Sort Items" />
+                        <CheckBox Margin="0,4" Content="Allow users to enter custom text" />
+                        <CheckBox Margin="0,4">
+                            <TextBlock Text="Submit the selected value immediately" TextWrapping="Wrap" />
+                        </CheckBox>
                     </StackPanel>
-                    <CheckBox Margin="0,8,0,4" Content="Sort Items" />
-                    <CheckBox Margin="0,4" Content="Allow users to enter custom text" />
-                    <CheckBox Margin="0,4">
-                        <TextBlock Text="Submit the selected value immediately" TextWrapping="Wrap" />
-                    </CheckBox>
-                </StackPanel>
+                </Grid>
+
+               
+
+
+
+               
             </TabItem>
 
         </TabControl>

+ 13 - 2
PDF Office/Views/Form/TextFieldProperty.xaml.cs

@@ -1,4 +1,5 @@
-using System;
+using PDF_Office.ViewModels.Form;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -20,12 +21,22 @@ namespace PDF_Office.Views.Form
     /// </summary>
     public partial class TextFieldProperty : UserControl
     {
-       
+       public TextFieldPropertyViewModel ViewModel =>DataContext as TextFieldPropertyViewModel;
         public TextFieldProperty()
         {
             InitializeComponent();
 
            
         }
+
+        private void EditMenuItem_Click(object sender, RoutedEventArgs e)
+        {
+            var Btnitem = sender as MenuItem;
+            if (Btnitem == null) return;
+            if(ViewModel != null)
+            {
+                ViewModel.ResetColorCommand?.Execute(Btnitem);
+            }
+        }
     }
 }