WPF TextBlock highlight certain parts based on search condition

This question is similar to How to display search results in a WPF items control with highlighted query terms

In answer to that question, I came up with an approach that uses an IValueConverter. The converter takes a text snippet, formats it into valid XAML markup, and uses a XamlReader to instantiate the markup into framework objects.

The full explanation is rather long, so I’ve posted it to my blog: Highlighting Query Terms in a WPF TextBlock

Leave a Comment