Beispiel #1
0
 private void TextBox_Search_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Down)
     {
         if (SearchResults != null && SearchResults.Count > 0)
         {
             if (SearchView.SelectedIndex == -1)
             {
                 SearchView.SelectedIndex = 0;
             }
             else if (SearchView.SelectedIndex < SearchResults.Count - 1)
             {
                 SearchView.SelectedIndex += 1;
                 SearchView.ScrollIntoView(SearchView.SelectedItem);
             }
         }
     }
     else if (e.Key == Key.Up)
     {
         if (SearchResults != null && SearchResults.Count > 0)
         {
             if (SearchView.SelectedIndex > 0)
             {
                 SearchView.SelectedIndex -= 1;
                 SearchView.ScrollIntoView(SearchView.SelectedItem);
             }
         }
     }
     else if (e.Key == Key.Enter)
     {
         if (SearchView.SelectedItem != null)
         {
             EndSearch(null);
         }
     }
 }