diff --git a/src/modules/MeasureTool/MeasureToolUI/MeasureToolXAML/MainWindow.xaml.cs b/src/modules/MeasureTool/MeasureToolUI/MeasureToolXAML/MainWindow.xaml.cs index 4f807655da..afc59eb8d3 100644 --- a/src/modules/MeasureTool/MeasureToolUI/MeasureToolXAML/MainWindow.xaml.cs +++ b/src/modules/MeasureTool/MeasureToolUI/MeasureToolXAML/MainWindow.xaml.cs @@ -52,12 +52,23 @@ namespace MeasureToolUI var presenter = _appWindow.Presenter as OverlappedPresenter; presenter.IsAlwaysOnTop = true; this.SetIsAlwaysOnTop(true); - this.SetIsShownInSwitchers(false); this.SetIsResizable(false); this.SetIsMinimizable(false); this.SetIsMaximizable(false); IsTitleBarVisible = false; + try + { + this.SetIsShownInSwitchers(false); + } + catch (NotImplementedException) + { + // WinUI will throw if explorer is not running, safely ignore + } + catch (Exception) + { + } + // Remove the caption style from the window style. Windows App SDK 1.6 added it, which made the title bar and borders appear for Measure Tool. This code removes it. var windowStyle = GetWindowLong(hwnd, GWL_STYLE); windowStyle = windowStyle & (~WS_CAPTION);