private void HandleSuggestionSelected(RecommendedDpendencyInfo item) { if (item == null) { return; } DependencyIdTextBox.Text = item.DependencyId; SuggestionsBox.Visibility = Visibility.Collapsed; DependencyIdTextBox.SelectionStart = item.DependencyId.Length; DependencyIdTextBox.Focus(); }
private void OnSuggestionKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Up && SuggestionsBox.SelectedIndex <= 0) { SuggestionsBox.SelectedItem = null; DependencyIdTextBox.Focus(); } if ((e.Key == Key.Enter || e.Key == Key.Tab) && SuggestionsBox.SelectedIndex >= 0) { var item = SuggestionsBox.SelectedItem as RecommendedDpendencyInfo; HandleSuggestionSelected(item); } }