我可以将数据从 Winforms 传递到 WPF 控件吗?
我有一个 winforms 应用程序,但我想在该应用程序中引入一个 WPF 用户控件,作为进一步 WPF 实现的品尝者。
该控件需要从其主机接收一条信息,即字符串。如何将其从 Winforms 应用程序传递到托管控件?
或者说,我确实可以吗?
I have a winforms app but I would like to introduce a WPF user control into the app as a taster for further WPF implementation.
This control needs to receive from its Host a single piece of information, a string. How can I pass this down from the Winforms app to the hosted control?
Or, indeed, can I?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在创建实例之后和向主机的子级提供引用之前分配 wpf 控件的属性
Assign properties of wpf control after creating an instance and before giving the reference to host's childes
这是可能的。使用方法扩展 WPF 用户控件以设置所需的任何数据并从 WinForms 应用程序中调用它们。例如,请参阅这篇文章。
It is possible. Extend your WPF User Control with methods to set whatever data you want and call them from within WinForms application. See this article for example.