0

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.

Kizaru
  • 2,443
  • 3
  • 24
  • 39
  • Don't worry, you'll get your answer accepted in like 20 seconds. I didn't accept the others because I never really got a great answer, but I think it's because I wasn't specific in my questions. – Kizaru Jul 16 '10 at 01:09
  • I don't really care for me - Just so you know, though, having a very low rate like that tends to get you fewer answers (I answer in any case - but I don't need the rep.) – Reed Copsey Jul 16 '10 at 01:12

1 Answers1

1

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
  • 554,122
  • 78
  • 1,158
  • 1,373