Exemplo n.º 1
0
 /// <summary>
 /// Hightlight text using a <see cref="FindResult"/>'s Start/length
 /// </summary>
 /// <param name="result"></param>
 public void Hightlight(FindResult result)
 {
     try
     {
         if (findList.ItemsSource is ObservableCollection <FindResultItem> items)
         {
             if (findList.SelectedItem is FindResultItem fri)
             {
                 int itemIndex = findList.SelectedIndex;
                 items.Remove(fri);
                 items.Insert(itemIndex, fri);
                 MainTextBox.HighlightSearchResult(result);
             }
         }
     }
     catch (Exception e)
     {
         MessageBox.Show($"Failed to highlight text: {e.Message}");
     }
 }