liuaoran 2 lat temu
rodzic
commit
54e0f1c5ec

+ 186 - 0
PDF Office/Helper/ObservableDictionary.cs

@@ -0,0 +1,186 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Helper
+{
+    public class ObservableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, INotifyCollectionChanged, INotifyPropertyChanged
+    {
+        public ObservableDictionary()
+            : base()
+        { }
+
+        private int _index;
+        public event NotifyCollectionChangedEventHandler CollectionChanged;
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        public new KeyCollection Keys
+        {
+            get { return base.Keys; }
+        }
+
+        public new ValueCollection Values
+        {
+            get { return base.Values; }
+        }
+
+        public new int Count
+        {
+            get { return base.Count; }
+        }
+
+        public new TValue this[TKey key]
+        {
+            get { return this.GetValue(key); }
+            set { this.SetValue(key, value); }
+        }
+
+        public TValue this[int index]
+        {
+            get { return this.GetIndexValue(index); }
+            set { this.SetIndexValue(index, value); }
+        }
+
+        public new void Add(TKey key, TValue value)
+        {
+            base.Add(key, value);
+            this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, this.FindPair(key), _index));
+            OnPropertyChanged("Keys");
+            OnPropertyChanged("Values");
+            OnPropertyChanged("Count");
+        }
+
+        public new void Clear()
+        {
+            base.Clear();
+            this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
+            OnPropertyChanged("Keys");
+            OnPropertyChanged("Values");
+            OnPropertyChanged("Count");
+        }
+
+        public new bool Remove(TKey key)
+        {
+            var pair = this.FindPair(key);
+            if (base.Remove(key))
+            {
+                this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, pair, _index));
+                OnPropertyChanged("Keys");
+                OnPropertyChanged("Values");
+                OnPropertyChanged("Count");
+                return true;
+            }
+            return false;
+        }
+
+        protected void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
+        {
+            if (this.CollectionChanged != null)
+            {
+                this.CollectionChanged(this, e);
+            }
+        }
+
+        protected void OnPropertyChanged(string propertyName)
+        {
+            if (this.PropertyChanged != null)
+            {
+                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+            }
+        }
+
+        #region private method
+        private TValue GetIndexValue(int index)
+        {
+            for (int i = 0; i < this.Count; i++)
+            {
+                if (i == index)
+                {
+                    var pair = this.ElementAt(i);
+                    return pair.Value;
+                }
+            }
+
+            return default(TValue);
+        }
+
+        private void SetIndexValue(int index, TValue value)
+        {
+            try
+            {
+                var pair = this.ElementAtOrDefault(index);
+                SetValue(pair.Key, value);
+            }
+            catch (Exception)
+            {
+
+            }
+        }
+
+        private TValue GetValue(TKey key)
+        {
+            if (base.ContainsKey(key))
+            {
+                return base[key];
+            }
+            else
+            {
+                return default(TValue);
+            }
+        }
+
+        private void SetValue(TKey key, TValue value)
+        {
+            if (base.ContainsKey(key))
+            {
+                var pair = this.FindPair(key);
+                int index = _index;
+                base[key] = value;
+                var newpair = this.FindPair(key);
+                this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, newpair, pair, index));
+                OnPropertyChanged("Values");
+                OnPropertyChanged("Item[]");
+            }
+            else
+            {
+                this.Add(key, value);
+            }
+        }
+
+        private KeyValuePair<TKey, TValue> FindPair(TKey key)
+        {
+            _index = 0;
+            foreach (var item in this)
+            {
+                if (item.Key.Equals(key))
+                {
+                    return item;
+                }
+                _index++;
+            }
+            return default(KeyValuePair<TKey, TValue>);
+        }
+
+        private int IndexOf(TKey key)
+        {
+            int index = 0;
+            foreach (var item in this)
+            {
+                if (item.Key.Equals(key))
+                {
+                    return index;
+                }
+                index++;
+
+            }
+            return -1;
+        }
+
+        #endregion
+
+    }
+}

+ 35 - 0
PDF Office/Model/EditTools/Background/BackgroundCreateModel.cs

