15 lines
505 B
C#
15 lines
505 B
C#
using Microsoft.UI.Xaml;
|
|
|
|
namespace Lattice.Example.DragDrop;
|
|
|
|
public static class WindowExtensions
|
|
{
|
|
public static void SetWindowSize(this Window window, int width, int height)
|
|
{
|
|
var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(window);
|
|
var windowId = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(hwnd);
|
|
var appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(windowId);
|
|
|
|
appWindow.Resize(new Windows.Graphics.SizeInt32(width, height));
|
|
}
|
|
} |