WinForm C中的WPF控件托管# [英] WPF control hosting in WinForm C#

查看:125
本文介绍了WinForm C中的WPF控件托管#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用WinForm控件在C#中开发触摸屏应用程序。

我面临一个很大的挑战,即提供具有漂亮Scroll面板控件的GUI。

是否有可能在WinForm 中托管 WPF-Scroller控件并在该WPF-Scroller控件中添加其他WinForm控件。

任何代码示例都将是一个很好的帮助。

I am developing a touchscreen application in C# using WinForm controls.
I am facing a big challenge to provide GUI with nice Scroll panel control.
Is it possible that to host WPF-Scroller Control in WinForm and to add other WinForm controls in that WPF-Scroller control.
Any code example will be a great help.

推荐答案

是的。请参阅:演练:在Windows窗体中托管WPF复合控件 [ ^ ]。



-SA
Yes. Please see: Walkthrough: Hosting a WPF Composite Control in Windows Forms[^].

—SA


到目前为止你尝试了什么?...



在WinForms设计器中,有一个 ElementHost [ ^ ]组件在表单中托管WPF用户控件。在WPF中,您有 WindowsFormsHost [ ^ ]组件。



因此很容易拥有你想要的东西。但是,您必须尝试并确保获得满意的结果,因为可能会出现一些问题,具体取决于您要实现的复杂性......



因为这可以通过将组件从工具箱拖到设计器上来完成,所以没有任何代码可以显示......



您可以随时查看 WindowsFormsHost控件 - 完整的WPF教程 [ ^ ]。
What have you tried so far?...

In WinForms designer, there is a ElementHost [^] component to Host a WPF user control in your form. In WPF, you have WindowsFormsHost[^] component to host a WinForms user control.

Thus it really easy to have what you want. However, you have to try it and ensure that you get satisfactory results as the might be some issues depending on the complexity of what you are trying to achieve...

As this can be done mostly by dragging component from the toolbox onto the designer, there are not really any code to show...

You can always look at The WindowsFormsHost control - The complete WPF tutorial[^] for some code.


这篇关于WinForm C中的WPF控件托管#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