using System.Windows; using System.Windows.Input; using System.Windows.Controls; using Prism.Commands; namespace SHJX.Service.Library.Views.SettingLibrary { /// /// SpeedControl.xaml 的交互逻辑 /// public partial class SpeedControl : UserControl { #region Dependency Property #region Command public DelegateCommand SettingSpeedCommand { get => (DelegateCommand)GetValue(SettingSpeedCommandProperty); set => SetValue(SettingSpeedCommandProperty, value); } public static readonly DependencyProperty SettingSpeedCommandProperty = DependencyProperty.Register(nameof(SettingSpeedCommand), typeof(DelegateCommand), typeof(SpeedControl), new UIPropertyMetadata(null, (obj, args) => { var control = obj as SpeedControl; var path = control?.btn_speedsetting; path.Command = args.NewValue as DelegateCommand; })); #endregion #region Header public string HeaderValue { get => (string)GetValue(HeaderValueProperty); set => SetValue(HeaderValueProperty, value); } public static readonly DependencyProperty HeaderValueProperty = DependencyProperty.Register(nameof(HeaderValue), typeof(string), typeof(SpeedControl), new UIPropertyMetadata(string.Empty, (obj, args) => { var control = obj as SpeedControl; var path = control?.gb_speed; path.Header = args.NewValue.ToString(); })); #endregion #region Tag public string TagValue { get => (string)GetValue(TagValueProperty); set => SetValue(TagValueProperty, value); } public static readonly DependencyProperty TagValueProperty = DependencyProperty.Register(nameof(TagValue), typeof(string), typeof(SpeedControl), new UIPropertyMetadata(string.Empty, (obj, args) => { var control = obj as SpeedControl; var path = control?.gb_speed; path.Tag = args.NewValue.ToString(); })); #endregion #region 速度 public string Speed { get => (string)GetValue(SpeedProperty); set => SetValue(SpeedProperty, value); } public static readonly DependencyProperty SpeedProperty = DependencyProperty.Register(nameof(Speed), typeof(string), typeof(SpeedControl), new UIPropertyMetadata(string.Empty, (obj, args) => { var control = obj as SpeedControl; var path = control?.txt_speed; path.Text = args.NewValue.ToString(); })); #endregion #region 加速度 public string AcSpeed { get => (string)GetValue(AcSpeedProperty); set => SetValue(AcSpeedProperty, value); } public static readonly DependencyProperty AcSpeedProperty = DependencyProperty.Register(nameof(AcSpeed), typeof(string), typeof(SpeedControl), new UIPropertyMetadata(string.Empty, (obj, args) => { var control = obj as SpeedControl; var path = control?.txt_acspeed; path.Text = args.NewValue.ToString(); })); #endregion #region 减速度 public string DeSpeed { get => (string)GetValue(DeSpeedProperty); set => SetValue(DeSpeedProperty, value); } public static readonly DependencyProperty DeSpeedProperty = DependencyProperty.Register(nameof(DeSpeed), typeof(string), typeof(SpeedControl), new UIPropertyMetadata(string.Empty, (obj, args) => { var control = obj as SpeedControl; var path = control?.txt_despeed; path.Text = args.NewValue.ToString(); })); #endregion #endregion public SpeedControl() { InitializeComponent(); } } }