/// <summary> /// Fires the <i>KeyPress</i> event. /// </summary> /// <param name="e"></param> protected virtual void OnKeyPress(DXKeyboardEventArgs e) { if (this.keyPress != null) { this.keyPress(this, e); } }
void KeyboardActionPerformed(object sender, DXKeyboardEventArgs e) { if (!this.focused) { return; } switch (e.KeyboardAction) { case KeyboardAction.KeyHeld: break; case KeyboardAction.KeyPress: OnKeyPress(e); break; case KeyboardAction.KeyUp: break; } }
/// <summary> /// Handles a key being held down while the <see cref="DXListBox"/> has focus. /// </summary> /// <param name="e"></param> protected override void OnKeyPress(DXKeyboardEventArgs e) { int index = 0; if (this.SelectedItem != null) { index = Items.IndexOf(this.SelectedItem); } if (e.KeyboardState[Key.UpArrow] && index > 0) { index--; this.SelectedItem = this.Items[index]; OnSelectedIndexChanged(); } else if (e.KeyboardState[Key.DownArrow] && index < (this.Items.Count - 1)) { index++; this.SelectedItem = this.Items[index]; OnSelectedIndexChanged(); } base.OnKeyPress(e); }
/// <summary> /// Handles a key being pressed while the <see cref="DXTextBox"/> has focus. /// </summary> /// <param name="e"></param> protected override void OnKeyPress(DXKeyboardEventArgs e) { this.Text += e.Key.ToString(); base.OnKeyPress(e); }