Browse Source

编辑PDF - 数据绑定

chenrongqian@kdanmobile.com 2 years ago
parent
commit
a99a6d265b

+ 55 - 15
PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

@@ -10,7 +10,9 @@ namespace PDF_Office.Model.PropertyPanel.AnnotPanel
 {
     public class FontStyleItem
     {
-        public string mFontStyleName { get; set; }
+        public string mTag { get; set; }
+
+        public string mTagContent { get; set; }
         public int mFontSize { get; set; }
         public FontFamily mFontFamily { get; set; }
         public FontStyle mFontStyle { get; set; }
@@ -20,36 +22,74 @@ namespace PDF_Office.Model.PropertyPanel.AnnotPanel
 
     public class LoadFontStyle
     {
+
         public static List<FontStyleItem> Load()
         {
             List<FontStyleItem> fontStyleList = new List<FontStyleItem>();
             FontStyleItem custom = new FontStyleItem();
-            custom.mFontSize = 32;
-            custom.mFontStyleName = "自定义";
+            custom.mTag = "custom";
+            custom.mTagContent = "自定义";
+
+            custom.mFontSize = 24;
+            custom.mFontFamily = new FontFamily("Helvatica");
+            custom.mFontStyle = FontStyles.Normal;
+            custom.mFontWeight = FontWeights.Normal;
 
             FontStyleItem h1 = new FontStyleItem();
-            h1.mFontSize = 24;
-            h1.mFontStyleName = "H1大标题";
+            h1.mTag = "H1";
+            h1.mTagContent = "H1大标题";
+
+            h1.mFontSize = 36;
+            h1.mFontFamily = new FontFamily("Helvatica");
+            h1.mFontStyle = FontStyles.Normal;
+            h1.mFontWeight = FontWeights.Normal;
 
             FontStyleItem h2 = new FontStyleItem();
-            h2.mFontSize = 16;
-            h2.mFontStyleName = "h2(标准)";
+            h2.mTag = "H2";
+            h2.mTagContent = "h2(标准)";
+
+            h2.mFontSize = 1248;
+            h2.mFontFamily = new FontFamily("Helvatica");
+            h2.mFontStyle = FontStyles.Normal;
+            h2.mFontWeight = FontWeights.Bold;
+
 
             FontStyleItem h3 = new FontStyleItem();
-            h3.mFontSize = 10;
-            h3.mFontStyleName = "H3小标题";
+            h3.mTag = "H3";
+            h3.mTagContent = "H3小标题";
+
+            h3.mFontSize = 18;
+            h3.mFontFamily = new FontFamily("Helvatica");
+            h3.mFontStyle = FontStyles.Normal;
+            h3.mFontWeight = FontWeights.Bold;
 
             FontStyleItem b1 = new FontStyleItem();
-            b1.mFontSize = 8;
-            b1.mFontStyleName = "B1标题";
+            b1.mTag = "B1";
+            b1.mTagContent = "B1标题";
+
+            b1.mFontSize = 14;
+            b1.mFontFamily = new FontFamily("Helvatica");
+            b1.mFontStyle = FontStyles.Normal;
+            b1.mFontWeight = FontWeights.Normal;
+
 
             FontStyleItem b2 = new FontStyleItem();
-            b2.mFontSize = 6;
-            b2.mFontStyleName = "B2标题";
+            b2.mTag = "B2";
+            b2.mTagContent = "B2标题";
+
+            b2.mFontSize = 12;
+            b2.mFontFamily = new FontFamily("Helvatica");
+            b2.mFontStyle = FontStyles.Normal;
+            b2.mFontWeight = FontWeights.Normal;
 
             FontStyleItem b3 = new FontStyleItem();
-            b3.mFontSize = 4;
-            b3.mFontStyleName = "B3标题";
+            b3.mTag = "B3";
+            b3.mTagContent = "B3标题";
+
+            b3.mFontSize = 11;
+            b3.mFontFamily = new FontFamily("Helvatica");
+            b3.mFontStyle = FontStyles.Normal;
+            b3.mFontWeight = FontWeights.Normal;
 
             fontStyleList.Add(custom);
             fontStyleList.Add(h1);

+ 28 - 2
PDF Office/ViewModels/PropertyPanel/PDFEdit/ImageEditPropertyViewModel.cs

@@ -18,9 +18,17 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
 {
     public class ImageEditPropertyViewModel : PDFEditVM, INavigationAware
     {
-      
+
 
         #region 图像属性
+        private double _transpent ;
+        public double Transpent { get { return _transpent; } set { SetProperty(ref _transpent, value);
+                if (TextEditEvent != null)
+                {
+                    TextEditEvent.Transparent = (int)_transpent;
+                    TextEditEvent.UpdatePDFEditByEventArgs();
+                }
+            } }
         private bool _isCrop = false;
         public bool IsCrop{get { return _isCrop; } set{SetProperty(ref _isCrop, value); }}
         //选中的图像
@@ -258,13 +266,31 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
                     {
                         GetImagePreView();
                     }
+                    if (TextEditEventList.Count == 2)
+                    {
+                        IsLayoutAlign = true;
+                        IsLayoutAvgAlign = false;
+                    }
+                    else if (TextEditEventList.Count > 2)
+                    {
+                        IsLayoutAlign = true;
+                        IsLayoutAvgAlign = true;
+                    }
+                    else
+                    {
+                        IsLayoutAlign = false;
+                        IsLayoutAvgAlign = false;
+                    }
                     GetPDFEdit();
                 }
             }
+
+          
         }
         private void GetPDFEdit()
         {
-           
+            Transpent = (double)TextEditEvent.Transparent;
+
 
         }
         //点击空白处时

+ 75 - 12
PDF Office/ViewModels/PropertyPanel/PDFEdit/ImageTextEditPropertyViewModel.cs

@@ -1,4 +1,8 @@
-using Prism.Mvvm;
+using ComPDFKitViewer;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Commands;
+using Prism.Mvvm;
 using Prism.Regions;
 using System;
 using System.Collections.Generic;
@@ -10,30 +14,89 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
 {
     public class ImageTextEditPropertyViewModel : PDFEditVM, INavigationAware
     {
+        public DelegateCommand<object> ImgAlignCheckedCommand { get; set; }
         public ImageTextEditPropertyViewModel()
         {
+            ImgAlignCheckedCommand = new DelegateCommand<object>(ImgAlignChecked);
 
-           
         }
 
-        public void OnNavigatedTo(NavigationContext navigationContext)
+        private void ImgAlignChecked(object obj)
         {
+            if (obj != null)
+            {
+                switch ((string)obj)
+                {
+                    case "AlignLeft":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignLeft);
+                        break;
+                    case "AlignHorizonCenter":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignHorizonCenter);
+                        break;
+                    case "AlignRight":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignRight);
+                        break;
+                    case "DistributeHorizontal":
+                        PDFViewer.SetPDFEditAligment(AlignModes.DistributeHorizontal);
+                        break;
+                    case "AlignTop":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignTop);
+                        break;
+                    case "AlignVerticalCenter":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignVerticalCenter);
+                        break;
+                    case "AlignBottom":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignBottom);
+                        break;
+                    case "DistributeVertical":
+                        PDFViewer.SetPDFEditAligment(AlignModes.DistributeVertical);
+                        break;
+                }
 
-            //navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
-            //if (PDFViewer != null)
-            //{
-            //    PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
-            //    PDFViewer.PDFEditActiveHandler += PDFViewer_PDFEditActiveHandler;
+            }
+        }
 