@@ -0,0 +1,35 @@
+using ComPDFKit.PDFDocument;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.EditTools.Background
+{
+    public class BackgroundCreateModel
+    {
+    }
+
+    public enum EnumBackgroundType
+    {
+        StatusColor,
+        StatusFile
+    }
+
+    public class BackgroundInfo
+    {
+        public EnumBackgroundType EnumBackgroundType { get; set; }
+        public string Color { get; set; }
+        public string Rotation { get; set; }
+        public byte Opacity { get; set; }
+        public bool IsRelativeRatio { get; set; }
+        public int RelativeRatio { get; set; }
+        public int VerticalMove { get; set; }
+        public int HorizontalMove { get; set; }
+        public C_Background_Vertalign BackgroundVertalign { get; set; }
+        public C_Background_Horizalign BackgroundHorizalign { get; set; }
+        public C_Background_Type BackgroundType { get; set; }
+        public byte[] ImageArray { get; set; }
+    }
+}

+ 12 - 0
PDF Office/Model/EditTools/Background/BackgroundTemplateListModel.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.EditTools.Background
+{
+    internal class BackgroundTemplateListModel
+    {
+    }
+}

+ 3 - 0
PDF Office/PDF Office.csproj

@@ -221,6 +221,7 @@
     <Compile Include="EventAggregators\PageEditRefreshEvent.cs" />
     <Compile Include="EventAggregators\PageEditRefreshEvent.cs" />
     <Compile Include="Helper\ConverterHelper.cs" />
     <Compile Include="Helper\ConverterHelper.cs" />
     <Compile Include="Helper\HomePageEditHelper.cs" />
     <Compile Include="Helper\HomePageEditHelper.cs" />
+    <Compile Include="Helper\ObservableDictionary.cs" />
     <Compile Include="Helper\PasswordBoxHelper.cs" />
     <Compile Include="Helper\PasswordBoxHelper.cs" />
     <Compile Include="Helper\PictureConverter.cs" />
     <Compile Include="Helper\PictureConverter.cs" />
     <Compile Include="Helper\SDKLisenceHelper.cs" />
     <Compile Include="Helper\SDKLisenceHelper.cs" />
@@ -263,6 +264,8 @@
     <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePageInsertDialogModel.cs" />
     <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePageInsertDialogModel.cs" />
     <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterDialogModel.cs" />
     <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterDialogModel.cs" />
     <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePageSplitDialogModel.cs" />
     <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePageSplitDialogModel.cs" />
+    <Compile Include="Model\EditTools\Background\BackgroundCreateModel.cs" />
+    <Compile Include="Model\EditTools\Background\BackgroundTemplateListModel.cs" />
     <Compile Include="Model\PageEdit\ExtractModel.cs" />
     <Compile Include="Model\PageEdit\ExtractModel.cs" />
     <Compile Include="Model\PageEdit\PageEditItem.cs" />
     <Compile Include="Model\PageEdit\PageEditItem.cs" />
     <Compile Include="Model\ParameterNames.cs" />
     <Compile Include="Model\ParameterNames.cs" />

+ 4 - 4
PDF Office/Styles/CheckBoxStyle.xaml

@@ -18,16 +18,16 @@
                             <Rectangle x:Name="CheckBoxRectangle" Fill="White" Opacity="0.3" RadiusY="2" RadiusX="2"/>
                             <Rectangle x:Name="CheckBoxRectangle" Fill="White" Opacity="0.3" RadiusY="2" RadiusX="2"/>
                             <Rectangle x:Name="CheckBoxRectangleOut" Stroke="Black" StrokeThickness="1" RadiusY="2" RadiusX="1"/>
                             <Rectangle x:Name="CheckBoxRectangleOut" Stroke="Black" StrokeThickness="1" RadiusY="2" RadiusX="1"/>
                             <Grid x:Name="CheckedMark" Width="20" Height="20" Visibility="Collapsed">
                             <Grid x:Name="CheckedMark" Width="20" Height="20" Visibility="Collapsed">
-                                <Path SnapsToDevicePixels="False" StrokeThickness="3" Data="M1,9 L10,17" Stroke="White"/>
-                                <Path SnapsToDevicePixels="False" StrokeThickness="3" Data="M8,17 L20,4" Stroke="White"/>
+                                <Path SnapsToDevicePixels="False" StrokeThickness="2" Data="M3,11 L9,16" Stroke="White"/>
+                                <Path SnapsToDevicePixels="False" StrokeThickness="2" Data="M8,16 L17,5" Stroke="White"/>
                             </Grid>
                             </Grid>
                         </Grid>
                         </Grid>
