views:

71

answers:

1

I need the DocumentViewer WPF control (for XPS files) in a Windows Form application. This is actually simple, but I'm not allowed to link in WPF assemblies. My boss' reasoning is that people will start using WPF controls which are incompatible with some of our software. I can't change any of this; it has to be XPS and cannot bring in more than one WPF control. I can use this control if I had a way to link it and only it (no other WPF controls/classes) to our software.

Is it possible for me to write some sort of wrapper on the control in a WPF Class library, and then import that DLL but the DLL does not allow access to other WPF controls? Is there a way for me to extract just that WPF control from the Presentation Framework assembly (probably not, and this sounds like something that violates the EULA)?

Or does anyone have a different approach they would like to suggest?

And no, not PDF please.

A: 

Just make a class library that does nothing but exposes a (Windows Forms) UserControl. Inside of this UserControl, put your ElementHost with the DocumentViewer. This way, you'll only load your project's UserControl, and the "WPF Controls" are isolated in the separate project.

Reed Copsey