-            //    PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
-            //    PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
+        protected List<ComPDFKitViewer.PDFEditEvent> TextEditEventList;
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<List<PDFEditEvent>>(ParameterNames.AnnotEvent, out TextEditEventList);
+            if (PDFViewer != null)
+            {
+                if (TextEditEventList != null && TextEditEventList.Count > 0)
+                {
+                    TextEditEvent = TextEditEventList[0];
+                
+                    if (TextEditEventList.Count == 2)
+                    {
+                        IsLayoutAlign = true;
+                        IsLayoutAvgAlign = false;
+                    }
+                    else if (TextEditEventList.Count > 2)
+                    {
+                        IsLayoutAlign = true;
+                        IsLayoutAvgAlign = true;
+                    }
+                    else
+                    {
+                        IsLayoutAlign = false;
+                        IsLayoutAvgAlign = false;
+                    }
+                    
+                }
+            }
 
-            //}
         }
 
         public bool IsNavigationTarget(NavigationContext navigationContext) { return true; }
 
+        public event EventHandler ClearCheckedAglin;
+        public void OnNavigatedFrom(NavigationContext navigationContext) 
+        { 
+           
+            ClearCheckedAglin?.Invoke(null, null);
+        }
+
 
-        public void OnNavigatedFrom(NavigationContext navigationContext) { }
     }
 }