-                        <TextBlock Grid.Column="1" FontSize="18" Foreground="Black" VerticalAlignment="Center" Margin="14,0,0,0" Text="{Binding Content,RelativeSource={RelativeSource TemplatedParent}}"/>
+                        <TextBlock Grid.Column="1" FontSize="14" Foreground="Black" VerticalAlignment="Center" Margin="8,0,0,0" Text="{Binding Content,RelativeSource={RelativeSource TemplatedParent}}"/>
                     </Grid>
                     </Grid>
                     <ControlTemplate.Triggers>
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsChecked" Value="True">
                         <Trigger Property="IsChecked" Value="True">
                             <Setter TargetName="CheckedMark" Property="Visibility" Value="Visible"></Setter>
                             <Setter TargetName="CheckedMark" Property="Visibility" Value="Visible"></Setter>
-                            <Setter TargetName="CheckBoxRectangle" Property="Fill" Value="#FF00A8E0"></Setter>
+                            <Setter TargetName="CheckBoxRectangle" Property="Fill" Value="#000000"></Setter>
                             <Setter TargetName="CheckBoxRectangle" Property="Opacity" Value="1"></Setter>
                             <Setter TargetName="CheckBoxRectangle" Property="Opacity" Value="1"></Setter>
                             <Setter TargetName="CheckBoxRectangleOut" Property="Stroke" Value="Transparent"></Setter>
                             <Setter TargetName="CheckBoxRectangleOut" Property="Stroke" Value="Transparent"></Setter>
                         </Trigger>
                         </Trigger>

+ 125 - 5
PDF Office/ViewModels/EditTools/Background/BackgroundCreateColorContentViewModel.cs

@@ -1,7 +1,12 @@
-using Prism.Mvvm;
+using ComPDFKit.PDFDocument;
+using PDF_Office.Helper;
+using PDF_Office.Model.EditTools.Background;
+using Prism.Commands;
+using Prism.Mvvm;
 using Prism.Regions;
 using Prism.Regions;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
