Hi
We have a rather big Windows Forms Application.
Now we want to gradually develop new features in WPF windows, within our Windows Forms Application.
Everything works fine, except that the WPF windows are always on top of the older WinForm windows.
And it is impossible to drag an activated WinForm window on top of a WPF window.
Both are not modal forms, so our users need to be able to put one WinForm on top of the WPF window, switching between the WinForm and the WPF window.
I suspect it has something to do with the MdiParent I have in my Windows Forms Application and the fact that you can not set a WPF window to that MdiParent??
Any help would be much appreciated!
Thanks,
Sarah
What I have tried:
This is how a WPF window, in this example frmArchiefonderdeel, is called:
Dim oFrmArchiefOnderdeel As New frmArchiefonderdeel With {.oSharedData = oSharedData}
oFrmArchiefOnderdeel.Show(Me)
<Extension()> Public Sub Show(wn As Windows.Window, owner As Windows.Forms.Form)
BMFUtility.SetOwner(owner, wn)
ElementHost.EnableModelessKeyboardInterop(wn)
AddHandler wn.Closed, AddressOf WindowClosed
wn.ShowInTaskbar = False
wn.Show()
End Sub
Public Shared Sub SetOwner(owner As System.Windows.Forms.Form, wpfWindow As System.Windows.Window)
Dim helper As New WindowInteropHelper(wpfWindow)
helper.Owner = owner.Handle
End Sub
And this is how an older WinForm, in this example frmBDGMonitor, is called:
Dim oFrmBDGMonitor As frmBDGMonitor
oFrmBDGMonitor = New frmBDGMonitor
oFrmBDGMonitor.ShowInTaskbar = False
oFrmBDGMonitor.MdiParent = Me
oFrmBDGMonitor.Show()