private void ToggleSwitch_KeyUp(object sender, Input.KeyEventArgs e) { if (e.Key == Input.Key.Space) { this.SetValue(ToggleSwitch.IsCheckedProperty, !IsChecked); } }
/// <summary> /// Overrides <see cref="View.OnKeyDown(Input.KeyEventArgs)" /> /// </summary> protected internal override void OnKeyDown(Input.KeyEventArgs e) { if (e.VirtualKeyCode == Presentation.VirtualKeyCode.Space) { OnActivated(EventArgs.Empty); } }
/// <summary> /// Event handler for when a key is pressed within the Hex RGB value TextBox. /// This is used to trigger re-evaluation of the color based on the TextBox value. /// </summary> private void HexTextBox_KeyDown(object?sender, Input.KeyEventArgs e) { if (e.Key == Input.Key.Enter) { GetColorFromHexTextBox(); } }
private void Thumb_KeyDown(object sender, Input.KeyEventArgs e) { if (e.Key == Key.Right || e.Key == Key.Up) { OnClickOnSmallOrLargeDecreaseIncreaseButtons(SmallChange, ScrollEventType.SmallIncrement); } else if (e.Key == Key.Left || e.Key == Key.Down) { OnClickOnSmallOrLargeDecreaseIncreaseButtons(-SmallChange, ScrollEventType.SmallDecrement); } }
private void comboBox_KeyDown(object sender, Input.KeyEventArgs e) { switch (e.Key) { case Input.Key.Escape: Exit(false); break; case Input.Key.Enter: Exit(true); break; default: return; } e.Handled = true; }
protected override void OnKeyDown(Input.KeyEventArgs e) { base.OnKeyDown(e); if (NavigationTriggerMode == Controls.NavigationTriggerMode.ArrowKeys) { if (e.Key == Input.Key.Left) { NavigateToPreviousPage(); } else if (e.Key == Input.Key.Right) { NavigateToNextPage(); } } }