+ 176 - 83
PDF Office/ViewModels/PropertyPanel/PDFEdit/TextEditPropertyViewModel.cs

@@ -1,6 +1,7 @@
 using ComPDFKitViewer;
 using ComPDFKitViewer.PdfViewer;
 using Microsoft.Win32;
+using PDF_Office.CustomControl.CompositeControl;
 using PDF_Office.Model;
 using PDF_Office.Model.PropertyPanel.AnnotPanel;
 using Prism.Commands;
@@ -20,7 +21,117 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
 {
     public class TextEditPropertyViewModel : PDFEditVM, INavigationAware
     {
-      
+        private ComboDataItem _fontFamilyData;
+        public ComboDataItem FontFamilyData
+        {
+            get { return _fontFamilyData; }
+            set
+            {
+                SetProperty(ref _fontFamilyData, value);
+                if(_fontFamilyData != null && TextEditEvent != null)
+                {
+                    TextEditEvent.FontFamily = new FontFamily(_fontFamilyData.ValueStr);
+                    TextEditEvent.UpdatePDFEditByEventArgs();
+                }
+            }
+        }
+
+        private ComboDataItem _presetTextData;
+        public ComboDataItem PresetTextData
+        {
+            get { return _presetTextData; }
+            set
+            {
+                SetProperty(ref _presetTextData, value);
+                if(_presetTextData != null && FontStyleList != null)
+                {
+                   var item = FontStyleList.FirstOrDefault(temp => temp.mTag == _presetTextData.ValueStr);
+                    if(item != null && TextEditEvent != null)
+                    {
+                        TextEditEvent.FontFamily = item.mFontFamily;
+                        TextEditEvent.FontSize = item.mFontSize;
+                        TextEditEvent.FontWeight = item.mFontWeight;
+                        TextEditEvent.FontStyle = item.mFontStyle;
+                        TextEditEvent.UpdatePDFEditByEventArgs();
+                    }
+                   
+                }
+            }
+        }
+
+
+        private FontStyle _fontStyle;
+        public FontStyle FontStyleItem
+        {
+            get { return _fontStyle; }
+            set {SetProperty(ref _fontStyle, value);}
+        }
+
+        private FontWeight _fontWeight;
+        public FontWeight FontWeightItem
+        {
+            get { return _fontWeight; }
+            set {  SetProperty(ref _fontWeight, value); }
+        }
+
+        private ComboDataItem _fontWeightStyleItem;
+        public ComboDataItem FontWeightStyleItem
+        {
+            get { return _fontWeightStyleItem; }
+            set
+            {
+                SetProperty(ref _fontWeightStyleItem, value);
+                if (_fontWeightStyleItem.ValueStr != null && string.IsNullOrEmpty((string)_fontWeightStyleItem.ValueStr) == false)
+                {
+                    switch ((string)_fontWeightStyleItem.ValueStr)
+                    {
+                        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;
+                    }
+                    TextEditEvent.FontWeight = FontWeightItem;
+                    TextEditEvent.FontStyle = FontStyleItem;
+                    TextEditEvent.UpdatePDFEditByEventArgs();
+                }
+            }
+        }
+
+        private ComboDataItem _fontSizeData = new ComboDataItem(6);
+        public ComboDataItem FontSizeData
+        {
+            get { return _fontSizeData; }
+            set
+            {
+                SetProperty(ref _fontSizeData, value);
+                if (_fontSizeData != null && TextEditEvent != null)
+                {
+                    TextEditEvent.FontSize = _fontSizeData.Value;
+                    TextEditEvent.UpdatePDFEditByEventArgs();
+                }
+            }
+        }
+
+        public List<ComboDataItem> FontFamilyItems { get; private set; }
+        public List<ComboDataItem> FontStyleItems { get; private set; }
+        public List<ComboDataItem> PresetTextItems { get; private set; }
+
+
         #region 属性
 
         #region 文本属性
@@ -201,11 +312,48 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
         private void InitVariable()
         {
             InitFontStyles();
+            InitFontFamilyComboBox();
+            InitFontStyleComboBox();
+            InitFontStyles();
+        }
+
+        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 InitFontStyles()
         {
+            PresetTextItems = new List<ComboDataItem>();
             FontStyleList = LoadFontStyle.Load();
+
+            foreach(var item in FontStyleList)
+            {
+                ComboDataItem itemData = new ComboDataItem(item.mTag, item.mTagContent);
+                PresetTextItems.Add(itemData);
+            }
+          
+
         }
 
         private void InitCommand()
@@ -279,8 +427,12 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
 
         private void AntiClockwise()
         {
-            Angle = TextEditEvent.Rotate = TextEditEvent.Rotate - 90;
-            TextEditEvent.UpdatePDFEditByEventArgs();
+            if ( TextEditEvent != null)
+            {
+                Angle = TextEditEvent.Rotate = TextEditEvent.Rotate - 90;
+                TextEditEvent.UpdatePDFEditByEventArgs();
+            }
+           
         }
 
 
@@ -439,6 +591,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
 
         private void ReplaceImg()
         {
+            if (TextEditEvent == null) return;
+
             OpenFileDialog openFileDialog = new OpenFileDialog();
             openFileDialog.Filter = "png|*.png;|Image|*.gif;*.jpg;*.jpeg;*.bmp;*.jfif;*.png;";
             openFileDialog.Multiselect = true;
@@ -655,81 +809,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
                 e.Handle = true;
             }
         }
-        ///// <summary>
-        ///// 选中编辑PDF内容的事件
-        ///// </summary>
-        //private void PDFViewer_PDFEditActiveHandler(object sender, List<PDFEditEvent> e)
-        //{
-        //    if (e != null && e.Count > 0)
-        //    {
-
-        //        ReLoadLayoutAlign(e.Count);
-
-        //        IsTextEdit = (e[0].EditType == ComPDFKit.PDFPage.CPDFEditType.EditText);
-        //        TextEditEvent = e[0];
-
-        //        if (IsTextEdit == false)
-        //        {
-        //            var list = PDFViewer.GetSelectedImages();
-        //            if (list != null && list.Count > 0)
-        //            {
-        //                System.Drawing.Bitmap bitmap = null;
-        //                foreach (var item in list)
-        //                {
-        //                    if (item.Value.Count > 0)
-        //                    {
-        //                        bitmap = item.Value[0];
-        //                        break;
-        //                    }
-        //                }
-
-        //                if (bitmap != null)
-        //                {
-        //                    IntPtr ip = bitmap.GetHbitmap();
-        //                    System.Windows.Media.Imaging.BitmapSource bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(ip, IntPtr.Zero, Int32Rect.Empty,
-        //                    System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
-        //                    CurrentImg = bitmapSource;
-        //                }
-
-        //            }
-
-
-        //        }
-
-        //        bool isText = false;
-        //        bool isImg = false;
-
-        //        foreach (var item in e)
-        //        {
-        //            if (item.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
-        //            {
-        //                isText = true;
-        //            }
-
-        //            if (item.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
-        //            {
-        //                isImg = true;
-        //            }
-
-        //        }
-
-        //        if (isImg == true && isText == true)
-        //            IsSelectTextAndImg = true;
-        //        else
-        //            IsSelectTextAndImg = false;
-
-        //    }
-        //    else
-        //    {
-        //        IsLayoutAlign = false;
-        //        IsLayoutAvgAlign = false;
-        //        IsSelectTextAndImg = false;
-        //        IsTextEdit = true;
-
-        //        ClearCheckedAglin?.Invoke(null, null);
-
-        //    }
-        //}
+     
         #region 全局
 
         public event EventHandler ClearCheckedAglin;
@@ -748,10 +828,23 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
                 {
                     TextEditEvent = TextEditEventList[0];
                     GetPDFEdit();
-                }
 
-                //PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
-                //PDFViewer.PDFEditActiveHandler += PDFViewer_PDFEditActiveHandler;
+                    if (TextEditEventList.Count == 2)
+                    {
+                        IsLayoutAlign = true;
+                        IsLayoutAvgAlign = false;
+                    }
+                    else if(TextEditEventList.Count >2)
+                    {
+                        IsLayoutAlign = true;
+                        IsLayoutAvgAlign = true;
+                    }
+                    else
+                    {
+                        IsLayoutAlign = false;
+                        IsLayoutAvgAlign = false;
+                    }
+                }
 
                 PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
                 PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
