diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs index 2a0caf13e..da5d5e34b 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs @@ -109,6 +109,16 @@ namespace Tango.Touch.Controls public static readonly DependencyProperty AutoCalculateJogStepProperty = DependencyProperty.Register("AutoCalculateJogStep", typeof(bool), typeof(TouchNumericTextBox), new PropertyMetadata(true)); + public bool UpdateBindingOnlyWhenFocused + { + get { return (bool)GetValue(UpdateBindingOnlyWhenFocusedProperty); } + set { SetValue(UpdateBindingOnlyWhenFocusedProperty, value); } + } + public static readonly DependencyProperty UpdateBindingOnlyWhenFocusedProperty = + DependencyProperty.Register("UpdateBindingOnlyWhenFocused", typeof(bool), typeof(TouchNumericTextBox), new PropertyMetadata(false)); + + + public override void OnApplyTemplate() { base.OnApplyTemplate(); @@ -222,8 +232,11 @@ namespace Tango.Touch.Controls _lastValue = Value; - DoubleValueChangedEventArgs args = new DoubleValueChangedEventArgs(ValueChangedEvent, this, Value); - RaiseEvent(args); + if (!UpdateBindingOnlyWhenFocused || (_text_box != null && _text_box.IsKeyboardFocused)) + { + DoubleValueChangedEventArgs args = new DoubleValueChangedEventArgs(ValueChangedEvent, this, Value); + RaiseEvent(args); + } } } |
