是否可以组合Winform项目和wpf项目

问题描述:

我有要求

1.我在winform中的项目

2.我必须在wpf中获得所有第三方控制(对于具有流程图的文字编辑器)。为此,我在wpf项目中添加了所有第三个项目。

3.现在我在winform项目中添加了wpf项目的引用

4.现在我想要一些数据发回到从wpf项目中获取winform以及在这两个项目之间共享的一些常见文件夹。

5.我怎样才能实现这个目标?

6.添加wpf这是常见的方法吗? winform中的项目?

7.此外,我无法在winform中托管wpf,因为它会导致第三方控件(Teleriks)无法正常工作等其他问题。从winform到windows ..

i have requirement
1. My project in winform
2. I have to get all third party control in wpf (For word editor having flowchart). For that I add all third project in wpf project.
3. Now I added reference of wpf project in winform project
4. Now I want some data back to send to winform from wpf project and also some common folders to shares in between these two projects .
5. How could i achieve this?
6. Is this common methodolgies to add wpf project in winform ?
7. Also I cant host wpf in winform as it causes another problems like third party control (Teleriks ) is not working prooperly.Accessing from winform to windows ..

是的,您可以在WPF窗口中托管 System.Windows.Forms 控件或在窗体中托管WPF控件,但除非急需,否则我不建议采取任何这些方式;由于这些库的性质非常不同,这种互操作性非常复杂。可以说WPF与Windows API几乎没有关系;它基于DirectX,它的控件不使用Windows消息泵,不能直接与HWND交互...



如果从这里开始,你可以找到所有的信息:

WPF和Windows窗体互操作

Windows窗体和WPF互操作性输入架构

托管Windows WPF中的表单控件

在Windows窗体中托管WPF控件



-SA
Yes, you can either host a System.Windows.Forms control in WPF window or host a WPF control in a form, but I would not advise to go any of these ways unless it is badly needed; this interoperability is extremely complex, due to very different nature of these libraries. It would be enough to say that WPF has little to do with Windows API; it is based on DirectX, its control don't use Windows message pumping and cannot directly interact with HWNDs…

You can find all the information if you start here:
WPF and Windows Forms Interoperation,
Windows Forms and WPF Interoperability Input Architecture,
Hosting Windows Forms Controls in WPF,
Hosting WPF Controls in Windows Forms.

—SA