/// <summary>Gets the IWin32 window.</summary> /// <param name="visual">The visual object.</param> /// <returns>The Win32 Window.</returns> internal static IWin32Window GetIWin32Window(this Visual visual) { var source = PresentationSource.FromVisual(visual) as HwndSource; if (source != null) { var win = new Win32Window(source.Handle); Win32Window window = win; win.Dispose(); return window; } return null; }