コード例 #1
0
        private void HandleSuggestionSelected(RecommendedDpendencyInfo item)
        {
            if (item == null)
            {
                return;
            }

            DependencyIdTextBox.Text           = item.DependencyId;
            SuggestionsBox.Visibility          = Visibility.Collapsed;
            DependencyIdTextBox.SelectionStart = item.DependencyId.Length;
            DependencyIdTextBox.Focus();
        }
コード例 #2
0
        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);
            }
        }