From abb90d57c43c3f5f45e1745aec634d0e9c099751 Mon Sep 17 00:00:00 2001 From: Andreas Date: Thu, 21 Nov 2024 13:29:12 +0100 Subject: [PATCH] Switched to `CreateWindow(IActivationState? activationState)` Fixed #588 --- src/SharedMauiXamlStylesLibrary.SampleApp/App.xaml.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/SharedMauiXamlStylesLibrary.SampleApp/App.xaml.cs b/src/SharedMauiXamlStylesLibrary.SampleApp/App.xaml.cs index cc28d2af..59b05086 100644 --- a/src/SharedMauiXamlStylesLibrary.SampleApp/App.xaml.cs +++ b/src/SharedMauiXamlStylesLibrary.SampleApp/App.xaml.cs @@ -5,17 +5,22 @@ namespace SharedMauiXamlStylesLibrary.SampleApp { public partial class App : Application { + public static IServiceProvider? ServiceProvider; + public App(IServiceProvider serviceProvider) { + ServiceProvider = serviceProvider; SecretAppSetting secrets = SecretAppSettingReader.ReadSection("ExampleApp"); if (secrets is not null) { SyncfusionLicenseProvider.RegisterLicense(secrets.SyncfusionApiKey); } InitializeComponent(); - - // Workaroung: https://github.com/dotnet/maui/issues/11485#issuecomment-1416689085 - MainPage = serviceProvider.GetRequiredService(); + } + protected override Window CreateWindow(IActivationState? activationState) + { + AppShell? page = ServiceProvider?.GetRequiredService(); + return new Window(page ?? new AppShell()); } } } \ No newline at end of file