[Settings]Fix blank icon in the taskbar (#38259)

This commit is contained in:
Jaime Bernardo
2025-04-03 01:59:46 +01:00
committed by GitHub
parent 1eccbc3021
commit 7a5b25cd3e
2 changed files with 18 additions and 7 deletions

View File

@@ -41,11 +41,10 @@ namespace Microsoft.PowerToys.Settings.UI
this.InitializeComponent();
// Set window icon
_hWnd = WinRT.Interop.WindowNative.GetWindowHandle(this);
_windowId = Win32Interop.GetWindowIdFromWindow(_hWnd);
_appWindow = AppWindow.GetFromWindowId(_windowId);
_appWindow.SetIcon("Assets\\Settings\\icon.ico");
this.Activated += Window_Activated_SetIcon;
OverlappedPresenter presenter = _appWindow.Presenter as OverlappedPresenter;
presenter.IsMinimizable = false;
@@ -110,6 +109,12 @@ namespace Microsoft.PowerToys.Settings.UI
}
}
private void Window_Activated_SetIcon(object sender, WindowActivatedEventArgs args)
{
// Set window icon
_appWindow.SetIcon("Assets\\Settings\\icon.ico");
}
private void OobeWindow_SizeChanged(object sender, WindowSizeChangedEventArgs args)
{
var dpi = NativeMethods.GetDpiForWindow(_hWnd);