CPDThicknessUI.xaml.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace compdfkit_tools.Common
  17. {
  18. /// <summary>
  19. /// CPDFBorderWidthUI.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class CPDFThicknessUI : UserControl, INotifyPropertyChanged
  22. {
  23. public event PropertyChangedEventHandler PropertyChanged;
  24. public event EventHandler ThicknessChanged;
  25. private int _thickness = 1;
  26. public int Thickness
  27. {
  28. get
  29. {
  30. return _thickness;
  31. }
  32. set
  33. {
  34. _thickness = value;
  35. OnPropertyChanged(nameof(Thickness));
  36. OnThicknessChanged();
  37. }
  38. }
  39. public CPDFThicknessUI()
  40. {
  41. InitializeComponent();
  42. this.DataContext = this;
  43. InitPresetNumberArray();
  44. }
  45. public void InitPresetNumberArray()
  46. {
  47. List<int> list = new List<int>();
  48. list.Add(1);
  49. list.Add(3);
  50. list.Add(6);
  51. list.Add(9);
  52. list.Add(12);
  53. list.Add(16);
  54. DropDownNumberBoxControl.InitPresetNumberArray(list);
  55. }
  56. private void OnThicknessChanged()
  57. {
  58. ThicknessChanged?.Invoke(this, EventArgs.Empty);
  59. }
  60. protected void OnPropertyChanged(string propertyName)
  61. {
  62. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  63. }
  64. }
  65. }