private void OnTabSelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count < 1) { return; } if (!(e.AddedItems[0] is Microsoft.Toolkit.Uwp.UI.Controls.TabViewItem newtab)) { return; } var content = newtab.Content; // Save the tab settings var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; localSettings.Values[CURR_P1_TAB] = newtab.Tag as string; if (content is WebSearch ws) { Nav.AddSelectTo(Navigator.NavigateControlId.WebSearchDisplay, ws); } else { Nav.RemoveSelectTo(Navigator.NavigateControlId.WebSearchDisplay); } ; }