Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

WPF: Find elements of specific type in FlowDocument

Back to Forum: Tech Off
  • User profile image
    Bas

    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?

  • User profile image
    spivonious

    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.

  • User profile image
    footballism

    spivonious said:

    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

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.