WinUI Extensions
A set of extension methods and classes to fill some gaps in WinUI 3, mostly around windowing.
To get the extension methods, first add using WinUIEx; to the top of your code.
- Minimize/Maximize/Restore and Hide window.
myWindow.MinimizeWindow();
myWindow.MaximizeWindow();
myWindow.RestoreWindow();
myWindow.HideWindow();`- Move and resize window
myWindow.CenterOnScreen();
myWindow.SetWindowPositionAndSize(100, 100, 1024, 768);- Make Window always-on-top
myWindow.SetAlwaysOnTop(true);- Bring window to the top
myWindow.BringToFront();- Remove Window chrome buttons
Make your window class inherit from WinUIEx.WindowEx instead, and set properties IsCloseButtonVisible, IsMaximizeButtonVisible, IsMinimizeButtonVisible
- Create a Tray Icon
var icon = Icon.FromFile("Images/WindowIcon.ico");
tray = new TrayIcon(icon);
tray.TrayIconLeftMouseDown += (s, e) => this.BringToFront();And more to come...