@@ -764,11 +857,11 @@ namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
             if(TextEditEvent != null)
             {
                 TextFontFamily = TextEditEvent.FontFamily;
-                TextFontSize = (int)TextEditEvent.FontSize;
+                //TextFontSize = (int)TextEditEvent.FontSize;
                 TextFontStyle = TextEditEvent.FontStyle;
                 TextFontWeights = TextEditEvent.FontWeight;
                 SelectColor = new SolidColorBrush(TextEditEvent.FontColor);
-                
+                FontSizeData = new ComboDataItem(TextEditEvent.FontSize);
             }
         }
 

+ 1 - 1
PDF Office/Views/PropertyPanel/PDFEdit/ImageEditProperty.xaml

@@ -81,7 +81,7 @@
                         IsEnabled="{Binding IsCrop, Converter={StaticResource InvertBoolConvert}}" />
             </StackPanel>
 
-            <CompositeControl:SlidComboControl IsEnabled="{Binding IsCrop, Converter={StaticResource InvertBoolConvert}}" />
+            <CompositeControl:SlidComboControl Value="{Binding Transpent,Mode=TwoWay}" IsEnabled="{Binding IsCrop, Converter={StaticResource InvertBoolConvert}}" />
             <StackPanel
                     Width="228"
                     Margin="0,20,0,0"

