在 WinForms 中集成 WPF 控件而不允许访问其他 WPF 控件?
我需要 Windows 窗体应用程序中的 DocumentViewer WPF 控件(用于 XPS 文件)。这实际上很简单,但我不允许在 WPF 程序集中链接。我老板的理由是人们将开始使用与我们的某些软件不兼容的 WPF 控件。我无法改变这一切;它必须是 XPS 并且不能引入多个 WPF 控件。如果我有办法将它并且仅将它(没有其他 WPF 控件/类)链接到我们的软件,我就可以使用该控件。
我是否可以在 WPF 类库中的控件上编写某种包装器,然后导入该 DLL,但该 DLL 不允许访问其他 WPF 控件?有没有办法让我从演示框架程序集中提取 WPF 控件(可能不会,这听起来违反了 EULA)?
或者有人有不同的方法可以建议吗?
不,请不要使用 PDF。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需创建一个除了公开(Windows 窗体)用户控件之外不执行任何操作的类库。在此 UserControl 内部,将 ElementHost 与 DocumentViewer 放在一起。这样,您将只加载项目的 UserControl,并且“WPF 控件”被隔离在单独的项目中。
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.