protected override void OnKeyPress(KeyPressEventArgs e) { switch (e.uwfKeyArgs.KeyCode) { case Keys.Down: case Keys.Right: SelectItem(SelectedIndex + 1); break; case Keys.Left: case Keys.Up: SelectItem(SelectedIndex - 1); break; case Keys.PageDown: SelectItem(SelectedIndex + visibleItemsCount - 1); break; case Keys.PageUp: SelectItem(SelectedIndex - visibleItemsCount + 1); break; case Keys.Home: SelectItem(0); break; case Keys.End: SelectItem(Items.Count - 1); break; default: // Key filter. char c = KeyHelper.GetLastInputChar(); if (char.IsLetterOrDigit(c) || char.IsPunctuation(c)) { keyFilter += char.ToLower(c); var itemIndex = FindItemIndex(x => x != null && x.ToString().ToLower().StartsWith(keyFilter)); SelectItem(itemIndex); if (keyFilterIA == null) { keyFilterIA = Unity.API.UnityWinForms.Invoke(ResetKeyFilter, keyFilterResetTime); } keyFilterIA.Seconds = keyFilterResetTime; } break; } }
private void ResetKeyFilter() { keyFilter = ""; keyFilterIA = null; }