+ 53 - 21
PDF Office/Views/PropertyPanel/PDFEdit/TextEditProperty.xaml

@@ -12,6 +12,7 @@
     xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:pdfedit="clr-namespace:PDF_Office.Views.PropertyPanel.PDFEdit"
+    xmlns:form="clr-namespace:PDF_Office.CustomControl.Form"
     xmlns:prism="http://prismlibrary.com/"
     prism:ViewModelLocator.AutoWireViewModel="True"
     d:DesignHeight="450"
@@ -136,22 +137,12 @@
                     BorderBrush="#E2E3E6"
                     BorderThickness="0">
                     <StackPanel Orientation="Horizontal">
-                        <ComboBox
-                            Name="FontTitleBox"
-                            Width="148"
-                            Padding="10,10,0,0"
-                            Background="Transparent"
-                            BorderBrush="#FFE2E3E6"
-                            BorderThickness="1"
-                            IsReadOnly="True"
-                            ItemTemplate="{StaticResource FontStyleData}"
-                            ItemsSource="{Binding FontStyleList}">
-                            <i:Interaction.Triggers>
-                                <i:EventTrigger EventName="SelectionChanged">
-                                    <i:InvokeCommandAction Command="{Binding SelectedFontStyleCommand}" CommandParameter="{Binding ElementName=FontTitleBox, Path=SelectedItem}" />
-                                </i:EventTrigger>
-                            </i:Interaction.Triggers>
-                        </ComboBox>
+                        <CompositeControl:CustomComboControl x:Name="FontTitleBox" Width="148"
+                                                                     ItemSource="{Binding PresetTextItems}" SelectedItems="{Binding PresetTextData,Mode=TwoWay}"
+                                                                     IsValueContent="True" Height="32">
+                        </CompositeControl:CustomComboControl>
+
+                  
                         <Button
                             Width="32"
                             Height="32"
