
I'm attempting to implement searching like in Chrome or Safari - basically a text field where the user can start typing and then dynamically highlight the found elements in the document. Doing the dynamic search is easy
But I'm not sure how ( assuming it's possible ) to highlight the results. Ideally I'd like to dim the document like Safari does but if that's not possible then just highlighting the found items would work.
Once I've highlighted the found items, I'll need to be able to allow the user to jump to the next found item with a button.
Any pointers to accomplishing this task would be great.
private void _FindText_TextChanged(object sender, TextChangedEventArgs e)
{
string text = _FindText.Text;
if (!string.IsNullOrEmpty(text))
{
EditorSearchOptions options = new EditorSearchOptions()
{
FindText = _FindText.Text
};
int count = 0;
foreach (var res in _Editor.Document.CurrentSnapshot.FindAll(options).Results)
{
count++;
}
_Output.Text = string.Format("{0} items found", count);
}
else
{
_Output.Text = "0 items found";
}
}
}
Once I've highlighted the found items, I'll need to be able to allow the user to jump to the next found item with a button.
Any pointers to accomplishing this task would be great.