using Windows.ApplicationModel.Activation; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; namespace SampleApplication { public sealed partial class App : Application { public App() { InitializeComponent(); } protected override void OnLaunched(LaunchActivatedEventArgs e) { if (Window.Current.Content is not Frame rootFrame) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage), e.Arguments); } Window.Current.Activate(); } } } }