I'm trying to gather all hyperlinks from a RichTextBox in WPF, but the whole FlowDocument class is an enigma. I can find ways to find elements by name and resources by key, but I can't find any way to simply return a collection of all HyperLink comments
in the document, or even in each of the document's Blocks. Is there a way to do this?

If the current Block is a Paragraph, you could check it's Inlines property for any Hyperlink objects.

I don't think FlowDocument is designed to be that interactive.

If I remember correctly, HyperLinks will be part of the logical tree of FlowDocument, so a simple pre-order traversal over the logical tree starting from the FlowDocument down to the reaf element should do the trick.

Yong

Thread Closed

This thread is kinda stale and has been closed but if you'd like to continue the conversation,
please create a new thread in our Forums, or
Contact Us and let us know.