Hosting WPF controls in Winforms

2019-06-22 06:03发布

My Application is developed using WinForms. Is it possible to host the WPF DataGrid, Button, ListBox, ComboBox etc in WinForms User Controls?

2条回答
家丑人穷心不美
2楼-- · 2019-06-22 06:35

Yes, it's possible using the ElementHost control in Winforms and hosting WPF content inside of it.

查看更多
干净又极端
3楼-- · 2019-06-22 06:42

I would not mix WinForm and WPF unless absolutely necessary. Though, Microsoft has provided the way to use WPF control in WinForm and vice-versa but it doesn't always give good result. WF and WPF renders the controls in different ways and you may face multiple issues including performance and UI flickering depending on the way they have been used.

If you really want to use WPF control in WF then use ElementHost control.

ElementHost.Child = wpfControl;
查看更多
登录 后发表回答