CPDFArrowUI.xaml.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. /// CPDFArrowControl.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class CPDFArrowUI : UserControl, INotifyPropertyChanged
  22. {
  23. public event EventHandler ArrowChanged;
  24. public event PropertyChangedEventHandler PropertyChanged;
  25. private int _selectedIndex = 1;
  26. public int SelectedIndex
  27. {
  28. get
  29. {
  30. return _selectedIndex;
  31. }
  32. set
  33. {
  34. _selectedIndex = value;
  35. OnPropertyChanged(nameof(SelectedIndex));
  36. OnArrowChanged();
  37. }
  38. }
  39. public CPDFArrowUI()
  40. {
  41. InitializeComponent();
  42. this.DataContext = this;
  43. }
  44. private void OnArrowChanged()
  45. {
  46. ArrowChanged?.Invoke(this, EventArgs.Empty);
  47. }
  48. protected void OnPropertyChanged(string propertyName)
  49. {
  50. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  51. }
  52. }
  53. }