protected override void OnPreviewKeyDown(KeyEventArgs e) { base.OnPreviewKeyDown(e); if (e.Key == Key.Down) { if (_downButton != null) { _downButton.Focus(); } OnDown(this, null); e.Handled = true; } if (e.Key == Key.Up) { if (_upBuppton != null) { _upBuppton.Focus(); } OnUp(this, null); e.Handled = true; } }
public void TestTabbingOutNumericUpDown() { NumericUpDown nud = DefaultNumericUpDownToTest; nud.DecimalPlaces = 1; nud.Value = 50.8; TextBox tb = new TextBox(); RepeatButton rb = new RepeatButton(); TestAsync( nud, () => tb = (TextBox)TestExtensions.GetChildrenByType(nud, typeof(TextBox)), () => tb.Focus(), () => rb = (RepeatButton)TestExtensions.GetChildrenByType(nud, typeof(RepeatButton)), () => rb.Focus(), () => Assert.IsFalse(rb.IsFocused)); }