Generally you need to host your form in a WindowInteropHelper,
like following in the WPF window Button.Click event handler:
C#:
private void button1_Click(object sender, RoutedEventArgs e) {
Form1 form = new Form1();
WindowInteropHelper wih = new WindowInteropHelper(this);
wih.Owner = form.Handle;
form.ShowDialog();
}
VB:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
Dim form As New Form1()
Dim wih As New WindowInteropHelper(Me)
wih.Owner = Form.Handle
form.ShowDialog()
End Sub
And of course you need to add reference/import of your project and System.Windows.Forms.dll
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…