private static void OnSetCommandCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) { NumericUpDown element = dependencyObject as NumericUpDown; if (element != null) { NumericUpDownValueChangedBehavior behavior = GetOrCreateBehavior(element); behavior.Command = e.NewValue as ICommand; } }
private static NumericUpDownValueChangedBehavior GetOrCreateBehavior(NumericUpDown element) { NumericUpDownValueChangedBehavior behavior = element.GetValue(keyUpCommandBehaviorProperty) as NumericUpDownValueChangedBehavior; if (behavior == null) { behavior = new NumericUpDownValueChangedBehavior(element); element.SetValue(keyUpCommandBehaviorProperty, behavior); } return(behavior); }
private static void SetkeyUpCommandBehavior(DependencyObject dependencyObject, NumericUpDownValueChangedBehavior value) { dependencyObject.SetValue(keyUpCommandBehaviorProperty, value); }