PowerToys/doc/devdocs/settingsv2/xaml-island-tweaks.md
Alekhya 18eb6b4ffd
Dev documentation of SettingsV2 (#7335)
* created a folder for settings and added an overview, hotkey information

* basic structure for communication between settings and runner

* Added information about the IPC communication between settings and runner

* Added information about the communication between the settings process and modules

* Added details on backward compatibility

* brief overview on settings utils

* added an overview of the viewmodels and anomalies

* minor modifications

* Settings v2 dev docs (#7334)

* Added settings architecture and tech stack dev docs

* Added telemetry and updated architecture docs for settings v2

* Fix image link in ui_architecture markdown

* Added table of contents for settings v2

* Correct file path for ui architecture image

* nit fix in table of contents heading

* Add doc for xaml island tweaks

Co-authored-by: Divyansh Srivastava <somm14divi@gmail.com>
2020-10-20 14:28:06 -07:00

1.4 KiB

XAML Island Tweaks

Few tweaks were made to fix issues with Xaml Islands. These tweaks should be removed after migrating to WINUI3. The tweaks are listed below:

  1. Workaround to ensure XAML Island application terminates if attempted to close from taskbar while minimized:
private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
    isOpen = false;

    // XAML Islands: If the window is closed while minimized, exit the process. Required to avoid process not terminating issue - https://github.com/microsoft/PowerToys/issues/4430
    if (WindowState == WindowState.Minimized)
    {
        // Run Environment.Exit on a separate task to avoid performance impact
        System.Threading.Tasks.Task.Run(() => { Environment.Exit(0); });
    }
}
  1. Workaround to hide the XAML Island blank icon in the taskbar when the XAML Island application is loading:
var coreWindow = Windows.UI.Core.CoreWindow.GetForCurrentThread(); 
var coreWindowInterop = Interop.GetInterop(coreWindow); 
Interop.ShowWindow(coreWindowInterop.WindowHandle, Interop.SW_HIDE); 
  1. Workaround to prevent XAML Island failing to render on Nvidia workstation graphics cards:
 // XAML Islands: If the window is open, explicity force it to be shown to solve the blank dialog issue https://github.com/microsoft/PowerToys/issues/3384 
 if (isOpen) 
 { 
     Show(); 
 }