From 5a10c2c8b45ce06f81bbffbc4daa8185afb63c67 Mon Sep 17 00:00:00 2001 From: Nick Randolph Date: Mon, 28 Aug 2023 19:18:28 +1000 Subject: [PATCH 1/3] fix: Prevent duplicate CreateOnUpdateMetadataAttribute attributes (cherry picked from commit ce1ce468d3314768a2e65d0b0be877b31e8d9027) --- src/Directory.Build.props | 2 ++ .../buildTransitive/Uno.Extensions.Core.props | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index d380544ac2..8d9d23f88f 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -22,6 +22,8 @@ true true + + True diff --git a/src/Uno.Extensions.Core.Generators/buildTransitive/Uno.Extensions.Core.props b/src/Uno.Extensions.Core.Generators/buildTransitive/Uno.Extensions.Core.props index 430be83525..ff09f76930 100644 --- a/src/Uno.Extensions.Core.Generators/buildTransitive/Uno.Extensions.Core.props +++ b/src/Uno.Extensions.Core.Generators/buildTransitive/Uno.Extensions.Core.props @@ -1,12 +1,20 @@ - - - + + + + + - + + + + + + + From 9a62745af587a347a45e06d8944303b4cafdc253 Mon Sep 17 00:00:00 2001 From: Nick Randolph Date: Mon, 28 Aug 2023 19:19:38 +1000 Subject: [PATCH 2/3] fix: Setting parent to be Window enables loaded event in maui (cherry picked from commit 1aadb97460352cc5cc24c243925ca44930e0faaa) --- .../SyncfusionDemoPage.xaml.cs | 9 +++++++++ src/Uno.Extensions.Maui.UI/MauiHost.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml.cs b/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml.cs index 85d8c54bb4..cccc9e3a73 100644 --- a/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml.cs +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml.cs @@ -5,5 +5,14 @@ public partial class SyncfusionDemoPage : ContentPage public SyncfusionDemoPage() { InitializeComponent(); + + Loaded += SyncfusionDemoPage_Loaded; + } + + private void SyncfusionDemoPage_Loaded(object sender, EventArgs e) + { + var pv = Window?.Handler?.PlatformView; + var hpv = Handler?.PlatformView; + } } diff --git a/src/Uno.Extensions.Maui.UI/MauiHost.cs b/src/Uno.Extensions.Maui.UI/MauiHost.cs index c9b0c0e59a..f4cdb5e9bd 100644 --- a/src/Uno.Extensions.Maui.UI/MauiHost.cs +++ b/src/Uno.Extensions.Maui.UI/MauiHost.cs @@ -49,7 +49,7 @@ dependencyObject is not MauiHost mauiHost || if(instance is VisualElement visualElement) { mauiHost.VisualElement = visualElement; - visualElement.Parent = app; + visualElement.Parent = app.Windows[0]; visualElement.BindingContext = mauiHost.DataContext; } else From 76b031d5ad3b5770633941fe83f3e88debf68d71 Mon Sep 17 00:00:00 2001 From: Nick Randolph Date: Mon, 28 Aug 2023 20:26:50 +1000 Subject: [PATCH 3/3] fix: Registering for activation - required to set displayinformation from window (cherry picked from commit e1cb19bef708400178b2dbbf5c9e824fdeb3b3f4) --- .../SyncfusionDemoPage.xaml.cs | 1 + src/Uno.Extensions.Maui.UI/MauiEmbedding.cs | 12 +++++++++++- src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs | 5 ----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml.cs b/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml.cs index cccc9e3a73..55e5b09c92 100644 --- a/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml.cs +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml.cs @@ -14,5 +14,6 @@ private void SyncfusionDemoPage_Loaded(object sender, EventArgs e) var pv = Window?.Handler?.PlatformView; var hpv = Handler?.PlatformView; + var current = DeviceDisplay.Current; } } diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.cs index 4921f32d1a..bfd4404b20 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Maui.ApplicationModel; using Uno.Extensions.Hosting; namespace Uno.Extensions.Maui; @@ -91,6 +92,15 @@ public static Microsoft.UI.Xaml.Application UseMauiEmbedding(this Microsof var mauiApp = mauiAppBuilder.Build(); mauiApp.InitializeMauiEmbeddingApp(app); + +#if WINDOWS + window.Activated += (s, args) => + { + WindowStateManager.Default.OnActivated(window, args); + }; +#endif + + #endif return app; } @@ -143,7 +153,7 @@ private static void InitializeApplicationMainPage(IApplication iApp) private static void SetCoreWindow(this IApplication app, Microsoft.Maui.Controls.Window window) { - if(app.Windows is List windows) + if (app.Windows is List windows) { windows.Add(window); } diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs index a7ba5aa705..14858447f1 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs @@ -31,11 +31,6 @@ private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp, Application throw new MauiEmbeddingException(Properties.Resources.TheApplicationMustInheritFromEmbeddingApplication); } - //if (_clone is not null) - //{ - // app.Resources.Merge(_clone); - //} - embeddingApp.InitializeApplication(mauiApp.Services, iApp); app.SetApplicationHandler(iApp, rootContext); InitializeApplicationMainPage(iApp);