在 WinForms 中集成 WPF 控件而不允许访问其他 WPF 控件?

发布于 2024-09-10 02:50:00 字数 360 浏览 2 评论 0原文

我需要 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江挽川 2024-09-17 02:50:00

只需创建一个除了公开(Win​​dows 窗体)用户控件之外不执行任何操作的类库。在此 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文