示例#1
0
 /// <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);
     }
 }
示例#2
0
        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;
            }
        }
示例#3
0
        /// <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);
        }
示例#4
0
 /// <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);
 }