protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); await BrowserWindow.EnsureCoreWebView2Async(); defaultUA = BrowserWindow.CoreWebView2.Settings.UserAgent; BrowserWindow.CoreWebView2.ContainsFullScreenElementChanged += BrowserWindow_ContainsFullScreenElementChanged; if (e.Parameter is Uri) // Protocol launch { string param = ((Uri)e.Parameter).AbsoluteUri; string uri = Uri.UnescapeDataString(param.Split('=')[1]); AddressBox.Text = uri; OpenBrowser(); // Change to CompactOverlay mode automatically var applicationView = ApplicationView.GetForCurrentView(); ViewModePreferences compactOptions = ViewModePreferences.CreateDefault(ApplicationViewMode.CompactOverlay); compactOptions.CustomSize = new Windows.Foundation.Size(500, 500); // Max size bool modeSwitched = await applicationView.TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay, compactOptions); if (modeSwitched) { // modeSwitched is sometimes false. Why? AOTButton.Visibility = Visibility.Collapsed; BackButton.Visibility = Visibility.Visible; } } }