How Can I Get a TextPointer from a mouse click in a FlowDocument

Posted by Bear on Stack Overflow See other posts from Stack Overflow or by Bear
Published on 2010-06-05T20:05:00Z Indexed on 2010/06/05 20:22 UTC
Read the original article Hit count: 228

Filed under:
|
|

I would like to get the word that a user has clicked on in a FlowDocument.

I am currently adding an event handler to every Run in the document and iterating through the TextPointers in the Run that was clicked, calling GetCharacterRect() on each one and checking if the rectangle contains the point.

However, when the click occurs near the end of a long Run this takes > 10 seconds.

Is there any more efficient method?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wpf