Put WPF control into a Windows Forms Form

前端 未结 3 873
野的像风
野的像风 2020-11-27 21:00

How do you put a WPF control into a Windows Forms Form? Most likely I will be inserting my WPF control into a Windows.Forms.Panel.

3条回答
  •  悲哀的现实
    2020-11-27 21:11

    Put an ElementHost control inside the panel. This control can then host a WPF element. From the WinForms designer, you can find this control under 'WPF Interoperability'. First you may need to add WindowsFormsIntegration.dll to your project's references.

    For an example, see Walkthrough: Hosting a WPF Composite Control in Windows Forms.

提交回复
热议问题