Hello,
Notepad++ (and other editors) have a feature where you can select a term and all instance/occurrences of this term in the document are highlighted as well.
Is this also possible in the SyntaxEditor and can this be implemented in a similar fassion. I am using the Visual basic and the CSharp syntax highlighting.
There is a functionality called HighlightAllMatches but I don't really know if this is the right method or how to Trigger it correctly.
Thanks for your time.
5 Answers, 1 is accepted
Hello Ben,
Indeed, it is possible to highlight a certain word by using either the TextSearchUnderlineTagger or TextSearchHighlightTagger and utilizing their UpdateSearchWord method. A good example of how this can be implemented can be observed in the Taggers demo from our WPF Controls Samples demo application.
Can you please have a look and let me know if any of these two taggers will work for you? I will be awaiting your reply.
Regards,
Dilyan Traykov
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Hallo Dilyan,
this seems to be exactly what I am looking for. I will go on vacation soon so I will test it later.
Thank you,
Ben
Hello Ben,
Do let me know once you manage to test this out. I will be awaiting your reply.
Have a nice vacation!
Regards,
Dilyan Traykov
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Hello,
It works like a charm:
this
.selectionWordTagger =
this
.syntaxEditor.TaggersRegistry.GetTaggers<TextHighlightTag().OfType<TextSearchHighlightTagger>().First();
this
.syntaxEditor.Selection.SelectionChanged +=
this
.OnSelectionChanged;
private
void
OnSelectionChanged(
object
sender, EventArgs e)
{
if
(!
this
.syntaxEditor.Selection.IsEmpty)
{
string
searchedWord =
this
.syntaxEditor.Selection.GetSelectedText();
if
(!
string
.IsNullOrWhiteSpace(searchedWord))
{
this
.selectionWordTagger.UpdateSearchWord(searchedWord);
}
}
else
{
this
.selectionWordTagger.UpdateSearchWord(
string
.Empty);
}
}
This is all you need from the example.
Hello Ben,
I'm glad to hear that you've managed to achieve the desired result and would like to thank you for sharing your approach with our community.
Regards,
Dilyan Traykov
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.