Winform 添加wpf用户控件

1.在Winform项目中添加Wpf控件的引用。可以引用dll文件,也可以引用wpf 用户控件原项目。

2.在Winform窗口中添加ElementHost控件,并给ElementHost控件设置name,elementHost1
3.在Form构造函数中实例化WPF用户控件,并添加到ElementHost控件中。
        public Form1()
        {
            InitializeComponent();
           SingleViewWithROI.SingleViewWithRoi edit = new SingleViewWithROI.SingleViewWithRoi();
            elementHost1.Child = edit;
        }
posted @ 2020-09-02 18:05  荼离伤花  阅读(698)  评论(0编辑  收藏  举报