Posted By: Bas | Aug 29th @ 2:52 AM
page 1 of 1
Comments: 2 | Views: 414
Bas
Bas
It finds lightbulbs.

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.

footballism
footballism
Another Paradigm Shift!

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

page 1 of 1
Comments: 2 | Views: 414
Microsoft Communities