I am writing code Highlight Searched Text with ListView in WPF.
The problem is that when I search a specific word, only match words in the screen visible are hightlighted but the other words in
listviewItems that should be highlighted which are located in the bottom of the listview are not highlighted.
After I run the program and I scroll down manually to the bottom in the list view and when I search the word, then it works well.
What I have tried:
To solve the problem, I added the code like below. Listview scrolls down and up properly like I intented to but the listItems does not highlight still.
// scroll to bottom for the list to make sure every item is in the view
if (listview.Items.Count > 1) listview.ScrollIntoView(listview.Items[listview.Items.Count - 1]);
// scroll back to top to make sure everything looks correct
if (listview.Items.Count > 1) listview.ScrollIntoView(listview.Items);