Highlight parts of text in FlowDocument
问题 I want to highlight some parts of text in a FlowDocument based on the search results. What I am doing is getting the indexes where the searched word occures in the text of the FlowDocument and then apply background color on the text range starting at the found index, ending at the found index + search word length. TextRange content = new TextRange(myFlowDocument.ContentStart, myFlowDocument.ContentEnd); List<int> highlights = GetHighlights(content.Text, search); foreach (int index in