Created
June 3, 2022 13:52
-
-
Save emoacht/195e6c34ee935726b3fcdbc6cd9bc043 to your computer and use it in GitHub Desktop.
Set owner window before .NET 5.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ComImport] | |
[Guid("3E68D4BD-7135-4D10-8018-9FB6D9F33FA1")] | |
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] | |
public interface IInitializeWithWindow | |
{ | |
void Initialize(IntPtr hwnd); | |
} | |
public void SetOwnerWindow(StoreContext context, Window window) | |
{ | |
var handle = new WindowInteropHelper(window).Handle; | |
var initWindow = (IInitializeWithWindow)(object)context; | |
initWindow.Initialize(handle); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment