Winform用WPF控件(UserControl)关闭父窗体

Winform里:

ElementHost elementHost1 = new ElementHost ();

UserControl1 us;   //WPF控件

us = new UserControl1();

elementHost1.Child = us;

us.ParentForm = this;

 

UserControl1 里要关闭 Winform:

public System.Windows.Forms.Form ParentForm{get;set;}

在要用到的地方就可以用:

this.ParentForm.Close();

posted @ 2011-08-08 14:06  therockthe  阅读(1623)  评论(0)    收藏  举报