Insert a Hyperlink at a specified position in a WPF FlowDocument
问题 I'd like to insert a WPF Hyperlink element into a FlowDocument programmatically. The objective is to create a toolbar button that would take a run of text within a RichTextBox and replace it with a Hyperlink. It's the same sort of interface you see on the web for creating hyperlinks on wikis or in blogs (or on StackOverflow). I can find the TextRange of the selected text like this: TextRange tr = new TextRange( MyRichTextBox.Selection.Start, MyRichTextBox.Selection.End); And I'm attempting to