@@ -159,10 +150,52 @@
                     </StackPanel>
                 </Border>
 
+                <StackPanel>
+                    <TextBlock
+                        Margin="0,18,0,10"
+                        Style="{StaticResource PropertyHeaderLv2}"
+                        Text="文本" />
+
+                    <Grid Margin="0,6,0,0">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="auto"></ColumnDefinition>
+                            <ColumnDefinition Width="auto"></ColumnDefinition>
+                        </Grid.ColumnDefinitions>
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="auto"></RowDefinition>
+                            <RowDefinition Height="auto"></RowDefinition>
+                            <RowDefinition Height="auto"></RowDefinition>
+                        </Grid.RowDefinitions>
+
+                        <CompositeControl:CustomComboControl x:Name="FontFamilyBox" HorizontalAlignment="Left"
+                                                                     ItemSource="{Binding FontFamilyItems}" SelectedItems="{Binding FontFamilyData,Mode=TwoWay}"
+                                                                     IsValueContent="True" Grid.ColumnSpan="2"  Width="168" 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="0" Grid.Column="1" SelectedItems="{Binding FontSizeData,Mode=TwoWay}"
+                                                                     Width="80" Height="32" Margin="-1,0,0,0"
+                                                                     >
+                        </CompositeControl:CustomComboControl>
+
+
+                        <cusColor:ColorSubContent
+                        x:Name="FontColorBox"
+                        Grid.Row="1"
+                        Grid.Column="1"
+                        HorizontalAlignment="Left" />
+                    </Grid>
 
+                </StackPanel>
 
 
-                <TextBlock
+                <!--<TextBlock
                     x:Name="FontText"
                     Margin="12,18,0,0"
                     FontFamily="Segoe UI Semibold"
@@ -170,9 +203,9 @@
                     FontWeight="SemiBold"
                     LineHeight="20">
                     Font
-                </TextBlock>
+                </TextBlock>-->
 
-                <Grid Margin="0,6,0,0">
+                <!--<Grid Margin="0,6,0,0">
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="auto" />
                         <ColumnDefinition Width="auto" />
@@ -483,7 +516,6 @@
                             </Grid.ColumnDefinitions>
 
 
-
                             <RadioButton
                                 x:Name="TextAlignLeftBtn"
                                 Width="32"
@@ -682,7 +714,7 @@
 
                         </Grid>
                     </Border>
-                </Grid>
+                </Grid>-->
 
                 <TextBlock
                     x:Name="AlignText"

+ 24 - 24
PDF Office/Views/PropertyPanel/PDFEdit/TextEditProperty.xaml.cs

