Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The main problem will the ability to instantiate the Windows Forms window and set it's owner to that of the WPF window. The Winforms will want a IWin32Window which a WPF window isn't. To get around this, you need to make a custom class.</p> <p>I found this code on Mark Rendle's blog (I've copied it here as I had to use the Google Cache to access the page). <a href="http://blog.markrendle.net/post/WPF-Windows-Forms-interop-ShowDialog-extension-method.aspx" rel="nofollow noreferrer">LINK</a> - WARNING: May not work</p> <pre><code>class Shim : IWin32Window { public Shim(System.Windows.Window owner) { // Create a WindowInteropHelper for the WPF Window interopHelper = new WindowInteropHelper(owner); } private WindowInteropHelper interopHelper; #region IWin32Window Members public IntPtr Handle { get { // Return the surrogate handle return interopHelper.Handle; } } #endregion } </code></pre> <p>and it's method of use:</p> <pre><code>namespace System.Windows.Forms { public static class WPFInteropExtensions { public static DialogResult ShowDialog( this System.Windows.Forms.Form form, System.Windows.Window owner) { Shim shim = new Shim(owner); return form.ShowDialog(shim); } } } </code></pre> <p>I haven't tested this code, but reading around the internet, it appears that you can host Winforms windows inside of a WPF app.</p> <p>I just found <a href="http://msdn.microsoft.com/en-us/library/ms752055.aspx" rel="nofollow noreferrer">this</a> link on MSDN that has a very detailed description of how to interop a Win32 control/window in a WPF application.</p> <p>Hope these help you out.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload