/// <summary> /// Catches pasting /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void textBox_PreviewKeyDown(object sender, KeyEventArgs e) { UserInput = true; // Remove focus when escape was hit to go back to Cursors.ScrollAll mode // and edit value increment/decrement via mouse drag gesture if (e.Key == Key.Escape) { Keyboard.ClearFocus(); e.Handled = true; return; } if (e.Key == Key.Up) { if (CanIncreaseCommand() == true) { IncreaseCommand.Execute(null, this); } e.Handled = true; return; } if (e.Key == Key.Down) { if (CanDecreaseCommand() == true) { DecreaseCommand.Execute(null, this); } e.Handled = true; return; } if (e.Key == Key.Right) { OnIncrement(LargeStepSize); e.Handled = true; return; } if (e.Key == Key.Left) { OnDecrement(LargeStepSize); e.Handled = true; return; } }
private void OnTextBoxKeyDown(Object sender, KeyEventArgs e) { if (e.Key == Key.Down) { if (!IsReadOnly && DecreaseCommand.CanExecute()) { DecreaseCommand.Execute(); } e.Handled = true; } else if (e.Key == Key.Up) { if (!IsReadOnly && IncreaseCommand.CanExecute()) { IncreaseCommand.Execute(); } e.Handled = true; } base.OnKeyDown(e); }
/// <summary> /// Catches pasting /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void textBox_PreviewKeyDown(object sender, KeyEventArgs e) { UserInput = true; // Remove focus when escape was hit to go back to Cursors.ScrollAll mode // and edit value increment/decrement via mouse drag gesture if (e.Key == Key.Escape) { Keyboard.ClearFocus(); e.Handled = true; return; } // support small value change via up cursor key if (e.Key == Key.Up && IsModifierKeyDown() == false) { if (CanIncreaseCommand() == true) { IncreaseCommand.Execute(null, this); } e.Handled = true; return; } // support small value change via down cursor key if (e.Key == Key.Down && IsModifierKeyDown() == false) { if (CanDecreaseCommand() == true) { DecreaseCommand.Execute(null, this); } e.Handled = true; return; } // support large value change via right cursor key if (e.Key == Key.Right && IsModifierKeyDown() == false) { OnIncrement(LargeStepSize); e.Handled = true; return; } // support large value change via left cursor key if (e.Key == Key.Left && IsModifierKeyDown() == false) { OnDecrement(LargeStepSize); e.Handled = true; return; } // update value typed by the user if (e.Key == Key.Enter) { _PART_TextBox?.GetBindingExpression(TextBox.TextProperty).UpdateSource(); e.Handled = true; return; } }
partial void IncreasePriceAction(MonoTouch.Foundation.NSObject sender) { IncreaseCommand.Execute(null); }