ManualButton.xaml.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using Panuon.UI.Silver;
  2. using Prism.Commands;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace SHJX.Service.Library.Views.ManualControl
  18. {
  19. /// <summary>
  20. /// ManualButton.xaml 的交互逻辑
  21. /// </summary>
  22. public partial class ManualButton : UserControl
  23. {
  24. public ManualButton()
  25. {
  26. InitializeComponent();
  27. }
  28. public string ButtonContent
  29. {
  30. set
  31. {
  32. btn_Motor_click.Content = value;
  33. }
  34. }
  35. public double WidthValue
  36. {
  37. set
  38. {
  39. this.btn_Motor_click.Width = value;
  40. }
  41. }
  42. public double HeightValue
  43. {
  44. set
  45. {
  46. this.btn_Motor_click.Height = value;
  47. }
  48. }
  49. public double RadiusValue
  50. {
  51. set
  52. {
  53. Binding binding = new()
  54. {
  55. Source = value
  56. };
  57. BindingOperations.SetBinding(btn_Motor_click, ButtonHelper.CornerRadiusProperty, binding);
  58. }
  59. }
  60. #region RightButton Command
  61. public DelegateCommand<object> MotorManualCommand
  62. {
  63. get => (DelegateCommand<object>)GetValue(MotorManualCommandProperty);
  64. set => SetValue(MotorManualCommandProperty, value);
  65. }
  66. public static readonly DependencyProperty MotorManualCommandProperty =
  67. DependencyProperty.Register(nameof(MotorManualCommand), typeof(DelegateCommand<object>), typeof(ManualButton),
  68. new UIPropertyMetadata(null, (obj, args) =>
  69. {
  70. var control = obj as ManualButton;
  71. var path = control?.btn_Motor_click;
  72. path.Command = args.NewValue as DelegateCommand<object>;
  73. }));
  74. #endregion
  75. }
  76. }