FixedDocument and DocumentViewer classes do not expose sufficient public APIs to enable finding and selecting text - by Steve678

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 323452 Comments
Status Resolved Workarounds
Type Suggestion Repros 0
Opened 1/22/2008 7:50:35 AM
Access Restriction Public


We are creating an application which will allow users to read and display 3rd party files such as Word Documents, HTML files, PDF documents and spreadsheets.

We intend to implement this functionality by:
- converting 3rd party files to XPS documents.
- using WPF’s DocumentViewer control to display the resulting XPS document in our application.
- using a custom template to hide the DocumentViewer’s ToolBar and FindToolBar.

This works fine, however, using our application users should also be to:
- highlight text in 3rd party files and launch commands in relation to the highlighted text.
- find words and phrases in 3rd party files, with a GUI that is part of our application and not part of the DocumentViewer window.

These requirements are more challenging  because:
1. TextSelection is not exposed on the DocumentViewer control. There is no programmatic way to get or select the currently selected text.
2. The DocumentViewer control does not provide a public API for its Find functionality.
3. WPF does not provide a public API for finding text inside FixedDocuments.

Are any of the issues (1 to 3) listed above likely to be addressed a future release of WPF?
Sign in to post a comment.
Posted by gstercken on 12/17/2010 at 1:27 AM
Since this is marked resolved as fixed: Is this really fixed in .NET Framework 4.0? If yes, how so?

Posted by stevensrf on 2/17/2010 at 1:49 PM
The DocumentViewerExample.cs is not available for download.
Can you email the DocumentViewerExample.cs document.
My email is
Posted by Microsoft on 3/4/2009 at 3:34 PM

Thanks for the feedback, we will consider this one for future releases.

WPF Team
Posted by mrwhippyicecream on 5/7/2008 at 9:26 AM
I need this. Also, please could Steve678 send me the code (DocumentViewerExample.cs)!. I am trying in vain here to reconstruct what he has done...

MICROSOFT: Can't we just download the attachments that people provide?
Posted by Lakeside Developer on 2/9/2008 at 10:09 PM
I've also tried to get this to work for two weeks now. If someone has figured it out, can you post the source code for us mere mortals?


P.S. Microsoft, please fix ASAP!
Posted by ioana.iacob on 2/1/2008 at 9:30 AM
Hi, I need the text selection functionality too, but I can't find the attached example. Could you please let me know if you still have it.