@@ -9,9 +14,17 @@ using System.Windows.Forms;
 
 
 namespace PDF_Office.ViewModels.EditTools.Background
 namespace PDF_Office.ViewModels.EditTools.Background
 {
 {
+
     public class BackgroundCreateColorContentViewModel : BindableBase, INavigationAware
     public class BackgroundCreateColorContentViewModel : BindableBase, INavigationAware
     {
     {
-        private List<string> _opacityList=  new List<string>();
+        private List<string> _rotationList = new List<string>();
+        public List<string> RotationList
+        {
+            get { return _rotationList; }
+            set { SetProperty(ref _rotationList, value); }
+        }
+
+        private List<string> _opacityList = new List<string>();
         public List<string> OpacityList
         public List<string> OpacityList
         {
         {
             get { return _opacityList; }
             get { return _opacityList; }
@@ -21,16 +34,123 @@ namespace PDF_Office.ViewModels.EditTools.Background
             }
             }
         }
         }
 
 
-        public BackgroundCreateColorContentViewModel()
+        private List<string> _relativeRatioList = new List<string>();
+        public List<string> RelativeRatioList
+        {
+            get { return _relativeRatioList; }
+            set
+            {
+                SetProperty(ref _relativeRatioList, value);
+            }
+        }
+
+        private int _rotationNumber = 0;
+        public int RotationNumber
+        {
+            get { return _rotationNumber; }
+            set
+            {
+                SetProperty(ref _rotationNumber, value);
+            }
+        }
+
+        private int _opacityNumber = 100;
+        public int OpacityNumber
+        {
+            get { return _opacityNumber; }
+            set { SetProperty(ref _opacityNumber, value); }
+        }
+
+        private int _relativeRatioNumber = 0;
+        public int RelativeRatioNumber
+        {
+            get { return _relativeRatioNumber; }
+            set { SetProperty(ref _rotationNumber, value); }
+        }
+
+        private ObservableDictionary<string, bool> _getLocationFromNumber = new ObservableDictionary<string, bool>();
+        public ObservableDictionary<string, bool> GetLocationFromNumber
+        {
+            get { return _getLocationFromNumber;}
+            set { _getLocationFromNumber = value; }
+        }
+
+        private BackgroundInfo _backgroundInfo = new BackgroundInfo();
+        public BackgroundInfo BackgroundInfo
+        {
+            get { return _backgroundInfo; }
+            set { _backgroundInfo = value; }
+        }
+
+
+        public DelegateCommand<object> ChangeLocationCommand { get; set; }
+
+        public BackgroundCreateColorContentViewModel(){
+            ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
+            InitComponent();
+            BackgroundInfo.BackgroundHorizalign = C_Background_Horizalign.BG_HORIZALIGN_CENTER;
+            BackgroundInfo.BackgroundVertalign = C_Background_Vertalign.BG_VERTALIGN_CENTER;
+            InitLocationButtonMatrix();
+        }
+
+        public void InitComponent()
+        {
+            InitOpacityList();
+            InitRotationList();
+            InitRelativeRatioList();
+        }
+
+        private void InitRotationList()
         {
         {
+            OpacityList.Clear();
+            for (int defaultRotation = -45; defaultRotation <= 45; defaultRotation += 15)
+            {
+                RotationList.Add(defaultRotation.ToString());
+            }
         }
         }
 
 
         private void InitOpacityList()
         private void InitOpacityList()
         {
         {
             OpacityList.Clear();
             OpacityList.Clear();
-            for (int temp = 0; temp < 100; temp += 10)
+            for (int defaultOpacity = 10; defaultOpacity <= 100; defaultOpacity += 10)
+            {
+                OpacityList.Add(defaultOpacity.ToString() + " %");
+            }
+        }
+
+        private void InitRelativeRatioList()
+        {
+            RelativeRatioList.Clear();
+            for (int defaultRelativeRatioList = 10; defaultRelativeRatioList <= 100; defaultRelativeRatioList += 10)
+            {
+                OpacityList.Add(defaultRelativeRatioList.ToString() + " %");
+            }
+        }
+
+        private void InitLocationButtonMatrix()
+        {
+            GetLocationFromNumber.Clear();
+            for(var temp = 0; temp <= 22; temp++)
+            {
+                GetLocationFromNumber.Add(temp.ToString(), true);
+                if(temp%10 == 2)
+                {
+                    temp += 7;
+                }
+            }
+            int Num =(int)BackgroundInfo.BackgroundVertalign * 10 + (int)BackgroundInfo.BackgroundHorizalign;
+            GetLocationFromNumber[Num.ToString()] = false;
+            
+        }
+
+        public void ChangeLocation(object e)
+        {
+            string args = e as string;
+            if (args != null)
             {
             {
-                OpacityList.Add(temp.ToString() + " %");
+                BackgroundInfo.BackgroundVertalign = (C_Background_Vertalign)(int.Parse(args) / 10);
+                BackgroundInfo.BackgroundHorizalign = (C_Background_Horizalign)(int.Parse(args) % 10);
+                InitLocationButtonMatrix();
             }
             }
         }
         }
 
 

+ 30 - 21
PDF Office/Views/EditTools/Background/BackgroundCreateColorContent.xaml

@@ -27,11 +27,23 @@
             <StackPanel Orientation="Vertical">
             <StackPanel Orientation="Vertical">
                 <TextBlock Text="背景颜色" Height="20" Width="48" HorizontalAlignment="Left" Margin="0,16,16,8" Foreground="#666666"> </TextBlock>
                 <TextBlock Text="背景颜色" Height="20" Width="48" HorizontalAlignment="Left" Margin="0,16,16,8" Foreground="#666666"> </TextBlock>
                 <StackPanel Orientation="Horizontal">
                 <StackPanel Orientation="Horizontal">
+                    <Button Name="RedColorBtn" Height="32" Width="32" Margin="0,0,8,0" Command="{Binding ChangeColorCommand}" CommandParameter="{Binding ElementName=RedColorBtn}">
+                        <Rectangle Height="22" Width="22" Fill="Red" RadiusX="20" RadiusY="20"></Rectangle>
+                    </Button>
                     <Button Height="32" Width="32" Margin="0,0,8,0"></Button>
                     <Button Height="32" Width="32" Margin="0,0,8,0"></Button>
                     <Button Height="32" Width="32" Margin="0,0,8,0"></Button>
                     <Button Height="32" Width="32" Margin="0,0,8,0"></Button>
                     <Button Height="32" Width="32" Margin="0,0,8,0"></Button>
                     <Button Height="32" Width="32" Margin="0,0,8,0"></Button>
-                    <Button Height="32" Width="32" Margin="0,0,8,0"></Button>
-                    <Button Height="32" Width="66"></Button>
+                    <Button Height="32" Width="66">
+                        <Grid Height="32" Width="66" HorizontalAlignment="Center" VerticalAlignment="Center">
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition></ColumnDefinition>
+                                <ColumnDefinition></ColumnDefinition>
+                            </Grid.ColumnDefinitions>
+                            <Grid Grid.Column="0" Height="22" Width="22">
+                                <Rectangle Fill="AliceBlue" RadiusX="20" RadiusY="20"></Rectangle>
+                            </Grid>
+                        </Grid>
+                    </Button>
                 </StackPanel>
                 </StackPanel>
             </StackPanel>
             </StackPanel>
         </Grid>
         </Grid>
@@ -40,22 +52,17 @@
                 <TextBlock Text="外观" Margin="0,16,0,8" Foreground="#666666"></TextBlock>
                 <TextBlock Text="外观" Margin="0,16,0,8" Foreground="#666666"></TextBlock>
                 <StackPanel Orientation="Horizontal">
                 <StackPanel Orientation="Horizontal">
                     <TextBlock Height="24" Width="24" Background= "Bisque" Margin="0,0,8,0"></TextBlock>
                     <TextBlock Height="24" Width="24" Background= "Bisque" Margin="0,0,8,0"></TextBlock>
-                    <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" Margin="0,0,28,0"></cus:CommonWritableComboBox>
+                    <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" Margin="0,0,28,0" TypeSouce="{Binding RotationList, Mode=TwoWay}" Value="{Binding RotationNumber, Mode=TwoWay}" Text="0" ></cus:CommonWritableComboBox>
                     
                     
                     <TextBlock Height="24" Width="24" Background="CadetBlue" Margin="0,0,8,0"></TextBlock>
                     <TextBlock Height="24" Width="24" Background="CadetBlue" Margin="0,0,8,0"></TextBlock>
-                    <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" TypeSouce="{Binding OpacityList, Mode=TwoWay}"></cus:CommonWritableComboBox>
+                    <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" TypeSouce="{Binding OpacityList, Mode=TwoWay}" Value="{Binding OpacityNumber, Mode=TwoWay}" Text="100 %"></cus:CommonWritableComboBox>
                 </StackPanel>
                 </StackPanel>
                 <StackPanel Orientation="Horizontal"></StackPanel>
                 <StackPanel Orientation="Horizontal"></StackPanel>
                 <Grid Margin="0,19,0,0">
                 <Grid Margin="0,19,0,0">
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition  Width="30"></ColumnDefinition>
-                        <ColumnDefinition ></ColumnDefinition>
 
 
-                    </Grid.ColumnDefinitions>
-                    <CheckBox Grid.Column="0" Style="{StaticResource CheckBoxStyle}" Content="相对目标页面的比例" Margin="0,0,0,0" Height="22"></CheckBox>
-                    <TextBlock Grid.Column="1" Text="相对目标页面的比例" Height="22" ></TextBlock>
+                    <CheckBox Grid.Column="0" Style="{StaticResource CheckBoxStyle}" Content="相对目标页面的比例" Margin="0,0,0,0" Height="22" ></CheckBox>
                 </Grid>
                 </Grid>
-                <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" Margin="0,11,0,0"></cus:CommonWritableComboBox>
+                <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" Margin="0,11,0,0" TypeSouce="{Binding RelativeRatioList}" Value="{Binding RelativeRatioNumber, Mode=TwoWay}" Text="50 %"></cus:CommonWritableComboBox>
 
 
 
 
             </StackPanel>
             </StackPanel>
@@ -76,15 +83,15 @@
                             <RowDefinition></RowDefinition>
                             <RowDefinition></RowDefinition>
                             <RowDefinition></RowDefinition>
                             <RowDefinition></RowDefinition>
                         </Grid.RowDefinitions>
                         </Grid.RowDefinitions>
-                        <Button Grid.Column="0" Grid.Row="0"></Button>
-                        <Button Grid.Column="1" Grid.Row="0"></Button>
-                        <Button Grid.Column="2" Grid.Row="0"></Button>
-                        <Button Grid.Column="0" Grid.Row="1"></Button>
-                        <Button Grid.Column="1" Grid.Row="1" Background="Black"></Button>
-                        <Button Grid.Column="2" Grid.Row="1"></Button>
-                        <Button Grid.Column="0" Grid.Row="2"></Button>
-                        <Button Grid.Column="1" Grid.Row="2"></Button>
-                        <Button Grid.Column="2" Grid.Row="2"></Button>
+                        <Button Grid.Column="0" Grid.Row="0" Tag="0" Command="{Binding ChangeLocationCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" IsEnabled="{Binding GetLocationFromNumber[0],Mode=TwoWay}"></Button>
+                        <Button Grid.Column="1" Grid.Row="0" Tag="1" Command="{Binding ChangeLocationCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"  IsEnabled="{Binding GetLocationFromNumber[1], Mode=TwoWay}"></Button>
+                        <Button Grid.Column="2" Grid.Row="0" Tag="2" Command="{Binding ChangeLocationCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"  IsEnabled="{Binding GetLocationFromNumber[2], Mode=TwoWay}"></Button>
+                        <Button Grid.Column="0" Grid.Row="1" Tag="10" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"  IsEnabled="{Binding GetLocationFromNumber[10], Mode=TwoWay}"></Button>
+                        <Button Grid.Column="1" Grid.Row="1" Tag="11" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"  IsEnabled="{Binding GetLocationFromNumber[11], Mode=TwoWay}"></Button>
+                        <Button Grid.Column="2" Grid.Row="1" Tag="12" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"  IsEnabled="{Binding GetLocationFromNumber[12], Mode=TwoWay}"></Button>
+                        <Button Grid.Column="0" Grid.Row="2" Tag="20" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"  IsEnabled="{Binding GetLocationFromNumber[20], Mode=TwoWay}"></Button>
+                        <Button Grid.Column="1" Grid.Row="2" Tag="21" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"  IsEnabled="{Binding GetLocationFromNumber[21], Mode=TwoWay}"></Button>
+                        <Button Grid.Column="2" Grid.Row="2" Tag="22" Command="{Binding ChangeLocationCommand}"  CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Tag}"  IsEnabled="{Binding GetLocationFromNumber[22], Mode=TwoWay}"></Button>
                     </Grid>
                     </Grid>
                     <StackPanel Orientation="Vertical" Margin="70,0,0,0">
                     <StackPanel Orientation="Vertical" Margin="70,0,0,0">
                         <StackPanel Orientation="Horizontal">
                         <StackPanel Orientation="Horizontal">
@@ -116,8 +123,10 @@
         <Grid Grid.Row="3" Margin="0,16,0,0">
         <Grid Grid.Row="3" Margin="0,16,0,0">
             <StackPanel Orientation="Vertical">
             <StackPanel Orientation="Vertical">
                 <TextBlock Text="页面范围" FontSize="12" Foreground="#666666" Height="20" Width="48" HorizontalAlignment="Left"></TextBlock>
                 <TextBlock Text="页面范围" FontSize="12" Foreground="#666666" Height="20" Width="48" HorizontalAlignment="Left"></TextBlock>
-                <ComboBox Height="32" Width="228" Margin="0,8,0,0" HorizontalAlignment="Left"></ComboBox>
+                <cus:WritableComboBox  Height="32" Width="228" Margin="0,8,0,0" HorizontalAlignment="Left"></cus:WritableComboBox>
             </StackPanel>
             </StackPanel>
         </Grid>
         </Grid>
+        <Grid Grid.Row="4">
+        </Grid>
     </Grid>
     </Grid>
 </UserControl>
 </UserControl>

+ 5 - 11
PDF Office/Views/EditTools/Background/BackgroundCreateFileContent.xaml

@@ -4,7 +4,7 @@
              xmlns:prism="http://prismlibrary.com/"             
              xmlns:prism="http://prismlibrary.com/"             
              prism:ViewModelLocator.AutoWireViewModel="True"
              prism:ViewModelLocator.AutoWireViewModel="True"
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:cus="clr-namespace:PDF_Office.CustomControl"
              mc:Ignorable="d"
              mc:Ignorable="d"
              d:DesignHeight="632"
              d:DesignHeight="632"
              d:DesignWidth="260">
              d:DesignWidth="260">
@@ -34,21 +34,15 @@
                 <TextBlock Text="外观" Margin="0,16,0,8" Foreground="#666666"></TextBlock>
                 <TextBlock Text="外观" Margin="0,16,0,8" Foreground="#666666"></TextBlock>
                 <StackPanel Orientation="Horizontal">
                 <StackPanel Orientation="Horizontal">
                     <TextBlock Height="24" Width="24" Background= "Bisque" Margin="0,0,8,0"></TextBlock>
                     <TextBlock Height="24" Width="24" Background= "Bisque" Margin="0,0,8,0"></TextBlock>
-                    <ComboBox Height="32" Width=" 66" Margin="0,0,28,0"></ComboBox>
+                    <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" Margin="0,0,28,0" TypeSouce="{Binding RotationList, Mode=TwoWay}"></cus:CommonWritableComboBox>
                     <TextBlock Height="24" Width="24" Background="CadetBlue" Margin="0,0,8,0"></TextBlock>
                     <TextBlock Height="24" Width="24" Background="CadetBlue" Margin="0,0,8,0"></TextBlock>
-                    <ComboBox Height="32" Width=" 66"></ComboBox>
+                    <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" Margin="0,0,28,0" TypeSouce="{Binding RotationList, Mode=TwoWay}"></cus:CommonWritableComboBox>
                 </StackPanel>
                 </StackPanel>
                 <StackPanel Orientation="Horizontal"></StackPanel>
                 <StackPanel Orientation="Horizontal"></StackPanel>
                 <Grid Margin="0,19,0,0">
                 <Grid Margin="0,19,0,0">
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition  Width="30"></ColumnDefinition>
-                        <ColumnDefinition ></ColumnDefinition>
-
-                    </Grid.ColumnDefinitions>
                     <CheckBox Grid.Column="0" Style="{StaticResource CheckBoxStyle}" Content="相对目标页面的比例" Margin="0,0,0,0" Height="22"></CheckBox>
                     <CheckBox Grid.Column="0" Style="{StaticResource CheckBoxStyle}" Content="相对目标页面的比例" Margin="0,0,0,0" Height="22"></CheckBox>
-                    <TextBlock Grid.Column="1" Text="相对目标页面的比例" Height="22" ></TextBlock>
                 </Grid>
                 </Grid>
-                <ComboBox Height="32" Width="66" HorizontalAlignment="Left" Margin="0,11,0,0"></ComboBox>
+                <cus:CommonWritableComboBox HorizontalAlignment="Left" Width="66" Height="32" Margin="0,11,28,0" TypeSouce="{Binding RotationList, Mode=TwoWay}"></cus:CommonWritableComboBox>
             </StackPanel>
             </StackPanel>
         </Grid>
         </Grid>
         <Grid  Grid.Row="2" Margin="0,16,0,0" VerticalAlignment="Bottom">
         <Grid  Grid.Row="2" Margin="0,16,0,0" VerticalAlignment="Bottom">
@@ -100,7 +94,7 @@
         <Grid Grid.Row="3" Margin="0,16,0,0" VerticalAlignment="Bottom">
         <Grid Grid.Row="3" Margin="0,16,0,0" VerticalAlignment="Bottom">
             <StackPanel Orientation="Vertical">
             <StackPanel Orientation="Vertical">
                 <TextBlock Text="页面范围" FontSize="12" Foreground="#666666" Height="20" Width="48" HorizontalAlignment="Left"></TextBlock>
                 <TextBlock Text="页面范围" FontSize="12" Foreground="#666666" Height="20" Width="48" HorizontalAlignment="Left"></TextBlock>
-                <ComboBox Height="32" Width="228" Margin="0,8,0,0" HorizontalAlignment="Left"></ComboBox>
+                <cus:WritableComboBox  Height="32" Width="228" Margin="0,8,0,0" HorizontalAlignment="Left"></cus:WritableComboBox>
             </StackPanel>
             </StackPanel>
         </Grid>
         </Grid>
     </Grid>
     </Grid>