MontionButton.xaml.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace MaintainModule.Controls;
  16. /// <summary>
  17. /// Interaction logic for MontionButton.xaml
  18. /// </summary>
  19. public partial class MontionButton : UserControl
  20. {
  21. public MontionButton()
  22. {
  23. InitializeComponent();
  24. }
  25. public ImageSource Image
  26. {
  27. get { return (ImageSource)GetValue(ImageProperty); }
  28. set { SetValue(ImageProperty, value); }
  29. }
  30. // Using a DependencyProperty as the backing store for Image. This enables animation, styling, binding, etc...
  31. public static readonly DependencyProperty ImageProperty =
  32. DependencyProperty.Register(nameof(Image), typeof(ImageSource), typeof(MontionButton), new PropertyMetadata(default));
  33. public string Title
  34. {
  35. get { return (string)GetValue(TitleProperty); }
  36. set { SetValue(TitleProperty, value); }
  37. }
  38. // Using a DependencyProperty as the backing store for Title. This enables animation, styling, binding, etc...
  39. public static readonly DependencyProperty TitleProperty =
  40. DependencyProperty.Register(nameof(Title), typeof(string), typeof(MontionButton), new PropertyMetadata(default));
  41. public ICommand OpenCommand
  42. {
  43. get { return (ICommand)GetValue(OpenCommandProperty); }
  44. set { SetValue(OpenCommandProperty, value); }
  45. }
  46. // Using a DependencyProperty as the backing store for OpenCommand. This enables animation, styling, binding, etc...
  47. public static readonly DependencyProperty OpenCommandProperty =
  48. DependencyProperty.Register(nameof(OpenCommand), typeof(ICommand), typeof(MontionButton), new PropertyMetadata(default));
  49. public object OpenParameter
  50. {
  51. get { return (object)GetValue(OpenParameterProperty); }
  52. set { SetValue(OpenParameterProperty, value); }
  53. }
  54. // Using a DependencyProperty as the backing store for OpenParameter. This enables animation, styling, binding, etc...
  55. public static readonly DependencyProperty OpenParameterProperty =
  56. DependencyProperty.Register(nameof(OpenParameter), typeof(object), typeof(MontionButton), new PropertyMetadata(default));
  57. }