void Activity_KeyDown(object sender, KeyEventArgs e) { string compareText = Activity.Text.Trim(); if (e.Key == Key.Enter) { if (!String.IsNullOrEmpty(compareText)) { if (SelectedItems.Items.Count != 0) { compareText = SelectedItems.Items[0].ToString(); } SaveItem(compareText); e.Handled = true; } } else if (e.Key == Key.Down) { SelectedItems.Focus(); SelectedItems.SelectedIndex = 0; e.Handled = true; } else if (e.Key == Key.Up) { SelectedItems.Focus(); SelectedItems.SelectedIndex = SelectedItems.Items.Count - 1; e.Handled = true; } }