@@ -36,19 +36,19 @@ namespace PDF_Office.Views.PropertyPanel.PDFEdit
 
         private void InitEventHandler()
         {
-            FontFamilyBox.SelectionChanged -= FontFamilyBox_SelectionChanged;
-            FontStyleBox.SelectionChanged -= FontStyleBox_SelectionChanged;
-            FontSizeBox.SelectionChanged -= FontSizeBox_SelectionChanged;
+            //FontFamilyBox.SelectionChanged -= FontFamilyBox_SelectionChanged;
+            //FontStyleBox.SelectionChanged -= FontStyleBox_SelectionChanged;
+            //FontSizeBox.SelectionChanged -= FontSizeBox_SelectionChanged;
 
-            FontColorBox.SelectedColorHandler -= FontColorBox_SelectedColorHandler;
+            //FontColorBox.SelectedColorHandler -= FontColorBox_SelectedColorHandler;
 
-            FontFamilyBox.SelectionChanged += FontFamilyBox_SelectionChanged;
-            FontStyleBox.SelectionChanged += FontStyleBox_SelectionChanged;
-            FontSizeBox.SelectionChanged += FontSizeBox_SelectionChanged;
+            //FontFamilyBox.SelectionChanged += FontFamilyBox_SelectionChanged;
+            //FontStyleBox.SelectionChanged += FontStyleBox_SelectionChanged;
+            //FontSizeBox.SelectionChanged += FontSizeBox_SelectionChanged;
 
-            FontColorBox.SelectedColorHandler += FontColorBox_SelectedColorHandler;
+            //FontColorBox.SelectedColorHandler += FontColorBox_SelectedColorHandler;
 
-            if(ViewModel != null)
+            if (ViewModel != null)
             {
                 ViewModel.ClearCheckedAglin -= ViewModel_ClearCheckedAglin;
                 ViewModel.ClearCheckedAglin += ViewModel_ClearCheckedAglin;
@@ -70,29 +70,29 @@ namespace PDF_Office.Views.PropertyPanel.PDFEdit
 
         private void FontSizeBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            var listItem = FontSizeBox.ItemContainerGenerator.ContainerFromItem(FontSizeBox.SelectedItem) as ComboBoxItem;
-            if (listItem != null)
-                FontSizeText.Text = listItem.Content.ToString();
-            else
-                FontSizeText.Text = "6";
+            //var listItem = FontSizeBox.ItemContainerGenerator.ContainerFromItem(FontSizeBox.SelectedItem) as ComboBoxItem;
+            //if (listItem != null)
+            //    FontSizeText.Text = listItem.Content.ToString();
+            //else
+            //    FontSizeText.Text = "6";
         }
 
         private void FontStyleBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            var listItem = FontStyleBox.ItemContainerGenerator.ContainerFromItem(FontStyleBox.SelectedItem) as ComboBoxItem;
-            if (listItem != null)
-                FontStyleText.Text = listItem.Content.ToString();
-            else
-                FontStyleText.Text = "Regular";
+            //var listItem = FontStyleBox.ItemContainerGenerator.ContainerFromItem(FontStyleBox.SelectedItem) as ComboBoxItem;
+            //if (listItem != null)
+            //    FontStyleText.Text = listItem.Content.ToString();
+            //else
+            //    FontStyleText.Text = "Regular";
         }
 
         private void FontFamilyBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            var listItem = FontFamilyBox.ItemContainerGenerator.ContainerFromItem(FontFamilyBox.SelectedItem) as ComboBoxItem;
-            if (listItem != null)
-                FontFamilyText.Text = (listItem.Content as TextBlock).Text;
-            else
-                FontFamilyText.Text = "Courier New";
+            //var listItem = FontFamilyBox.ItemContainerGenerator.ContainerFromItem(FontFamilyBox.SelectedItem) as ComboBoxItem;
+            //if (listItem != null)
+            //    FontFamilyText.Text = (listItem.Content as TextBlock).Text;
+            //else
+            //    FontFamilyText.Text = "Courier New";
         }
 
         private void FontColorBox_SelectedColorHandler(object sender, Color e)