From c149557805bd10ecaec80b8cda1f55a0e7b8c810 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Fri, 18 Aug 2023 07:15:39 -0600 Subject: [PATCH 01/11] chore: adding notes on implementation --- src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs | 4 +++- src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs | 2 ++ src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs index db761733ce..dd4786f54a 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs @@ -1,8 +1,10 @@ -#if ANDROID +#if ANDROID namespace Uno.Extensions.Maui; partial class MauiEmbedding { + // NOTE: This is meant to help initialize MauiEmbedding similar to what MauiApplication + // https://github.com/dotnet/maui/blob/ace9fe5e7d8d9bd16a2ae0b2fe2b888ad681433e/src/Core/src/Platform/Android/MauiApplication.cs#L32-L53 private static MauiAppBuilder RegisterPlatformServices(this MauiAppBuilder builder, Application app) { if (Android.App.Application.Context is not Android.App.Application androidApp) diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs index 0d0cc80bdd..a23bdd642a 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs @@ -5,6 +5,8 @@ namespace Uno.Extensions.Maui; partial class MauiEmbedding { + // NOTE: This is meant to help initialize MauiEmbedding similar to MauiUIApplicationDelegate + // https://github.com/dotnet/maui/blob/ace9fe5e7d8d9bd16a2ae0b2fe2b888ad681433e/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.cs#L36-L70 private static MauiAppBuilder RegisterPlatformServices(this MauiAppBuilder builder, Application app) { builder.Services.AddTransient(sp => sp.GetRequiredService().Window!) diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs index 5d159da47f..c9bc657489 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs @@ -5,6 +5,8 @@ namespace Uno.Extensions.Maui; partial class MauiEmbedding { + // NOTE: This is meant to help initialize MauiEmbedding similar to MauiWinUIApplication + // https://github.com/dotnet/maui/blob/ace9fe5e7d8d9bd16a2ae0b2fe2b888ad681433e/src/Core/src/Platform/Windows/MauiWinUIApplication.cs#L21-L49 private static MauiAppBuilder RegisterPlatformServices(this MauiAppBuilder builder, Application app) { //_ = builder.Services.RemoveWhere(sd => From d1501312b3b23f69762bb2537d16adbeea4df84c Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Fri, 18 Aug 2023 07:15:52 -0600 Subject: [PATCH 02/11] fix: adding registration for Android Context --- src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs index dd4786f54a..51e4eaba7d 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs @@ -12,6 +12,7 @@ private static MauiAppBuilder RegisterPlatformServices(this MauiAppBuilder build throw new MauiEmbeddingException($"Expected 'Android.App.Application.Context' to be 'Android.App.Application', but got '{Android.App.Application.Context.GetType().FullName}'."); } builder.Services.AddSingleton(androidApp) + .AddTransient(_ => UI.ContextHelper.Current) .AddTransient(_ => { if (UI.ContextHelper.Current is Android.App.Activity currentActivity) From 3a645c673a2445e9919e725813aa3d81a8f7e293 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sun, 20 Aug 2023 10:35:17 -0600 Subject: [PATCH 03/11] fix: adding workaround to fix strong refs to maui types --- samples/MauiEmbedding/MauiEmbedding/App.cs | 3 +- .../MauiEmbedding/Presentation/MainPage.xaml | 2 +- .../AppBuildExtensions.cs | 7 +- .../MauiControlsExternal.csproj | 27 +- .../SyncfusionDemoPage.xaml | 241 +++ .../SyncfusionDemoPage.xaml.cs | 9 + .../MauiControlsExternal/SyncfusionModels.cs | 1891 +++++++++++++++++ .../Internals/EmbeddingApp.cs | 3 - .../Internals/MauiContentHost.cs | 28 - .../MauiEmbedding.android.cs | 15 +- .../MauiEmbedding.apple.cs | 18 +- src/Uno.Extensions.Maui.UI/MauiEmbedding.cs | 14 +- .../MauiEmbedding.windows.cs | 21 +- src/Uno.Extensions.Maui.UI/MauiHost.cs | 149 +- .../Platform/EmbeddingApplication.android.cs | 40 + .../Platform/EmbeddingApplication.apple.cs | 43 + .../Platform/EmbeddingApplication.standard.cs | 8 + .../Platform/EmbeddingApplication.windows.cs | 19 + .../Uno.Extensions.Maui.WinUI.csproj | 27 + .../build/Package.targets | 1 + 20 files changed, 2430 insertions(+), 136 deletions(-) create mode 100644 samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml create mode 100644 samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml.cs create mode 100644 samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionModels.cs delete mode 100644 src/Uno.Extensions.Maui.UI/Internals/EmbeddingApp.cs delete mode 100644 src/Uno.Extensions.Maui.UI/Internals/MauiContentHost.cs create mode 100644 src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.android.cs create mode 100644 src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.apple.cs create mode 100644 src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.standard.cs create mode 100644 src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.windows.cs diff --git a/samples/MauiEmbedding/MauiEmbedding/App.cs b/samples/MauiEmbedding/MauiEmbedding/App.cs index fb9cb8a90e..28d4a8514e 100644 --- a/samples/MauiEmbedding/MauiEmbedding/App.cs +++ b/samples/MauiEmbedding/MauiEmbedding/App.cs @@ -1,8 +1,9 @@ using MauiControlsExternal; +using Uno.Extensions.Maui.Platform; namespace MauiEmbedding; -public class App : Application +public class App : EmbeddingApplication { protected Window? MainWindow { get; private set; } protected IHost? Host { get; private set; } diff --git a/samples/MauiEmbedding/MauiEmbedding/Presentation/MainPage.xaml b/samples/MauiEmbedding/MauiEmbedding/Presentation/MainPage.xaml index eb7587dd44..71cb60c1da 100644 --- a/samples/MauiEmbedding/MauiEmbedding/Presentation/MainPage.xaml +++ b/samples/MauiEmbedding/MauiEmbedding/Presentation/MainPage.xaml @@ -20,7 +20,7 @@ + Source="external:SyncfusionDemoPage" /> diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/AppBuildExtensions.cs b/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/AppBuildExtensions.cs index c06682959c..9dba92c921 100644 --- a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/AppBuildExtensions.cs +++ b/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/AppBuildExtensions.cs @@ -1,10 +1,13 @@ -namespace MauiControlsExternal; +using Syncfusion.Maui.Core.Hosting; + +namespace MauiControlsExternal; + public static class MauiAppBuilderExtensions { public static MauiAppBuilder UseCustomLibrary(this MauiAppBuilder builder) { CustomEntry.Init(); - + builder.ConfigureSyncfusionCore(); return builder; } } diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/MauiControlsExternal.csproj b/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/MauiControlsExternal.csproj index 790e0811cf..eddc8a304f 100644 --- a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/MauiControlsExternal.csproj +++ b/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/MauiControlsExternal.csproj @@ -1,6 +1,6 @@  - + net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst $(TargetFrameworks);net7.0-windows10.0.19041.0 true @@ -15,24 +15,9 @@ 6.5 - - - %(Filename) - - - - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - + + + + + diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml b/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml new file mode 100644 index 0000000000..41d505b165 --- /dev/null +++ b/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml.cs b/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml.cs new file mode 100644 index 0000000000..6742aa1f37 --- /dev/null +++ b/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml.cs @@ -0,0 +1,9 @@ +namespace MauiControlsExternal; + +public partial class SyncfusionDemoPage : ContentPage +{ + public SyncfusionDemoPage() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionModels.cs b/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionModels.cs new file mode 100644 index 0000000000..4627d404b1 --- /dev/null +++ b/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionModels.cs @@ -0,0 +1,1891 @@ +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.Reflection; +using System.Windows.Input; +using Syncfusion.Maui.Charts; +using Font = Microsoft.Maui.Graphics.Font; +using IImage = Microsoft.Maui.Graphics.IImage; +#if IOS || ANDROID || MACCATALYST +using Microsoft.Maui.Graphics.Platform; +#elif WINDOWS +using Microsoft.Maui.Graphics.Win2D; +#endif + +namespace MauiControlsExternal; + +public class ChartDataModel +{ + public string? Name { get; set; } + + public double Data { get; set; } + + public string? Label { get; set; } + public DateTime Date { get; set; } + + public double Value { get; set; } + + public double Value1 { get; set; } + + public double Size { get; set; } + + public double High { get; set; } + + public double Low { get; set; } + + public bool IsSummary { get; set; } + + public string? Department { get; set; } + + public string? Image { get; set; } + + public List? EmployeeAges { get; set; } + + public Brush? Color { get; set; } + + public double Percentage { get; set; } + + public ChartDataModel(string department, List employeeAges) + { + Department = department; + EmployeeAges = employeeAges; + } + + public ChartDataModel(string name, double value) + { + Name = name; + Value = value; + } + + public ChartDataModel(string name, double value, Brush color, double percentage) + { + Name = name; + Value = value; + Color = color; + Percentage = percentage; + } + + public ChartDataModel(string name, double value, string image) + { + Name = name; + Value = value; + Image = image; + } + + public ChartDataModel(string name, double value, double horizontalErrorValue, double verticalErrorValue) + { + Name = name; + Value = value; + High = horizontalErrorValue; + Low = verticalErrorValue; + } + + public ChartDataModel(string name, double value, double size) + { + Name = name; + Value = value; + Size = size; + } + + public ChartDataModel() + { + + } + public ChartDataModel(DateTime date, double value, double size) + { + Date = date; + Value = value; + Size = size; + } + + public ChartDataModel(double value, double value1, double size) + { + Value1 = value; + Value = value1; + Size = size; + } + + public ChartDataModel(double value1, double value, double size, string label) + { + Value1 = value1; + Value = value; + Size = size; + Label = label; + } + + public ChartDataModel(string name, double high, double low, double open, double close) + { + Name = name; + High = high; + Low = low; + Value = open; + Size = close; + } + + public ChartDataModel(double name, double high, double low, double open, double close) + { + Data = name; + High = high; + Low = low; + Value = open; + Size = close; + } + + public ChartDataModel(DateTime date, double high, double low, double open, double close) + { + Date = date; + High = high; + Low = low; + Value = open; + Size = close; + } + public ChartDataModel(double value, double size) + { + Value = value; + Size = size; + } + public ChartDataModel(DateTime dateTime, double value) + { + Date = dateTime; + Value = value; + } + + public ChartDataModel(string name, double value, bool isSummary) + { + Name = name; + Value = value; + IsSummary = isSummary; + } +} +public class PieSeriesViewModel : BaseViewModel +{ + public ObservableCollection PieSeriesData { get; set; } + public ObservableCollection SemiCircularData { get; set; } + public ObservableCollection GroupToData { get; set; } + + public PieSeriesViewModel() + { + PieSeriesData = new ObservableCollection + { + new ChartDataModel("David", 16.6), + new ChartDataModel("Steve", 14.6), + new ChartDataModel("Jack", 18.6), + new ChartDataModel("John", 20.5), + new ChartDataModel("Regev", 39.5), + }; + + SemiCircularData = new ObservableCollection + { + new ChartDataModel("Product A", 750), + new ChartDataModel("Product B", 463), + new ChartDataModel("Product C", 389), + new ChartDataModel("Product D", 697), + new ChartDataModel("Product E", 251) + }; + + GroupToData = new ObservableCollection + { + new ChartDataModel( "US",22.90,0.244), + new ChartDataModel("China",16.90,0.179), + new ChartDataModel( "Japan",5.10,0.054), + new ChartDataModel("Germany",4.20,0.045), + new ChartDataModel("UK",3.10,0.033), + new ChartDataModel("India",2.90,0.031), + new ChartDataModel("France",2.90,0.031), + new ChartDataModel( "Italy",2.10,0.023), + new ChartDataModel( "Canada",2.00,0.021), + new ChartDataModel( "Korea",1.80,0.019), + new ChartDataModel("Russia",1.60,0.017), + new ChartDataModel("Brazil",1.60,0.017), + new ChartDataModel("Australia",1.60,0.017), + new ChartDataModel("Spain",1.40,0.015), + new ChartDataModel("Mexico",1.30,0.014), + new ChartDataModel("Indonesia",1.20,0.012), + new ChartDataModel("Iran",1.10,0.011), + new ChartDataModel("Netherlands",1.00,0.011), + new ChartDataModel("Saudi Arabia",0.80,0.009), + new ChartDataModel("Switzerland",0.80,0.009), + new ChartDataModel("Turkey",0.80,0.008), + new ChartDataModel("Taiwan",0.80,0.008), + new ChartDataModel("Poland",0.70,0.007), + new ChartDataModel("Sweden",0.60,0.007), + new ChartDataModel("Belgium",0.60,0.006), + new ChartDataModel("Thailand",0.50,0.006), + new ChartDataModel("Ireland",0.50,0.005), + new ChartDataModel("Austria",0.50,0.005), + new ChartDataModel("Nigeria",0.50,0.005), + new ChartDataModel("Israel",0.50,0.005), + new ChartDataModel("Argentina",0.50,0.005), + new ChartDataModel("Norway",0.40,0.005), + new ChartDataModel("South Africa",0.40,0.004), + new ChartDataModel("UAE",0.40,0.004), + new ChartDataModel("Denmark",0.40,0.004), + new ChartDataModel("Egypt",0.40,0.004), + new ChartDataModel("Philippines",0.40,0.004), + new ChartDataModel("Singapore",0.40,0.004), + new ChartDataModel("Malaysia",0.40,0.004), + new ChartDataModel("Hong Kong SAR",0.40,0.004), + new ChartDataModel("Vietnam",0.40,0.004), + new ChartDataModel("Bangladesh",0.40,0.004), + new ChartDataModel("Chile",0.30,0.004), + new ChartDataModel("Colombia",0.30,0.003), + new ChartDataModel("Finland",0.30,0.003), + new ChartDataModel("Romania",0.30,0.003), + new ChartDataModel("Czech Republic",0.30,0.003), + new ChartDataModel("Portugal",0.30,0.003), + new ChartDataModel("Pakistan",0.30,0.003), + new ChartDataModel("New Zealand",0.20,0.003), + }; + } +} + + + +public class BaseViewModel : INotifyPropertyChanged +{ + public event PropertyChangedEventHandler? PropertyChanged; + + public ObservableCollection PaletteBrushes { get; set; } + public ObservableCollection SelectionBrushes { get; set; } + public ObservableCollection CustomColor1 { get; set; } + + public ObservableCollection CustomColor2 { get; set; } + public ObservableCollection AlterColor1 { get; set; } + public ICommand TapCommand => new Command(async (url) => await Launcher.OpenAsync(url)); + + public Array PieGroupMode + { + get { return Enum.GetValues(typeof(PieGroupMode)); } + } + + private bool enableAnimation = true; + public bool EnableAnimation + { + get { return enableAnimation; } + set + { + enableAnimation = value; + OnPropertyChanged("EnableAnimation"); + } + } + + public void OnPropertyChanged(string name) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); + } + + public BaseViewModel() + { + PaletteBrushes = new ObservableCollection() + { + new SolidColorBrush(Color.FromArgb("#314A6E")), + new SolidColorBrush(Color.FromArgb("#48988B")), + new SolidColorBrush(Color.FromArgb("#5E498C")), + new SolidColorBrush(Color.FromArgb("#74BD6F")), + new SolidColorBrush(Color.FromArgb("#597FCA")) + }; + + SelectionBrushes = new ObservableCollection() + { + new SolidColorBrush(Color.FromArgb("#40314A6E")), + new SolidColorBrush(Color.FromArgb("#4048988B")), + new SolidColorBrush(Color.FromArgb("#405E498C")), + new SolidColorBrush(Color.FromArgb("#4074BD6F")), + new SolidColorBrush(Color.FromArgb("#40597FCA")) + }; + + CustomColor2 = new ObservableCollection() + { + new SolidColorBrush(Color.FromArgb("#519085")), + new SolidColorBrush(Color.FromArgb("#F06C64")), + new SolidColorBrush(Color.FromArgb("#FDD056")), + new SolidColorBrush(Color.FromArgb("#81B589")), + new SolidColorBrush(Color.FromArgb("#88CED2")) + }; + + CustomColor1 = new ObservableCollection() + { + new SolidColorBrush(Color.FromArgb("#95DB9C")), + new SolidColorBrush(Color.FromArgb("#B95375")), + new SolidColorBrush(Color.FromArgb("#56BBAF")), + new SolidColorBrush(Color.FromArgb("#606D7F")), + new SolidColorBrush(Color.FromArgb("#E99941")), + new SolidColorBrush(Color.FromArgb("#327DBE")), + new SolidColorBrush(Color.FromArgb("#E7695A")), + }; + + AlterColor1 = new ObservableCollection() + { + new SolidColorBrush(Color.FromArgb("#346bf5")), + new SolidColorBrush(Color.FromArgb("#ff9d00")), + }; + } +} + + +public class CornerRadiusConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + return new CornerRadius((double)value / 2); + } + + return 0; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return value; + } +} + + + + +internal class LineDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.StrokeColor = Colors.Red; + canvas.StrokeSize = 6; + // canvas.StrokeDashPattern = new float[] { 2, 2 }; + canvas.DrawLine(10, 10, 90, 100); + } +} + +internal class EllipseDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.StrokeColor = Colors.Red; + canvas.StrokeSize = 4; + canvas.DrawEllipse(10, 10, 150, 50); + } +} + +internal class FilledEllipseDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.FillColor = Colors.Red; + canvas.FillEllipse(10, 10, 100, 50); + } +} + +internal class CircleDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.StrokeColor = Colors.Red; + canvas.StrokeSize = 4; + canvas.DrawEllipse(10, 10, 100, 100); + } +} + +internal class RectangleDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.StrokeColor = Colors.DarkBlue; + canvas.StrokeSize = 4; + canvas.DrawRectangle(10, 10, 100, 50); + } +} + +internal class SquareDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.StrokeColor = Colors.DarkBlue; + canvas.StrokeSize = 4; + canvas.DrawRectangle(10, 10, 100, 100); + } +} + +internal class FilledRectangleDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.FillColor = Colors.DarkBlue; + canvas.FillRectangle(10, 10, 100, 50); + } +} + +internal class RoundedRectangleDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.StrokeColor = Colors.Green; + canvas.StrokeSize = 4; + canvas.DrawRoundedRectangle(10, 10, 100, 50, 12); + } +} + +internal class FilledRoundedRectangleDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.FillColor = Colors.Green; + canvas.FillRoundedRectangle(10, 10, 100, 50, 12); + } +} + +internal class ArcDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.StrokeColor = Colors.Teal; + canvas.StrokeSize = 4; + canvas.DrawArc(10, 10, 100, 100, 0, 180, true, false); + } +} + +internal class FilledArcDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.FillColor = Colors.Teal; + canvas.FillArc(10, 10, 100, 100, 0, 180, true); + } +} + +internal class PathDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + PathF path = new PathF(); + path.MoveTo(40, 10); + path.LineTo(70, 80); + path.LineTo(10, 50); + path.Close(); + canvas.StrokeColor = Colors.Green; + canvas.StrokeSize = 6; + canvas.DrawPath(path); + } +} + +internal class FilledPathDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + PathF path = new PathF(); + path.MoveTo(40, 10); + path.LineTo(70, 80); + path.LineTo(10, 50); + canvas.FillColor = Colors.SlateBlue; + canvas.FillPath(path); + } +} + +internal class ImageDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + IImage? image = default; + Assembly assembly = GetType().GetTypeInfo().Assembly; + using (Stream stream = assembly.GetManifestResourceStream("GraphicsViewDemos.Resources.Images.dotnet_bot.png")) + { +#if IOS || ANDROID || MACCATALYST + // PlatformImage isn't currently supported on Windows. + image = PlatformImage.FromStream(stream); +#elif WINDOWS + image = new W2DImageLoadingService().FromStream(stream); +#endif + } + + if (image != null) + { + canvas.DrawImage(image, 10, 10, image.Width, image.Height); + } + } +} + +internal class StringDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.FontColor = Colors.Blue; + canvas.FontSize = 18; + + canvas.Font = Font.Default; + canvas.DrawString("Text is left aligned.", 20, 20, 380, 100, HorizontalAlignment.Left, VerticalAlignment.Top); + canvas.DrawString("Text is centered.", 20, 60, 380, 100, HorizontalAlignment.Center, VerticalAlignment.Top); + canvas.DrawString("Text is right aligned.", 20, 100, 380, 100, HorizontalAlignment.Right, VerticalAlignment.Top); + + canvas.Font = Font.DefaultBold; + canvas.DrawString("This text is displayed using the bold system font.", 20, 140, 350, 100, HorizontalAlignment.Left, VerticalAlignment.Top); + + canvas.Font = new Font("Arial"); + canvas.FontColor = Colors.Black; + canvas.SetShadow(new SizeF(6, 6), 4, Colors.Gray); + canvas.DrawString("This text has a shadow.", 20, 200, 300, 100, HorizontalAlignment.Left, VerticalAlignment.Top); + } +} + +internal class AttributedTextDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + //canvas.FontName = "Arial"; + //canvas.FontSize = 18; + //canvas.FontColor = Colors.Blue; + + //string markdownText = @"This is *italic text*, **bold text**, __underline text__, and ***bold italic text***."; + //IAttributedText attributedText = MarkdownAttributedTextReader.Read(markdownText); // Requires the Microsoft.Maui.Graphics.Text.Markdig package + //canvas.DrawText(attributedText, 10, 10, 400, 400); + } +} + +internal class FillAndStrokeDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + float radius = Math.Min(dirtyRect.Width, dirtyRect.Height) / 4; + + PathF path = new PathF(); + path.AppendCircle(dirtyRect.Center.X, dirtyRect.Center.Y, radius); + + canvas.StrokeColor = Colors.Blue; + canvas.StrokeSize = 10; + canvas.FillColor = Colors.Red; + + canvas.FillPath(path); + canvas.DrawPath(path); + } +} + +internal class ShadowDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.FillColor = Colors.Red; + canvas.SetShadow(new SizeF(10, 10), 4, Colors.Grey); + canvas.FillRectangle(10, 10, 90, 100); + + canvas.FillColor = Colors.Green; + canvas.SetShadow(new SizeF(10, -10), 4, Colors.Grey); + canvas.FillEllipse(110, 10, 90, 100); + + canvas.FillColor = Colors.Blue; + canvas.SetShadow(new SizeF(-10, 10), 4, Colors.Grey); + canvas.FillRoundedRectangle(210, 10, 90, 100, 25); + } +} + +internal class RegularDashedObjectDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.StrokeColor = Colors.Red; + canvas.StrokeSize = 4; + canvas.StrokeDashPattern = new float[] { 2, 2 }; + canvas.DrawRectangle(10, 10, 90, 100); + } +} + +internal class IrregularDashedObjectDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.StrokeColor = Colors.Red; + canvas.StrokeSize = 4; + canvas.StrokeDashPattern = new float[] { 4, 4, 1, 4 }; + canvas.DrawRectangle(10, 10, 90, 100); + } +} + +internal class LineEndsDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + canvas.StrokeSize = 10; + canvas.StrokeColor = Colors.Red; + canvas.StrokeLineCap = LineCap.Round; + canvas.DrawLine(10, 10, 110, 110); + } +} + +internal class LineJoinsDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + PathF path = new PathF(); + path.MoveTo(10, 10); + path.LineTo(110, 50); + path.LineTo(10, 110); + + canvas.StrokeSize = 20; + canvas.StrokeColor = Colors.Blue; + canvas.StrokeLineJoin = LineJoin.Round; + canvas.DrawPath(path); + } +} + +internal class ClippingDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + IImage? image = default; + + var assembly = GetType().GetTypeInfo().Assembly; + using (var stream = assembly.GetManifestResourceStream("GraphicsViewDemos.Resources.Images.dotnet_bot.png")) + { +#if IOS || ANDROID || MACCATALYST + // PlatformImage isn't currently supported on Windows. + image = PlatformImage.FromStream(stream); +#elif WINDOWS + image = new W2DImageLoadingService().FromStream(stream); +#endif + } + + if (image != null) + { + PathF path = new PathF(); + path.AppendCircle(100, 90, 80); + canvas.ClipPath(path); // Must be called before DrawImage + canvas.DrawImage(image, 10, 10, image.Width, image.Height); + } + } +} + +internal class SubtractClippingDrawable : IDrawable +{ + public void Draw(ICanvas canvas, RectF dirtyRect) + { + IImage? image = default; + var assembly = GetType().GetTypeInfo().Assembly; + using (var stream = assembly.GetManifestResourceStream("GraphicsViewDemos.Resources.Images.dotnet_bot.png")) + { +#if IOS || ANDROID || MACCATALYST + // PlatformImage isn't currently supported on Windows. + image = PlatformImage.FromStream(stream); +#elif WINDOWS + image = new W2DImageLoadingService().FromStream(stream); +#endif + } + + if (image != null) + { + canvas.SubtractFromClip(60, 60, 90, 90); + canvas.DrawImage(image, 10, 10, image.Width, image.Height); + } + } +} + + +public class TeamViewModel : INotifyPropertyChanged +{ + #region Fields + + private ObservableCollection data; + + #endregion + + #region Constructor + + /// + /// Initializes a new instance of the GettingStartedViewModel class. + /// + public TeamViewModel() + { + this.data = new ObservableCollection(); + this.AddRows(); + } + + #endregion + /// + /// Represents the method that will handle the event raised when a property is changed on a component + /// + public event PropertyChangedEventHandler? PropertyChanged; + + /// + /// Gets the Data. + /// + /// The Data. + public ObservableCollection Data + { + get { return this.data; } + } + + #region updating code + + /// + /// Adds the rows. + /// + private void AddRows() + { + this.data.Add(new Team("Cavaliers", .616, 0, 93, 58, "cavaliers.png", "East")); + this.data.Add(new Team("Clippers", .550, 10, 82, 67, "clippers.png", "West")); + this.data.Add(new Team("Denver", .514, 15, 76, 72, "denvernuggets.png", "Central")); + this.data.Add(new Team("Detroit", .513, 15, 77, 73, "detroitpistons.png", "East")); + this.data.Add(new Team("Golden State", .347, 40, 52, 98, "goldenstate.png", "West")); + this.data.Add(new Team("Los Angeles", .560, 0, 84, 66, "losangeles.png", "Central")); + this.data.Add(new Team("Mavericks", .547, 2, 82, 68, "mavericks.png", "East")); + this.data.Add(new Team("Memphis", .540, 3, 81, 69, "memphis.png", "West")); + this.data.Add(new Team("Miami", .464, 14, 70, 81, "miami.png", "Central")); + this.data.Add(new Team("Milwakke", .433, 19, 65, 85, "milwakke.png", "East")); + this.data.Add(new Team("New York", .642, 0, 97, 54, "newyork.png", "West")); + this.data.Add(new Team("Orlando", .510, 20, 77, 74, "orlando.png", "Central")); + this.data.Add(new Team("Thunder", .480, 24, 72, 78, "thunder_logo.png", "East")); + } + + #endregion + + #region INotifyPropertyChanged implementation + + /// + /// Triggers when Items Collections Changed. + /// + /// string type of name + private void RaisePropertyChanged(string name) + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(name)); + } + } + + #endregion +} + + +public class Team : INotifyPropertyChanged +{ + #region Private Members + + private string? team; + private string? location; + private int wins; + private int losses; + private string? logo; + private double pct; + private int gb; + + #endregion + + /// + /// Represents the method that will handle the event raised when a property is changed on a component + /// + public event PropertyChangedEventHandler? PropertyChanged; + + #region Public properties + + /// + /// Gets or sets the Team. + /// + /// The Team. + public string? TeamName + { + get + { + return team; + } + + set + { + team = value; + RaisePropertyChanged("TeamName"); + } + } + + /// + /// Gets or sets the PCT. + /// + /// The PCT. + public double PCT + { + get + { + return pct; + } + + set + { + pct = value; + RaisePropertyChanged("PCT"); + } + } + + /// + /// Gets or sets the GB. + /// + /// The GB. + public int GB + { + get + { + return gb; + } + + set + { + gb = value; + RaisePropertyChanged("GB"); + } + } + + /// + /// Gets or sets the Wins. + /// + /// The Wins. + public int Wins + { + get + { + return wins; + } + + set + { + wins = value; + RaisePropertyChanged("Wins"); + } + } + + /// + /// Gets or sets the Losses. + /// + /// The Losses. + public int Losses + { + get + { + return losses; + } + + set + { + losses = value; + RaisePropertyChanged("Losses"); + } + } + + /// + /// Gets or sets the team image source. + /// + /// The image source for team. + public string? Logo + { + get + { + return logo; + } + + set + { + logo = value; + RaisePropertyChanged("Logo"); + } + } + + /// + /// Gets or sets the Location. + /// + /// The Location. + public string? Location + { + get + { + return location; + } + + set + { + location = value; + RaisePropertyChanged("Location"); + } + } + + #endregion + + public Team(string? teamname, double pct, int gb, int wins, int losses, string? logo, string? location) + { + this.TeamName = teamname; + this.PCT = pct; + this.GB = gb; + this.Wins = wins; + this.Losses = losses; + this.Logo = logo; + this.Location = location; + } + + #region INotifyPropertyChanged implementation + + /// + /// Triggers when Items Collections Changed. + /// + /// string type of parameter propertyName + public void RaisePropertyChanged(string propertyName) + { + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + #endregion +} + + +public class OrderInfoViewModel : INotifyPropertyChanged +{ + #region private variables + + private string? filtertext = string.Empty; + private string? selectedcolumn = "All Columns"; + private string? selectedcondition = "Contains"; + + private ObservableCollection? dataGridSelectedItem; + private List? orderedDates; + private Random random = new Random(); + private ObservableCollection? ordersInfo; + internal FilterChanged? Filtertextchanged; + + #endregion + + #region MainGrid DataSource + private string[] genders = new string[] + { + "Male", + "Female", + "Female", + "Female", + "Male", + "Male", + "Male", + "Male", + "Male", + "Male", + "Male", + "Male", + "Female", + "Female", + "Female", + "Male", + "Male", + "Male", + "Female", + "Female", + "Female", + "Male", + "Male", + "Male", + "Male" + }; + + private string[] firstNames = new string[] + { + "Kyle", + "Gina", + "Irene", + "Katie", + "Michael", + "Oscar", + "Ralph", + "Torrey", + "William", + "Bill", + "Daniel", + "Frank", + "Brenda", + "Danielle", + "Fiona", + "Howard", + "Jack", + "Larry", + "Holly", + "Jennifer", + "Liz", + "Pete", + "Steve", + "Vince", + "Zeke", + "Gary", + "Maciej", + "Shelley", + "Linda", + "Carla", + "Carol", + "Shannon", + "Jauna", + "Michael", + "Terry", + "John", + "Gail", + "Mark", + "Martha", + "Julie", + "Janeth", + "Twanna", + "Frank", + "Crowley", + "Waddell", + "Irvine", + "Keefe", + "Ellis", + "Gable", + "Mendoza", + "Rooney", + "Lane", + "Landry", + "Perry", + "Perez", + "Newberry", + "Betts", + "Fitzgerald", + "Adams", + "Owens", + "Thomas", + "Doran", + "Jefferson", + "Spencer", + "Vargas", + "Grimes", + "Edwards", + "Stark", + "Cruise", + "Fitz", + "Chief", + "Blanc", + "Stone", + "Williams", + "Jobs", + "Holmes" + }; + private string[] lastNames = new string[] + { + "Adams", + "Crowley", + "Ellis", + "Gable", + "Irvine", + "Keefe", + "Mendoza", + "Owens", + "Rooney", + "Waddell", + "Thomas", + "Betts", + "Doran", + "Holmes", + "Jefferson", + "Landry", + "Newberry", + "Perez", + "Spencer", + "Vargas", + "Grimes", + "Edwards", + "Stark", + "Cruise", + "Fitz", + "Chief", + "Blanc", + "Perry", + "Stone", + "Williams", + "Lane", + "Jobs" + }; + + private string[] customerID = new string[] + { + "Alfki", + "Frans", + "Merep", + "Folko", + "Simob", + "Warth", + "Vaffe", + "Furib", + "Seves", + "Linod", + "Riscu", + "Picco", + "Blonp", + "Welli", + "Folig" + }; + + private string[] shipCountry = new string[] + { + "Argentina", + "Austria", + "Belgium", + "Brazil", + "Canada", + "Denmark", + "Finland", + "France", + "Germany", + "Ireland", + "Italy", + "Mexico", + "Norway", + "Poland", + "Portugal", + "Spain", + "Sweden", + "UK", + "USA", + }; + + public event PropertyChangedEventHandler? PropertyChanged; + + private Dictionary shipCity = new Dictionary(); + + #endregion + + /// + /// Initializes a new instance of the OrderInfoRepository class. + /// + public OrderInfoViewModel() + { + this.OrdersInfo = this.GetOrderDetails(100); + this.DataGridSelectedItems = new ObservableCollection(); + this.DataGridSelectedItems!.Add(this.OrdersInfo[0]); + this.DataGridSelectedItems!.Add(this.OrdersInfo[1]); + this.DataGridSelectedItems!.Add(this.OrdersInfo[3]); + } + + #region GetOrderDetails + + /// + /// Generates record rows with given count + /// + /// integer type of count parameter + /// stored Items Values + public ObservableCollection GetOrderDetails(int count) + { + this.SetShipCity(); + this.orderedDates = this.GetDateBetween(2000, 2014, count); + ObservableCollection orderDetails = new ObservableCollection(); + int index = 0; + for (int i = 10001; i <= count + 10000; i++) + { + index = index + 1; + var shipcountry = this.shipCountry[this.random.Next(5)]; + var shipcitycoll = this.shipCity[shipcountry]; + + var ord = new OrderInfo() + { + OrderID = i, + CustomerID = this.customerID[this.random.Next(15)], + EmployeeID = i - 10000 + 2700, + FirstName = index > 72 ? this.firstNames[this.random.Next(40)] : this.firstNames[index], + LastName = this.lastNames[this.random.Next(15)], + Gender = this.genders[this.random.Next(5)], + ShipCountry = shipcountry, + ShippingDate = this.orderedDates[i - 10001], + Freight = Math.Round(this.random.Next(1000) + this.random.NextDouble(), 2), + Price = Math.Round(this.random.Next(1000) + this.random.NextDouble(), 3), + IsClosed = (i % this.random.Next(1, 10) > 2) ? true : false, + ShipCity = shipcitycoll[this.random.Next(shipcitycoll.Length - 1)], + }; + orderDetails.Add(ord); + } + + return orderDetails; + } + + + #endregion + /// + /// Used to send a Notification while Filter Changed + /// + internal delegate void FilterChanged(); + + /// + /// Gets or sets the value of FilterText and notifies user when value gets changed + /// + public string? FilterText + { + get + { + return this.filtertext; + } + + set + { + this.filtertext = value; + this.OnFilterTextChanged(); + this.RaisePropertyChanged("FilterText"); + } + } + + public ObservableCollection? DataGridSelectedItems + { + get + { + return dataGridSelectedItem; + } + set + { + this.dataGridSelectedItem = value; + RaisePropertyChanged("DataGridSelectedItems"); + } + } + + + /// + /// Gets or sets the value of SelectedCondition + /// + public string? SelectedCondition + { + get { return this.selectedcondition; } + set { this.selectedcondition = value; } + } + + /// + /// Gets or sets the value of SelectedColumn + /// + public string? SelectedColumn + { + get { return this.selectedcolumn; } + set { this.selectedcolumn = value; } + } + + /// Gets or sets the value of OrdersInfo and notifies user when value gets changed + public ObservableCollection? OrdersInfo + { + get + { + return this.ordersInfo; + } + + set + { + this.ordersInfo = value; + this.RaisePropertyChanged("OrdersInfo"); + } + } + + /// + /// used to decide generate records or not + /// + /// object type parameter + /// true or false value + public bool FilerRecords(object o) + { + double res; + bool checkNumeric = double.TryParse(this.FilterText, out res); + var item = o as OrderInfo; + if (item != null && this.FilterText!.Equals(string.Empty) && !string.IsNullOrEmpty(this.FilterText)) + { + return true; + } + else + { + if (item != null) + { + if (checkNumeric && !this.SelectedColumn!.Equals("All Columns") && !this.SelectedCondition!.Equals("Contains")) + { + bool result = this.MakeNumericFilter(item, this.SelectedColumn, this.SelectedCondition); + return result; + } + else if (this.SelectedColumn!.Equals("All Columns")) + { + if (item.OrderID!.ToString().ToLower().Contains(this.FilterText!.ToLower()) || + item.FirstName!.ToString().ToLower().Contains(this.FilterText.ToLower()) || + item.CustomerID!.ToString().ToLower().Contains(this.FilterText.ToLower()) || + item.ShipCity!.ToString().ToLower().Contains(this.FilterText.ToLower()) || + item.ShipCountry!.ToString().ToLower().Contains(this.FilterText.ToLower())) + { + return true; + } + + return false; + } + else + { + bool result = this.MakeStringFilter(item, this.SelectedColumn, this.SelectedCondition!); + return result; + } + } + } + + return false; + } + + + /// + /// Used to call the filter text changed() + /// + private void OnFilterTextChanged() + { + if (this.Filtertextchanged != null) + { + this.Filtertextchanged(); + } + } + + private bool MakeStringFilter(OrderInfo o, string option, string condition) + { + var value = o.GetType().GetProperty(option); + var exactValue = value!.GetValue(o, null); + exactValue = exactValue!.ToString()!.ToLower(); + string text = this.FilterText!.ToLower(); + var methods = typeof(string).GetMethods(); + + if (methods.Count() != 0) + { + if (condition == "Contains") + { + var methodInfo = methods.FirstOrDefault(method => method.Name == condition); + bool result1 = (bool)methodInfo!.Invoke(exactValue!, new object[] { text })!; + return result1; + } + else if (exactValue.ToString() == text.ToString()) + { + bool result1 = string.Equals(exactValue.ToString(), text.ToString()); + if (condition == "Equals") + { + return result1; + } + else if (condition == "NotEquals") + { + return false; + } + } + else if (condition == "NotEquals") + { + return true; + } + + return false; + } + else + { + return false; + } + } + + /// + /// Used decide to make the numeric filter + /// + /// o + /// option + /// condition + /// true or false value + private bool MakeNumericFilter(OrderInfo o, string option, string condition) + { + var value = o.GetType().GetProperty(option); + var exactValue = value!.GetValue(o, null); + double res; + bool checkNumeric = double.TryParse(exactValue!.ToString(), out res); + if (checkNumeric) + { + switch (condition) + { + case "Equals": + try + { + if (exactValue.ToString() == this.FilterText) + { + if (Convert.ToDouble(exactValue) == Convert.ToDouble(this.FilterText)) + { + return true; + } + } + } + catch (Exception e) + { + Debug.WriteLine(e.Message); + } + + break; + case "NotEquals": + try + { + if (Convert.ToDouble(this.FilterText) != Convert.ToDouble(exactValue)) + { + return true; + } + } + catch (Exception e) + { + Debug.WriteLine(e.Message); + return true; + } + + break; + } + } + + return false; + } + + private void RaisePropertyChanged(string name) + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(name)); + } + } + + /// + /// Used to generate DateTime and returns the value + /// + /// integer type of parameter startYear + /// integer type of parameter endYear + /// integer type of parameter count + /// returns the generated DateTime + private List GetDateBetween(int startYear, int endYear, int count) + { + List date = new List(); + Random d = new Random(1); + Random m = new Random(2); + Random y = new Random(startYear); + for (int i = 0; i < count; i++) + { + int year = y.Next(startYear, endYear); + int month = m.Next(3, 13); + int day = d.Next(1, 31); + + date.Add(new DateTime(year, month, day)); + } + + return date; + } + + /// + /// This method used to store the string items collections Value + /// + private void SetShipCity() + { + string[] argentina = new string[] + { + "Rosario" + }; + + string[] austria = new string[] + { + "Graz", + "Salzburg" + }; + + string[] belgium = new string[] + { + "Bruxelles", + "Charleroi" + }; + + string[] brazil = new string[] + { + "Campinas", + "Resende", + "Recife", + "Manaus" + }; + + string[] canada = new string[] + { + "Montréal", + "Tsawassen", + "Vancouver" + }; + + string[] denmark = new string[] + { + "Århus", + "København" + }; + + string[] finland = new string[] + { + "Helsinki", + "Oulu" + }; + + string[] france = new string[] + { + "Lille", + "Lyon", + "Marseille", + "Nantes", + "Paris", + "Reims", + "Strasbourg", + "Toulouse", + "Versailles" + }; + + string[] germany = new string[] + { + "Aachen", + "Berlin", + "Brandenburg", + "Cunewalde", + "Frankfurt", + "Köln", + "Leipzig", + "Mannheim", + "München", + "Münster", + "Stuttgart" + }; + + string[] ireland = new string[] + { + "Cork" + }; + + string[] italy = new string[] + { + "Bergamo", + "Reggio", + "Torino" + }; + + string[] mexico = new string[] + { + "México D.F." + }; + + string[] norway = new string[] + { + "Stavern" + }; + + string[] poland = new string[] + { + "Warszawa" + }; + + string[] portugal = new string[] + { + "Lisboa" + }; + + string[] spain = new string[] + { + "Barcelona", + "Madrid", + "Sevilla" + }; + + string[] sweden = new string[] + { + "Bräcke", + "Luleå" + }; + + string[] switzerland = new string[] + { + "Bern", + "Genève" + }; + + string[] uk = new string[] + { + "Colchester", + "Hedge End", + "London" + }; + + string[] usa = new string[] + { + "Albuquerque", + "Anchorage", + "Boise", + "Butte", + "Elgin", + "Eugene", + "Kirkland", + "Lander", + "Portland", + "San Francisco", + "Seattle", + }; + + string[] venezuela = new string[] + { + "Barquisimeto", + "Caracas", "I. de Margarita", + "San Cristóbal" + }; + + this.shipCity.Add("Argentina", argentina); + this.shipCity.Add("Austria", austria); + this.shipCity.Add("Belgium", belgium); + this.shipCity.Add("Brazil", brazil); + this.shipCity.Add("Canada", canada); + this.shipCity.Add("Denmark", denmark); + this.shipCity.Add("Finland", finland); + this.shipCity.Add("France", france); + this.shipCity.Add("Germany", germany); + this.shipCity.Add("Ireland", ireland); + this.shipCity.Add("Italy", italy); + this.shipCity.Add("Mexico", mexico); + this.shipCity.Add("Norway", norway); + this.shipCity.Add("Poland", poland); + this.shipCity.Add("Portugal", portugal); + this.shipCity.Add("Spain", spain); + this.shipCity.Add("Sweden", sweden); + this.shipCity.Add("Switzerland", switzerland); + this.shipCity.Add("UK", uk); + this.shipCity.Add("USA", usa); + this.shipCity.Add("Venezuela", venezuela); + } +} + + + +public class OrderInfo : INotifyPropertyChanged +{ + #region private variables + + private int orderID; + private int employeeID; + private string? customerID; + private string? firstname; + private string? lastname; + private string? gender; + private string? shipCity; + private string? shipCountry; + private double freight; + private DateTime shippingDate; + private bool isClosed; + private double price; + + #endregion + + /// + /// Initializes a new instance of the OrderInfo class. + /// + public OrderInfo() + { + } + + /// + /// Represents the method that will handle the event raised when a property is changed on a component + /// + public event PropertyChangedEventHandler? PropertyChanged; + + #region Public Properties + + /// + /// Gets or sets the value of OrderID and notifies user when value gets changed + /// + public int OrderID + { + get + { + return this.orderID; + } + + set + { + this.orderID = value; + this.RaisePropertyChanged("OrderID"); + } + } + + /// + /// Gets or sets the value of EmployeeID and notifies user when value gets changed + /// + public int EmployeeID + { + get + { + return this.employeeID; + } + + set + { + this.employeeID = value; + this.RaisePropertyChanged("EmployeeID"); + } + } + + /// + /// Gets or sets the value of CustomerID and notifies user when value gets changed + /// + public string? CustomerID + { + get + { + return this.customerID; + } + + set + { + this.customerID = value; + this.RaisePropertyChanged("CustomerID"); + } + } + + /// + /// Gets or sets the value of FirstName and notifies user when value gets changed + /// + public string? FirstName + { + get + { + return this.firstname; + } + + set + { + this.firstname = value; + this.RaisePropertyChanged("FirstName"); + } + } + + /// + /// Gets or sets the value of LastName and notifies user when value gets changed + /// + public string? LastName + { + get + { + return this.lastname; + } + + set + { + this.lastname = value; + this.RaisePropertyChanged("LastName"); + } + } + + /// + /// Gets or sets the value of Gender and notifies user when value gets changed + /// + public string? Gender + { + get + { + return this.gender; + } + + set + { + this.gender = value; + this.RaisePropertyChanged("Gender"); + } + } + + /// + /// Gets or sets the value of ShipCity and notifies user when value gets changed + /// + public string? ShipCity + { + get + { + return this.shipCity; + } + + set + { + this.shipCity = value; + this.RaisePropertyChanged("ShipCity"); + } + } + + /// + /// Gets or sets the value of ShipCountry and notifies user when value gets changed + /// + public string? ShipCountry + { + get + { + return this.shipCountry; + } + + set + { + this.shipCountry = value; + this.RaisePropertyChanged("ShipCountry"); + } + } + + /// + /// Gets or sets the value of Freight and notifies user when value gets changed + /// + public double Freight + { + get + { + return this.freight; + } + + set + { + this.freight = value; + this.RaisePropertyChanged("Freight"); + } + } + + /// + /// + /// + public double Price + { + get + { + return this.price; + } + + set + { + this.price = value; + this.RaisePropertyChanged("Price"); + } + } + + /// + /// Gets or sets a value indicating whether IsClosed is true or false and notifies user when value gets changed + /// + public bool IsClosed + { + get + { + return this.isClosed; + } + + set + { + this.isClosed = value; + this.RaisePropertyChanged("IsClosed"); + } + } + + /// + /// Gets or sets the value of ShippingDate and notifies user when value gets changed + /// + public DateTime ShippingDate + { + get + { + return this.shippingDate; + } + + set + { + this.shippingDate = value; + this.RaisePropertyChanged("ShippingDate"); + } + } + + #endregion + + #region INotifyPropertyChanged implementation + + /// + /// Triggers when Items Collections Changed. + /// + /// string type parameter name + private void RaisePropertyChanged(string name) + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(name)); + } + } + + #endregion +} diff --git a/src/Uno.Extensions.Maui.UI/Internals/EmbeddingApp.cs b/src/Uno.Extensions.Maui.UI/Internals/EmbeddingApp.cs deleted file mode 100644 index f533819a54..0000000000 --- a/src/Uno.Extensions.Maui.UI/Internals/EmbeddingApp.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace Uno.Extensions.Maui.Internals; - -internal sealed record EmbeddingApp(IServiceProvider Services, IApplication Application) : IPlatformApplication; diff --git a/src/Uno.Extensions.Maui.UI/Internals/MauiContentHost.cs b/src/Uno.Extensions.Maui.UI/Internals/MauiContentHost.cs deleted file mode 100644 index 19e265c904..0000000000 --- a/src/Uno.Extensions.Maui.UI/Internals/MauiContentHost.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace Uno.Extensions.Maui.Internals; - -internal class MauiContentHost : Microsoft.Maui.Controls.ContentView -{ - public MauiContentHost(MauiResourceDictionary resources) - { - // Ensure that we properly parent to the Application so that resources can be found. - if (IPlatformApplication.Current is not null) - { - var app = IPlatformApplication.Current.Application; - if (app is Element element && app.Windows is List windows) - { - windows.Add(new Microsoft.Maui.Controls.Window - { - Parent = element, - Page = new ContentPage - { - Content = this - } - }); - } - } - - Resources = resources; - HorizontalOptions = LayoutOptions.Fill; - VerticalOptions = LayoutOptions.Fill; - } -} diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs index 51e4eaba7d..468d893f38 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs @@ -1,4 +1,5 @@ -#if ANDROID +using Uno.Extensions.Maui.Platform; + namespace Uno.Extensions.Maui; partial class MauiEmbedding @@ -11,6 +12,7 @@ private static MauiAppBuilder RegisterPlatformServices(this MauiAppBuilder build { throw new MauiEmbeddingException($"Expected 'Android.App.Application.Context' to be 'Android.App.Application', but got '{Android.App.Application.Context.GetType().FullName}'."); } + builder.Services.AddSingleton(androidApp) .AddTransient(_ => UI.ContextHelper.Current) .AddTransient(_ => @@ -23,7 +25,7 @@ private static MauiAppBuilder RegisterPlatformServices(this MauiAppBuilder build return builder; } - private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp) + private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp, Application app) { var androidApp = mauiApp.Services.GetRequiredService(); var scope = mauiApp.Services.CreateScope(); @@ -31,9 +33,14 @@ private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp) rootContext.InitializeScopedServices(); var iApp = mauiApp.Services.GetRequiredService(); - IPlatformApplication.Current = new EmbeddingApp(scope.ServiceProvider, iApp); + if(app is not EmbeddingApplication embeddingApp) + { + throw new MauiEmbeddingException("The provided application must inherit from EmbeddingApplication"); + } + + embeddingApp.InitializeApplication(scope.ServiceProvider, iApp); + Microsoft.Maui.ApplicationModel.Platform.Init(androidApp); androidApp.SetApplicationHandler(iApp, rootContext); } } -#endif diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs index a23bdd642a..2a798f2946 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs @@ -1,5 +1,5 @@ -#if IOS || MACCATALYST -using UIKit; +using UIKit; +using Uno.Extensions.Maui.Platform; namespace Uno.Extensions.Maui; @@ -15,15 +15,19 @@ private static MauiAppBuilder RegisterPlatformServices(this MauiAppBuilder build return builder; } - private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp) + private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp, Application app) { var rootContext = new MauiContext(mauiApp.Services); rootContext.InitializeScopedServices(); var iApp = mauiApp.Services.GetRequiredService(); - IPlatformApplication.Current = new EmbeddingApp(mauiApp.Services, iApp); - var appDelegate = mauiApp.Services.GetRequiredService(); - appDelegate.SetApplicationHandler(iApp, rootContext); + if (app is not EmbeddingApplication embeddingApp) + { + throw new MauiEmbeddingException("The provided application must inherit from EmbeddingApplication"); + } + + // TODO: Evaluate getting the Root View Controller for a Platform.Init for Maui + embeddingApp.InitializeApplication(mauiApp.Services, iApp); + app.SetApplicationHandler(iApp, rootContext); } } -#endif diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.cs index dd7c98af75..6f9fd9edc7 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.cs @@ -32,6 +32,18 @@ public static IHostBuilder UseMauiEmbedding(this IHostBuilder builder, Mic return builder; } + private class MauiHostProviderFactory : IServiceProviderFactory + { + public IServiceProvider CreateBuilder(IServiceCollection services) => services.BuildServiceProvider(); + public IServiceProvider CreateServiceProvider(IServiceProvider containerBuilder) => containerBuilder; + } + + private class UnoHostProviderFactory : IServiceProviderFactory + { + public IServiceCollection CreateBuilder(IServiceCollection services) => throw new NotImplementedException(); + public IServiceProvider CreateServiceProvider(IServiceCollection containerBuilder) => containerBuilder.BuildServiceProvider(); + } + /// /// Registers Maui embedding with WinUI3 and WPF application builder. /// @@ -63,7 +75,7 @@ public static Microsoft.UI.Xaml.Application UseMauiEmbedding(this Microsof configure?.Invoke(mauiAppBuilder); var mauiApp = mauiAppBuilder.Build(); - mauiApp.InitializeMauiEmbeddingApp(); + mauiApp.InitializeMauiEmbeddingApp(app); #endif return app; } diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs index c9bc657489..5b4a3132b8 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs @@ -1,14 +1,15 @@ -#if WINDOWS -using Microsoft.Maui.Hosting; +using Uno.Extensions.Maui.Platform; namespace Uno.Extensions.Maui; partial class MauiEmbedding { + //private static ResourceDictionary? _clone = null; // NOTE: This is meant to help initialize MauiEmbedding similar to MauiWinUIApplication // https://github.com/dotnet/maui/blob/ace9fe5e7d8d9bd16a2ae0b2fe2b888ad681433e/src/Core/src/Platform/Windows/MauiWinUIApplication.cs#L21-L49 private static MauiAppBuilder RegisterPlatformServices(this MauiAppBuilder builder, Application app) { + //_clone = app.Resources.Clone(); //_ = builder.Services.RemoveWhere(sd => // sd.ServiceType == typeof(IMauiInitializeService) && // ( @@ -19,15 +20,23 @@ private static MauiAppBuilder RegisterPlatformServices(this MauiAppBuilder build return builder; } - private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp) + private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp, Application app) { var rootContext = new MauiContext(mauiApp.Services); rootContext.InitializeScopedServices(); var iApp = mauiApp.Services.GetRequiredService(); - IPlatformApplication.Current = new EmbeddingApp(mauiApp.Services, iApp); - var app = mauiApp.Services.GetRequiredService(); + if (app is not EmbeddingApplication embeddingApp) + { + throw new MauiEmbeddingException("The provided application must inherit from EmbeddingApplication"); + } + + //if (_clone is not null) + //{ + // app.Resources.Merge(_clone); + //} + + embeddingApp.InitializeApplication(mauiApp.Services, iApp); app.SetApplicationHandler(iApp, rootContext); } } -#endif diff --git a/src/Uno.Extensions.Maui.UI/MauiHost.cs b/src/Uno.Extensions.Maui.UI/MauiHost.cs index 0c2f3cfc5b..8fcc0c2e03 100644 --- a/src/Uno.Extensions.Maui.UI/MauiHost.cs +++ b/src/Uno.Extensions.Maui.UI/MauiHost.cs @@ -1,11 +1,15 @@ -namespace Uno.Extensions.Maui; +using Microsoft.Maui.ApplicationModel; +using Uno.Extensions.Maui.Platform; + +namespace Uno.Extensions.Maui; /// /// ContentControl implementation that hosts a Maui view. /// -//[ContentProperty(Name = nameof(MauiContent))] public partial class MauiHost : ContentControl { + private static object locker = new object(); + /// /// The Maui Source property represents the type of the Maui View to create /// @@ -15,39 +19,67 @@ public partial class MauiHost : ContentControl private static void OnSourceChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args) { #if MAUI_EMBEDDING + // Sanity Check + if (IPlatformApplication.Current?.Application is null + && MauiApplication.Current?.Handler.MauiContext is not null) + { + if (Application.Current is not EmbeddingApplication embeddingApp) + { + throw new MauiEmbeddingInitializationException(); + } + embeddingApp.InitializeApplication(MauiApplication.Current.Handler.MauiContext.Services, MauiApplication.Current); + } + if (args.NewValue is null || args.NewValue is not Type type || - !type.IsAssignableTo(typeof(MauiView)) || + !type.IsAssignableTo(typeof(VisualElement)) || dependencyObject is not MauiHost mauiHost || - IPlatformApplication.Current is null) + MauiApplication.Current?.Handler?.MauiContext is null) { return; } - // Allow the use of Dependency Injection for the View - mauiHost.MauiContent = (MauiView)ActivatorUtilities.CreateInstance(IPlatformApplication.Current.Services, type); -#endif - } + try + { + var app = MauiApplication.Current; + var mauiContext = MauiApplication.Current.Handler.MauiContext; - /// - /// The MauiContent property represents the that will be used as content. - /// - private static readonly DependencyProperty MauiContentProperty = - DependencyProperty.Register(nameof(MauiContent), typeof(MauiView), typeof(MauiHost), new PropertyMetadata(null, OnMauiContentChanged)); + // Allow the use of Dependency Injection for the View + var instance = ActivatorUtilities.CreateInstance(mauiContext.Services, type); + if (instance is Microsoft.Maui.Controls.Page page) + { + mauiHost._host = page; + page.BindingContext = mauiHost.DataContext; + } + else if (instance is View view) + { + mauiHost._host = view; + page = new ContentPage + { + BindingContext = mauiHost.DataContext, + Content = view + }; + } + else + { + throw new MauiEmbeddingException($"The View '{instance.GetType().FullName}' must be a View or Page."); + } - private static void OnMauiContentChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args) - { -#if MAUI_EMBEDDING - if (args.NewValue is null || - args.NewValue is not MauiView view || - dependencyObject is not MauiHost mauiHost) - { - return; + + var native = page.ToPlatform(mauiContext); + mauiHost.Content = native; } - - if (mauiHost._host is not null) + catch (Exception ex) { - mauiHost._host.Content = view; + var logger = GetLogger(); + if (logger.IsEnabled(LogLevel.Error)) + { + logger.LogError(ex, Properties.Resources.UnableToConvertMauiViewToNativeView); + } +#if DEBUG + System.Diagnostics.Debugger.Break(); +#endif + throw new MauiEmbeddingException(Properties.Resources.UnexpectedErrorConvertingMauiViewToNativeView, ex); } #endif } @@ -57,19 +89,43 @@ args.NewValue is not MauiView view || private static ILogger GetLogger() => IPlatformApplication.Current?.Services.GetRequiredService>() ?? throw new NullReferenceException("MauiEmbedding has not been properly initialized"); - private MauiContentHost? _host; + //private MauiContentHost? _host; + private VisualElement? _host; /// /// Initializes a new instance of the MauiContent class. /// public MauiHost() { - this.HorizontalContentAlignment = HorizontalAlignment.Stretch; - this.VerticalContentAlignment = VerticalAlignment.Stretch; + HorizontalContentAlignment = HorizontalAlignment.Stretch; + VerticalContentAlignment = VerticalAlignment.Stretch; Loading += OnLoading; DataContextChanged += OnDataContextChanged; Unloaded += OnMauiContentUnloaded; + ActualThemeChanged += OnActualThemeChanged; + } + + private void OnActualThemeChanged(FrameworkElement sender, object args) + { + if (IPlatformApplication.Current is null || IPlatformApplication.Current.Application is not MauiApplication app) + return; + + lock(locker) + { + // Try to prevent multiple updates if there are multiple Hosts within an App + var theme = sender.ActualTheme switch + { + ElementTheme.Dark => AppTheme.Dark, + ElementTheme.Light => AppTheme.Light, + _ => AppTheme.Unspecified + }; + + if (app.UserAppTheme != theme) + { + app.UserAppTheme = theme; + } + } } private void OnMauiContentUnloaded(object sender, RoutedEventArgs e) @@ -85,15 +141,6 @@ private void OnMauiContentUnloaded(object sender, RoutedEventArgs e) } #endif - /// - /// Gets or sets the that will be used as content. - /// - private MauiView? MauiContent - { - get => (MauiView)GetValue(MauiContentProperty); - set => SetValue(MauiContentProperty, value); - } - /// /// Gets or sets the of the Maui Content Source /// @@ -105,6 +152,7 @@ public Type? Source #if MAUI_EMBEDDING + private bool _initializedResources; private void OnLoading(FrameworkElement sender, object args) { Loading -= OnLoading; @@ -127,33 +175,10 @@ private void OnLoading(FrameworkElement sender, object args) treeElement = VisualTreeHelper.GetParent(treeElement); } - if (_host is null) + if (!_initializedResources && _host is not null) { - _host = new MauiContentHost(resources.ToMauiResources()) - { - BindingContext = DataContext, - Content = MauiContent - }; - - try - { - var mauiContext = IPlatformApplication.Current!.Application.Handler!.MauiContext!; - var native = _host.ToPlatform(mauiContext); - Content = native; - } - catch (Exception ex) - { - var logger = GetLogger(); - if (logger.IsEnabled(LogLevel.Error)) - { - logger.LogError(ex, Properties.Resources.UnableToConvertMauiViewToNativeView); - } -#if DEBUG - System.Diagnostics.Debugger.Break(); -#endif - throw new MauiEmbeddingException(Properties.Resources.UnexpectedErrorConvertingMauiViewToNativeView, ex); - } - + _host.Resources.MergedDictionaries.Add(resources.ToMauiResources()); + _initializedResources = true; } } diff --git a/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.android.cs b/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.android.cs new file mode 100644 index 0000000000..1eeaa04c41 --- /dev/null +++ b/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.android.cs @@ -0,0 +1,40 @@ +namespace Uno.Extensions.Maui.Platform; + +/// +/// Provides a base Application class for Maui Embedding +/// +public class EmbeddingApplication : Application, IPlatformApplication +{ + private IServiceProvider _serviceProvider = default!; + private IApplication _application = default!; + + IServiceProvider IPlatformApplication.Services => _serviceProvider; + IApplication IPlatformApplication.Application => _application; + + internal void InitializeApplication(IServiceProvider services, IApplication application) + { + _serviceProvider = services; + _application = application; + + // Hack: This is a workaround for https://github.com/dotnet/maui/pull/16803 + HackMauiApplication.Initialize(services, application); + IPlatformApplication.Current = this; + } + + private class HackMauiApplication : Microsoft.Maui.MauiApplication + { + private HackMauiApplication(IServiceProvider services, IApplication application) + : base(0, default) + { + Services = services; + Application = application; + } + + protected override MauiApp CreateMauiApp() => throw new NotImplementedException(); + + public override void OnCreate() { } + + public static HackMauiApplication Initialize(IServiceProvider services, IApplication application) => + new (services, application); + } +} diff --git a/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.apple.cs b/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.apple.cs new file mode 100644 index 0000000000..6f1edd46a1 --- /dev/null +++ b/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.apple.cs @@ -0,0 +1,43 @@ +using Foundation; +using UIKit; + +namespace Uno.Extensions.Maui.Platform; + +/// +/// Provides a base Application class for Maui Embedding +/// +public class EmbeddingApplication : Application, IPlatformApplication +{ + private IServiceProvider _serviceProvider = default!; + private IApplication _application = default!; + + IServiceProvider IPlatformApplication.Services => _serviceProvider; + IApplication IPlatformApplication.Application => _application; + + internal void InitializeApplication(IServiceProvider services, IApplication application) + { + _serviceProvider = services; + _application = application; + + // Hack: This is a workaround for https://github.com/dotnet/maui/pull/16803 + HackMauiUIApplicationDelegate.Initialize(services, application); + IPlatformApplication.Current = this; + } + + private class HackMauiUIApplicationDelegate : MauiUIApplicationDelegate + { + private HackMauiUIApplicationDelegate(IServiceProvider services, IApplication application) + { + Services = services; + Application = application; + } + + public static HackMauiUIApplicationDelegate Initialize(IServiceProvider services, IApplication application) => + new(services, application); + protected override MauiApp CreateMauiApp() => throw new NotImplementedException(); + + public override bool WillFinishLaunching(UIApplication application, NSDictionary launchOptions) => true; + + public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) => true; + } +} diff --git a/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.standard.cs b/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.standard.cs new file mode 100644 index 0000000000..caba48d5f3 --- /dev/null +++ b/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.standard.cs @@ -0,0 +1,8 @@ +namespace Uno.Extensions.Maui.Platform; + +/// +/// Provides a base Application class for Maui Embedding +/// +public class EmbeddingApplication : Application +{ +} diff --git a/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.windows.cs b/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.windows.cs new file mode 100644 index 0000000000..70a2437d72 --- /dev/null +++ b/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.windows.cs @@ -0,0 +1,19 @@ +namespace Uno.Extensions.Maui.Platform; + +/// +/// Provides a base Application class for Maui Embedding +/// +public class EmbeddingApplication : MauiWinUIApplication +{ + /// + protected sealed override MauiApp CreateMauiApp() => throw new NotImplementedException(); + + /// + protected override void OnLaunched(LaunchActivatedEventArgs args) { } + + internal void InitializeApplication(IServiceProvider services, IApplication application) + { + Services = services; + Application = application; + } +} diff --git a/src/Uno.Extensions.Maui.UI/Uno.Extensions.Maui.WinUI.csproj b/src/Uno.Extensions.Maui.UI/Uno.Extensions.Maui.WinUI.csproj index e977ef5a8a..f442a85b28 100644 --- a/src/Uno.Extensions.Maui.UI/Uno.Extensions.Maui.WinUI.csproj +++ b/src/Uno.Extensions.Maui.UI/Uno.Extensions.Maui.WinUI.csproj @@ -72,4 +72,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Uno.Extensions.Maui.UI/build/Package.targets b/src/Uno.Extensions.Maui.UI/build/Package.targets index 3c9fe37500..89c48000bd 100644 --- a/src/Uno.Extensions.Maui.UI/build/Package.targets +++ b/src/Uno.Extensions.Maui.UI/build/Package.targets @@ -6,6 +6,7 @@ + From e7aca06f6c67b1f0aa69feb2d806cdb31da2deff Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sun, 20 Aug 2023 12:43:11 -0600 Subject: [PATCH 04/11] chore: clean up Exception Messages --- .../MauiEmbedding.android.cs | 6 ++-- .../MauiEmbedding.apple.cs | 2 +- .../MauiEmbedding.windows.cs | 2 +- src/Uno.Extensions.Maui.UI/MauiHost.cs | 6 ++-- .../Properties/Resources.Designer.cs | 36 +++++++++++++++++++ .../Properties/Resources.resx | 12 +++++++ 6 files changed, 56 insertions(+), 8 deletions(-) diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs index 468d893f38..11141ef293 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.android.cs @@ -10,7 +10,7 @@ private static MauiAppBuilder RegisterPlatformServices(this MauiAppBuilder build { if (Android.App.Application.Context is not Android.App.Application androidApp) { - throw new MauiEmbeddingException($"Expected 'Android.App.Application.Context' to be 'Android.App.Application', but got '{Android.App.Application.Context.GetType().FullName}'."); + throw new MauiEmbeddingException(string.Format(Properties.Resources.UnexpectedAndroidApplicationContextType, Android.App.Application.Context.GetType().FullName)); } builder.Services.AddSingleton(androidApp) @@ -20,7 +20,7 @@ private static MauiAppBuilder RegisterPlatformServices(this MauiAppBuilder build if (UI.ContextHelper.Current is Android.App.Activity currentActivity) return currentActivity; - throw new MauiEmbeddingException("Could not find a current Activity."); + throw new MauiEmbeddingException(Properties.Resources.CouldNotFindCurrentActivity); }); return builder; } @@ -35,7 +35,7 @@ private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp, Application var iApp = mauiApp.Services.GetRequiredService(); if(app is not EmbeddingApplication embeddingApp) { - throw new MauiEmbeddingException("The provided application must inherit from EmbeddingApplication"); + throw new MauiEmbeddingException(Properties.Resources.TheApplicationMustInheritFromEmbeddingApplication); } embeddingApp.InitializeApplication(scope.ServiceProvider, iApp); diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs index 2a798f2946..cac3bb7ee6 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.apple.cs @@ -23,7 +23,7 @@ private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp, Application var iApp = mauiApp.Services.GetRequiredService(); if (app is not EmbeddingApplication embeddingApp) { - throw new MauiEmbeddingException("The provided application must inherit from EmbeddingApplication"); + throw new MauiEmbeddingException(Properties.Resources.TheApplicationMustInheritFromEmbeddingApplication); } // TODO: Evaluate getting the Root View Controller for a Platform.Init for Maui diff --git a/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs b/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs index 5b4a3132b8..f5e110da3e 100644 --- a/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs +++ b/src/Uno.Extensions.Maui.UI/MauiEmbedding.windows.cs @@ -28,7 +28,7 @@ private static void InitializeMauiEmbeddingApp(this MauiApp mauiApp, Application var iApp = mauiApp.Services.GetRequiredService(); if (app is not EmbeddingApplication embeddingApp) { - throw new MauiEmbeddingException("The provided application must inherit from EmbeddingApplication"); + throw new MauiEmbeddingException(Properties.Resources.TheApplicationMustInheritFromEmbeddingApplication); } //if (_clone is not null) diff --git a/src/Uno.Extensions.Maui.UI/MauiHost.cs b/src/Uno.Extensions.Maui.UI/MauiHost.cs index 8fcc0c2e03..64cb3e19cf 100644 --- a/src/Uno.Extensions.Maui.UI/MauiHost.cs +++ b/src/Uno.Extensions.Maui.UI/MauiHost.cs @@ -1,4 +1,4 @@ -using Microsoft.Maui.ApplicationModel; +using Microsoft.Maui.ApplicationModel; using Uno.Extensions.Maui.Platform; namespace Uno.Extensions.Maui; @@ -62,7 +62,7 @@ dependencyObject is not MauiHost mauiHost || } else { - throw new MauiEmbeddingException($"The View '{instance.GetType().FullName}' must be a View or Page."); + throw new MauiEmbeddingException(string.Format(Properties.Resources.TypeMustInheritFromPageOrView, instance.GetType().FullName)); } @@ -87,7 +87,7 @@ dependencyObject is not MauiHost mauiHost || #if MAUI_EMBEDDING private static ILogger GetLogger() => - IPlatformApplication.Current?.Services.GetRequiredService>() ?? throw new NullReferenceException("MauiEmbedding has not been properly initialized"); + IPlatformApplication.Current?.Services.GetRequiredService>() ?? throw new MauiEmbeddingInitializationException(); //private MauiContentHost? _host; private VisualElement? _host; diff --git a/src/Uno.Extensions.Maui.UI/Properties/Resources.Designer.cs b/src/Uno.Extensions.Maui.UI/Properties/Resources.Designer.cs index c44f4e433c..f94dcb8f60 100644 --- a/src/Uno.Extensions.Maui.UI/Properties/Resources.Designer.cs +++ b/src/Uno.Extensions.Maui.UI/Properties/Resources.Designer.cs @@ -60,6 +60,15 @@ internal Resources() { } } + /// + /// Looks up a localized string similar to Could not find a current Activity.. + /// + internal static string CouldNotFindCurrentActivity { + get { + return ResourceManager.GetString("CouldNotFindCurrentActivity", resourceCulture); + } + } + /// /// Looks up a localized string similar to You must call UseMauiEmbedding from the Application. /// @@ -78,6 +87,24 @@ internal static string NoColorValueProvided { } } + /// + /// Looks up a localized string similar to The provided application must inherit from EmbeddingApplication.. + /// + internal static string TheApplicationMustInheritFromEmbeddingApplication { + get { + return ResourceManager.GetString("TheApplicationMustInheritFromEmbeddingApplication", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The View '{0}' must be a View or Page.. + /// + internal static string TypeMustInheritFromPageOrView { + get { + return ResourceManager.GetString("TypeMustInheritFromPageOrView", resourceCulture); + } + } + /// /// Looks up a localized string similar to There was an unexpected error converting the Maui View to a native Platform view.. /// @@ -96,6 +123,15 @@ internal static string UnableToConvertValueToColor { } } + /// + /// Looks up a localized string similar to Expected 'Android.App.Application.Context' to be 'Android.App.Application', but got '{0}'.. + /// + internal static string UnexpectedAndroidApplicationContextType { + get { + return ResourceManager.GetString("UnexpectedAndroidApplicationContextType", resourceCulture); + } + } + /// /// Looks up a localized string similar to An unexpected error occurred while converting the Maui View to a native View.. /// diff --git a/src/Uno.Extensions.Maui.UI/Properties/Resources.resx b/src/Uno.Extensions.Maui.UI/Properties/Resources.resx index ea2f1a7e2a..8881ee8272 100644 --- a/src/Uno.Extensions.Maui.UI/Properties/Resources.resx +++ b/src/Uno.Extensions.Maui.UI/Properties/Resources.resx @@ -117,18 +117,30 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Could not find a current Activity. + You must call UseMauiEmbedding from the Application No value provided for the Maui Color. + + The provided application must inherit from EmbeddingApplication. + + + The View '{0}' must be a View or Page. + There was an unexpected error converting the Maui View to a native Platform view. Unable to convert '{Value}' to a Maui Color. + + Expected 'Android.App.Application.Context' to be 'Android.App.Application', but got '{0}'. + An unexpected error occurred while converting the Maui View to a native View. From ac73bf63c0e560fcb3f3dc2f22028ec117adf537 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sun, 20 Aug 2023 12:44:29 -0600 Subject: [PATCH 05/11] chore: support Page Lifecycle events --- .../SyncfusionDemoPage.xaml.cs | 2 +- src/Uno.Extensions.Maui.UI/MauiHost.cs | 45 +++++++++++-------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml.cs b/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml.cs index 6742aa1f37..d6aae319e5 100644 --- a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml.cs +++ b/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml.cs @@ -6,4 +6,4 @@ public SyncfusionDemoPage() { InitializeComponent(); } -} \ No newline at end of file +} diff --git a/src/Uno.Extensions.Maui.UI/MauiHost.cs b/src/Uno.Extensions.Maui.UI/MauiHost.cs index 64cb3e19cf..d04cc83810 100644 --- a/src/Uno.Extensions.Maui.UI/MauiHost.cs +++ b/src/Uno.Extensions.Maui.UI/MauiHost.cs @@ -48,14 +48,16 @@ dependencyObject is not MauiHost mauiHost || var instance = ActivatorUtilities.CreateInstance(mauiContext.Services, type); if (instance is Microsoft.Maui.Controls.Page page) { - mauiHost._host = page; + mauiHost.EmbeddedView = page; + page.Parent = app; page.BindingContext = mauiHost.DataContext; } else if (instance is View view) { - mauiHost._host = view; + mauiHost.EmbeddedView = view; page = new ContentPage { + Parent = app, BindingContext = mauiHost.DataContext, Content = view }; @@ -65,7 +67,6 @@ dependencyObject is not MauiHost mauiHost || throw new MauiEmbeddingException(string.Format(Properties.Resources.TypeMustInheritFromPageOrView, instance.GetType().FullName)); } - var native = page.ToPlatform(mauiContext); mauiHost.Content = native; } @@ -89,8 +90,7 @@ dependencyObject is not MauiHost mauiHost || private static ILogger GetLogger() => IPlatformApplication.Current?.Services.GetRequiredService>() ?? throw new MauiEmbeddingInitializationException(); - //private MauiContentHost? _host; - private VisualElement? _host; + private VisualElement? EmbeddedView; /// /// Initializes a new instance of the MauiContent class. @@ -101,6 +101,7 @@ public MauiHost() VerticalContentAlignment = VerticalAlignment.Stretch; Loading += OnLoading; + Loaded += OnMauiContentLoaded; DataContextChanged += OnDataContextChanged; Unloaded += OnMauiContentUnloaded; ActualThemeChanged += OnActualThemeChanged; @@ -128,17 +129,25 @@ private void OnActualThemeChanged(FrameworkElement sender, object args) } } + private void OnMauiContentLoaded(object sender, RoutedEventArgs e) + { + var page = GetPage(EmbeddedView); + page?.SendAppearing(); + } + private void OnMauiContentUnloaded(object sender, RoutedEventArgs e) { - Unloaded -= OnMauiContentUnloaded; - Loading -= OnLoading; - DataContextChanged -= OnDataContextChanged; - if (_host is not null) - { - _host.BindingContext = null; - } - _host = null; + var page = GetPage(EmbeddedView); + page?.SendDisappearing(); } + + private Microsoft.Maui.Controls.Page? GetPage(Element? element) => + element switch + { + Microsoft.Maui.Controls.Page page => page, + null => null, + _ => GetPage(element.Parent) + }; #endif /// @@ -175,19 +184,19 @@ private void OnLoading(FrameworkElement sender, object args) treeElement = VisualTreeHelper.GetParent(treeElement); } - if (!_initializedResources && _host is not null) + if (!_initializedResources && EmbeddedView is not null) { - _host.Resources.MergedDictionaries.Add(resources.ToMauiResources()); + EmbeddedView.Resources.MergedDictionaries.Add(resources.ToMauiResources()); _initializedResources = true; } } void OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) { - if (_host is not null && - _host.BindingContext != DataContext) + if (EmbeddedView is not null && + EmbeddedView.BindingContext != DataContext) { - _host.BindingContext = DataContext; + EmbeddedView.BindingContext = DataContext; } } #endif From 73d82956fdf5578044c468cc0378d4eb74d4d829 Mon Sep 17 00:00:00 2001 From: Nick Randolph Date: Mon, 21 Aug 2023 15:12:50 +1000 Subject: [PATCH 06/11] fix: Removing injected ContentPage --- src/Uno.Extensions.Maui.UI/MauiHost.cs | 29 ++++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/Uno.Extensions.Maui.UI/MauiHost.cs b/src/Uno.Extensions.Maui.UI/MauiHost.cs index d04cc83810..c59270d3e5 100644 --- a/src/Uno.Extensions.Maui.UI/MauiHost.cs +++ b/src/Uno.Extensions.Maui.UI/MauiHost.cs @@ -46,22 +46,29 @@ dependencyObject is not MauiHost mauiHost || // Allow the use of Dependency Injection for the View var instance = ActivatorUtilities.CreateInstance(mauiContext.Services, type); - if (instance is Microsoft.Maui.Controls.Page page) + if(instance is VisualElement page) { mauiHost.EmbeddedView = page; page.Parent = app; page.BindingContext = mauiHost.DataContext; } - else if (instance is View view) - { - mauiHost.EmbeddedView = view; - page = new ContentPage - { - Parent = app, - BindingContext = mauiHost.DataContext, - Content = view - }; - } + // Injecting a ContentPage breaks when height of view is indeterminent (eg in stackpanel) + //if (instance is Microsoft.Maui.Controls.Page page) + //{ + // mauiHost.EmbeddedView = page; + // page.Parent = app; + // page.BindingContext = mauiHost.DataContext; + //} + //else if (instance is View view) + //{ + // mauiHost.EmbeddedView = view; + // page = new ContentPage + // { + // Parent = app, + // BindingContext = mauiHost.DataContext, + // Content = view + // }; + //} else { throw new MauiEmbeddingException(string.Format(Properties.Resources.TypeMustInheritFromPageOrView, instance.GetType().FullName)); From 025f1ec5fb6630cc95bdab343ce13dd46d7aa044 Mon Sep 17 00:00:00 2001 From: Nick Randolph Date: Tue, 22 Aug 2023 00:57:37 +1000 Subject: [PATCH 07/11] fix: Set IPlatformApplication.Current for Windows --- .../Platform/EmbeddingApplication.windows.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.windows.cs b/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.windows.cs index 70a2437d72..b2a1d6c29b 100644 --- a/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.windows.cs +++ b/src/Uno.Extensions.Maui.UI/Platform/EmbeddingApplication.windows.cs @@ -15,5 +15,6 @@ internal void InitializeApplication(IServiceProvider services, IApplication appl { Services = services; Application = application; + IPlatformApplication.Current = this; } } From 45c70b47bf70a3ecc52b1822e95e19153934b5f0 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Mon, 21 Aug 2023 09:41:18 -0600 Subject: [PATCH 08/11] chore: cleanup maui sample --- .../App.xaml | 2 +- .../App.xaml.cs | 2 +- .../AppBuildExtensions.cs | 2 +- .../CustomEntry.cs | 2 +- .../Directory.Build.props | 0 .../Directory.Build.targets | 0 .../Directory.Packages.props | 1 + .../EmbeddedControl.xaml | 15 + .../EmbeddedControl.xaml.cs | 4 +- .../MauiEmbedding.MauiControls.csproj} | 2 +- .../Styles/Colors.xaml | 0 .../Styles/Styles.xaml | 0 .../SyncfusionDemoPage.xaml | 241 +++++++++++ .../SyncfusionDemoPage.xaml.cs | 2 +- .../SyncfusionModels.cs | 8 +- samples/MauiEmbedding/MauiEmbedding.sln | 93 ++-- .../MauiEmbedding/MauiEmbedding.csproj | 4 +- .../MauiEmbedding/Presentation/MainPage.xaml | 2 +- .../MauiProjects/Directory.Packages.props | 1 - .../MauiProjects/MauiApp1/App.xaml | 14 - .../MauiProjects/MauiApp1/App.xaml.cs | 11 - .../MauiProjects/MauiApp1/AppShell.xaml | 14 - .../MauiProjects/MauiApp1/AppShell.xaml.cs | 9 - .../MauiProjects/MauiApp1/MainPage.xaml | 63 --- .../MauiProjects/MauiApp1/MainPage.xaml.cs | 71 --- .../MauiProjects/MauiApp1/MauiApp1.csproj | 61 --- .../MauiProjects/MauiApp1/MauiProgram.cs | 31 -- .../Platforms/Android/AndroidManifest.xml | 6 - .../Platforms/Android/MainActivity.cs | 9 - .../Platforms/Android/MainApplication.cs | 14 - .../Android/Resources/values/colors.xml | 6 - .../Platforms/MacCatalyst/AppDelegate.cs | 8 - .../MauiApp1/Platforms/MacCatalyst/Info.plist | 30 -- .../MauiApp1/Platforms/MacCatalyst/Program.cs | 14 - .../MauiApp1/Platforms/Tizen/Main.cs | 16 - .../Platforms/Tizen/tizen-manifest.xml | 15 - .../MauiApp1/Platforms/Windows/App.xaml | 8 - .../MauiApp1/Platforms/Windows/App.xaml.cs | 23 - .../Platforms/Windows/Package.appxmanifest | 46 -- .../MauiApp1/Platforms/Windows/app.manifest | 15 - .../MauiApp1/Platforms/iOS/AppDelegate.cs | 8 - .../MauiApp1/Platforms/iOS/Info.plist | 32 -- .../MauiApp1/Platforms/iOS/Program.cs | 14 - .../MauiApp1/Resources/AppIcon/appicon.svg | 4 - .../MauiApp1/Resources/AppIcon/appiconfg.svg | 8 - .../Resources/Fonts/OpenSans-Regular.ttf | Bin 107184 -> 0 bytes .../Resources/Fonts/OpenSans-Semibold.ttf | Bin 111076 -> 0 bytes .../MauiApp1/Resources/Images/dotnet_bot.svg | 93 ---- .../MauiApp1/Resources/Raw/AboutAssets.txt | 15 - .../MauiApp1/Resources/Splash/splash.svg | 8 - .../MauiControlsExternal/EmbeddedControl.xaml | 14 - .../MauiControlsExternal/Styles/Colors.xaml | 44 -- .../MauiControlsExternal/Styles/Styles.xaml | 405 ------------------ .../SyncfusionDemoPage.xaml | 241 ----------- .../New folder/Directory.Build.props | 2 - .../New folder/Directory.Build.targets | 1 - 56 files changed, 302 insertions(+), 1452 deletions(-) rename samples/MauiEmbedding/{MauiProjects/MauiControlsExternal => MauiEmbedding.MauiControls}/App.xaml (92%) rename samples/MauiEmbedding/{MauiProjects/MauiControlsExternal => MauiEmbedding.MauiControls}/App.xaml.cs (68%) rename samples/MauiEmbedding/{MauiProjects/MauiControlsExternal => MauiEmbedding.MauiControls}/AppBuildExtensions.cs (86%) rename samples/MauiEmbedding/{MauiProjects/MauiControlsExternal => MauiEmbedding.MauiControls}/CustomEntry.cs (97%) rename samples/MauiEmbedding/{MauiProjects => MauiEmbedding.MauiControls}/Directory.Build.props (100%) rename samples/MauiEmbedding/{MauiProjects => MauiEmbedding.MauiControls}/Directory.Build.targets (100%) create mode 100644 samples/MauiEmbedding/MauiEmbedding.MauiControls/Directory.Packages.props create mode 100644 samples/MauiEmbedding/MauiEmbedding.MauiControls/EmbeddedControl.xaml rename samples/MauiEmbedding/{MauiProjects/MauiControlsExternal => MauiEmbedding.MauiControls}/EmbeddedControl.xaml.cs (73%) rename samples/MauiEmbedding/{MauiProjects/MauiControlsExternal/MauiControlsExternal.csproj => MauiEmbedding.MauiControls/MauiEmbedding.MauiControls.csproj} (97%) rename samples/MauiEmbedding/{MauiProjects/MauiApp1/Resources => MauiEmbedding.MauiControls}/Styles/Colors.xaml (100%) rename samples/MauiEmbedding/{MauiProjects/MauiApp1/Resources => MauiEmbedding.MauiControls}/Styles/Styles.xaml (100%) create mode 100644 samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml rename samples/MauiEmbedding/{MauiProjects/MauiControlsExternal => MauiEmbedding.MauiControls}/SyncfusionDemoPage.xaml.cs (75%) rename samples/MauiEmbedding/{MauiProjects/MauiControlsExternal => MauiEmbedding.MauiControls}/SyncfusionModels.cs (99%) delete mode 100644 samples/MauiEmbedding/MauiProjects/Directory.Packages.props delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/App.xaml delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/App.xaml.cs delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/AppShell.xaml delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/AppShell.xaml.cs delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/MainPage.xaml delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/MainPage.xaml.cs delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/MauiApp1.csproj delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/MauiProgram.cs delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/Android/AndroidManifest.xml delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/Android/MainActivity.cs delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/Android/MainApplication.cs delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/Android/Resources/values/colors.xml delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/MacCatalyst/AppDelegate.cs delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/MacCatalyst/Info.plist delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/MacCatalyst/Program.cs delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/Tizen/Main.cs delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/Tizen/tizen-manifest.xml delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/Windows/App.xaml delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/Windows/App.xaml.cs delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/Windows/Package.appxmanifest delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/Windows/app.manifest delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/iOS/AppDelegate.cs delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/iOS/Info.plist delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Platforms/iOS/Program.cs delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Resources/AppIcon/appicon.svg delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Resources/AppIcon/appiconfg.svg delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Resources/Fonts/OpenSans-Regular.ttf delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Resources/Fonts/OpenSans-Semibold.ttf delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Resources/Images/dotnet_bot.svg delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Resources/Raw/AboutAssets.txt delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiApp1/Resources/Splash/splash.svg delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiControlsExternal/EmbeddedControl.xaml delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiControlsExternal/Styles/Colors.xaml delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiControlsExternal/Styles/Styles.xaml delete mode 100644 samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml delete mode 100644 samples/MauiEmbedding/MauiProjects/New folder/Directory.Build.props delete mode 100644 samples/MauiEmbedding/MauiProjects/New folder/Directory.Build.targets diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/App.xaml b/samples/MauiEmbedding/MauiEmbedding.MauiControls/App.xaml similarity index 92% rename from samples/MauiEmbedding/MauiProjects/MauiControlsExternal/App.xaml rename to samples/MauiEmbedding/MauiEmbedding.MauiControls/App.xaml index f4c3f85e8e..1af912c4b8 100644 --- a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/App.xaml +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/App.xaml @@ -2,7 +2,7 @@ + x:Class="MauiEmbedding.MauiControls.App"> diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/App.xaml.cs b/samples/MauiEmbedding/MauiEmbedding.MauiControls/App.xaml.cs similarity index 68% rename from samples/MauiEmbedding/MauiProjects/MauiControlsExternal/App.xaml.cs rename to samples/MauiEmbedding/MauiEmbedding.MauiControls/App.xaml.cs index ec52501f06..dad6bf0160 100644 --- a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/App.xaml.cs +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/App.xaml.cs @@ -1,4 +1,4 @@ -namespace MauiControlsExternal; +namespace MauiEmbedding.MauiControls; public partial class App : Application { diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/AppBuildExtensions.cs b/samples/MauiEmbedding/MauiEmbedding.MauiControls/AppBuildExtensions.cs similarity index 86% rename from samples/MauiEmbedding/MauiProjects/MauiControlsExternal/AppBuildExtensions.cs rename to samples/MauiEmbedding/MauiEmbedding.MauiControls/AppBuildExtensions.cs index 9dba92c921..ee6bec10b7 100644 --- a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/AppBuildExtensions.cs +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/AppBuildExtensions.cs @@ -1,6 +1,6 @@ using Syncfusion.Maui.Core.Hosting; -namespace MauiControlsExternal; +namespace MauiEmbedding.MauiControls; public static class MauiAppBuilderExtensions { diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/CustomEntry.cs b/samples/MauiEmbedding/MauiEmbedding.MauiControls/CustomEntry.cs similarity index 97% rename from samples/MauiEmbedding/MauiProjects/MauiControlsExternal/CustomEntry.cs rename to samples/MauiEmbedding/MauiEmbedding.MauiControls/CustomEntry.cs index fa09ded511..f8047d4f8d 100644 --- a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/CustomEntry.cs +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/CustomEntry.cs @@ -1,7 +1,7 @@ using Microsoft.Maui.Handlers; using Microsoft.Maui.Platform; -namespace MauiControlsExternal; +namespace MauiEmbedding.MauiControls; // All the code in this file is included in all platforms. public class CustomEntry : Entry diff --git a/samples/MauiEmbedding/MauiProjects/Directory.Build.props b/samples/MauiEmbedding/MauiEmbedding.MauiControls/Directory.Build.props similarity index 100% rename from samples/MauiEmbedding/MauiProjects/Directory.Build.props rename to samples/MauiEmbedding/MauiEmbedding.MauiControls/Directory.Build.props diff --git a/samples/MauiEmbedding/MauiProjects/Directory.Build.targets b/samples/MauiEmbedding/MauiEmbedding.MauiControls/Directory.Build.targets similarity index 100% rename from samples/MauiEmbedding/MauiProjects/Directory.Build.targets rename to samples/MauiEmbedding/MauiEmbedding.MauiControls/Directory.Build.targets diff --git a/samples/MauiEmbedding/MauiEmbedding.MauiControls/Directory.Packages.props b/samples/MauiEmbedding/MauiEmbedding.MauiControls/Directory.Packages.props new file mode 100644 index 0000000000..f5b4dd610b --- /dev/null +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/Directory.Packages.props @@ -0,0 +1 @@ + diff --git a/samples/MauiEmbedding/MauiEmbedding.MauiControls/EmbeddedControl.xaml b/samples/MauiEmbedding/MauiEmbedding.MauiControls/EmbeddedControl.xaml new file mode 100644 index 0000000000..dc0e0a7876 --- /dev/null +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/EmbeddedControl.xaml @@ -0,0 +1,15 @@ + + + + + diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/EmbeddedControl.xaml.cs b/samples/MauiEmbedding/MauiEmbedding.MauiControls/EmbeddedControl.xaml.cs similarity index 73% rename from samples/MauiEmbedding/MauiProjects/MauiControlsExternal/EmbeddedControl.xaml.cs rename to samples/MauiEmbedding/MauiEmbedding.MauiControls/EmbeddedControl.xaml.cs index a6a9c9b653..4ad16f2d75 100644 --- a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/EmbeddedControl.xaml.cs +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/EmbeddedControl.xaml.cs @@ -1,4 +1,4 @@ -namespace MauiControlsExternal; +namespace MauiEmbedding.MauiControls; public partial class EmbeddedControl : ContentView { @@ -6,4 +6,4 @@ public EmbeddedControl() { InitializeComponent(); } -} \ No newline at end of file +} diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/MauiControlsExternal.csproj b/samples/MauiEmbedding/MauiEmbedding.MauiControls/MauiEmbedding.MauiControls.csproj similarity index 97% rename from samples/MauiEmbedding/MauiProjects/MauiControlsExternal/MauiControlsExternal.csproj rename to samples/MauiEmbedding/MauiEmbedding.MauiControls/MauiEmbedding.MauiControls.csproj index eddc8a304f..a52cd32952 100644 --- a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/MauiControlsExternal.csproj +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/MauiEmbedding.MauiControls.csproj @@ -1,4 +1,4 @@ - + net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst diff --git a/samples/MauiEmbedding/MauiProjects/MauiApp1/Resources/Styles/Colors.xaml b/samples/MauiEmbedding/MauiEmbedding.MauiControls/Styles/Colors.xaml similarity index 100% rename from samples/MauiEmbedding/MauiProjects/MauiApp1/Resources/Styles/Colors.xaml rename to samples/MauiEmbedding/MauiEmbedding.MauiControls/Styles/Colors.xaml diff --git a/samples/MauiEmbedding/MauiProjects/MauiApp1/Resources/Styles/Styles.xaml b/samples/MauiEmbedding/MauiEmbedding.MauiControls/Styles/Styles.xaml similarity index 100% rename from samples/MauiEmbedding/MauiProjects/MauiApp1/Resources/Styles/Styles.xaml rename to samples/MauiEmbedding/MauiEmbedding.MauiControls/Styles/Styles.xaml diff --git a/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml b/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml new file mode 100644 index 0000000000..84e887e2fd --- /dev/null +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml.cs b/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml.cs similarity index 75% rename from samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml.cs rename to samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml.cs index d6aae319e5..85d8c54bb4 100644 --- a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionDemoPage.xaml.cs +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionDemoPage.xaml.cs @@ -1,4 +1,4 @@ -namespace MauiControlsExternal; +namespace MauiEmbedding.MauiControls; public partial class SyncfusionDemoPage : ContentPage { diff --git a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionModels.cs b/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionModels.cs similarity index 99% rename from samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionModels.cs rename to samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionModels.cs index 4627d404b1..66b63ee1b2 100644 --- a/samples/MauiEmbedding/MauiProjects/MauiControlsExternal/SyncfusionModels.cs +++ b/samples/MauiEmbedding/MauiEmbedding.MauiControls/SyncfusionModels.cs @@ -13,7 +13,7 @@ using Microsoft.Maui.Graphics.Win2D; #endif -namespace MauiControlsExternal; +namespace MauiEmbedding.MauiControls; public class ChartDataModel { @@ -687,7 +687,7 @@ public class TeamViewModel : INotifyPropertyChanged #region Constructor /// - /// Initializes a new instance of the GettingStartedViewModel class. + /// Initializes a new instance of the GettingStartedViewModel class. /// public TeamViewModel() { @@ -1199,7 +1199,7 @@ public ObservableCollection GetOrderDetails(int count) internal delegate void FilterChanged(); /// - /// Gets or sets the value of FilterText and notifies user when value gets changed + /// Gets or sets the value of FilterText and notifies user when value gets changed /// public string? FilterText { @@ -1821,7 +1821,7 @@ public double Freight } /// - /// + /// /// public double Price { diff --git a/samples/MauiEmbedding/MauiEmbedding.sln b/samples/MauiEmbedding/MauiEmbedding.sln index b3166de764..cbc151f4ae 100644 --- a/samples/MauiEmbedding/MauiEmbedding.sln +++ b/samples/MauiEmbedding/MauiEmbedding.sln @@ -76,11 +76,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions Items", "Extensi ..\..\src\tfms-ui-maui.props = ..\..\src\tfms-ui-maui.props EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MauiProjects", "MauiProjects", "{24511BF4-9869-4773-AF84-CC8F79AF5085}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiControlsExternal", "MauiProjects\MauiControlsExternal\MauiControlsExternal.csproj", "{A158CC84-0219-4BE4-A3F2-7AB7F613855A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiApp1", "MauiProjects\MauiApp1\MauiApp1.csproj", "{8577882E-DA52-4D27-A529-C70998034566}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MauiEmbedding.MauiControls", "MauiEmbedding.MauiControls\MauiEmbedding.MauiControls.csproj", "{2608CAF0-E84A-4C35-9206-59906AE4E079}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -820,62 +816,34 @@ Global {8493BB1F-62E7-4E18-92A6-4DD5635DCA32}.Release|x64.Build.0 = Release|Any CPU {8493BB1F-62E7-4E18-92A6-4DD5635DCA32}.Release|x86.ActiveCfg = Release|Any CPU {8493BB1F-62E7-4E18-92A6-4DD5635DCA32}.Release|x86.Build.0 = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|ARM.ActiveCfg = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|ARM.Build.0 = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|ARM64.Build.0 = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|iPhone.Build.0 = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|x64.ActiveCfg = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|x64.Build.0 = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|x86.ActiveCfg = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Debug|x86.Build.0 = Debug|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|Any CPU.Build.0 = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|ARM.ActiveCfg = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|ARM.Build.0 = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|ARM64.ActiveCfg = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|ARM64.Build.0 = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|iPhone.ActiveCfg = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|iPhone.Build.0 = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|x64.ActiveCfg = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|x64.Build.0 = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|x86.ActiveCfg = Release|Any CPU - {A158CC84-0219-4BE4-A3F2-7AB7F613855A}.Release|x86.Build.0 = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|ARM.ActiveCfg = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|ARM.Build.0 = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|ARM64.Build.0 = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|iPhone.Build.0 = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|x64.ActiveCfg = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|x64.Build.0 = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|x86.ActiveCfg = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Debug|x86.Build.0 = Debug|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|Any CPU.Build.0 = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|ARM.ActiveCfg = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|ARM.Build.0 = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|ARM64.ActiveCfg = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|ARM64.Build.0 = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|iPhone.ActiveCfg = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|iPhone.Build.0 = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|x64.ActiveCfg = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|x64.Build.0 = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|x86.ActiveCfg = Release|Any CPU - {8577882E-DA52-4D27-A529-C70998034566}.Release|x86.Build.0 = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|ARM.ActiveCfg = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|ARM.Build.0 = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|ARM64.Build.0 = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|iPhone.Build.0 = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|x64.ActiveCfg = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|x64.Build.0 = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|x86.ActiveCfg = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Debug|x86.Build.0 = Debug|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|Any CPU.Build.0 = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|ARM.ActiveCfg = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|ARM.Build.0 = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|ARM64.ActiveCfg = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|ARM64.Build.0 = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|iPhone.ActiveCfg = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|iPhone.Build.0 = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|x64.ActiveCfg = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|x64.Build.0 = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|x86.ActiveCfg = Release|Any CPU + {2608CAF0-E84A-4C35-9206-59906AE4E079}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -908,8 +876,7 @@ Global {32BD5829-65A9-406E-97D8-752556E23B2B} = {9B9F35D5-E6DD-4FC7-9198-F8246D3CE366} {8493BB1F-62E7-4E18-92A6-4DD5635DCA32} = {9B9F35D5-E6DD-4FC7-9198-F8246D3CE366} {9F4A5914-3D10-4CDE-829C-BE53A9E441DB} = {9B9F35D5-E6DD-4FC7-9198-F8246D3CE366} - {A158CC84-0219-4BE4-A3F2-7AB7F613855A} = {24511BF4-9869-4773-AF84-CC8F79AF5085} - {8577882E-DA52-4D27-A529-C70998034566} = {24511BF4-9869-4773-AF84-CC8F79AF5085} + {2608CAF0-E84A-4C35-9206-59906AE4E079} = {D958D411-DCBD-4FBF-828F-FDD7059862EA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {584E156C-C094-4968-8A1F-3FB06081E34D} diff --git a/samples/MauiEmbedding/MauiEmbedding/MauiEmbedding.csproj b/samples/MauiEmbedding/MauiEmbedding/MauiEmbedding.csproj index a2dffc08d6..9c920cc641 100644 --- a/samples/MauiEmbedding/MauiEmbedding/MauiEmbedding.csproj +++ b/samples/MauiEmbedding/MauiEmbedding/MauiEmbedding.csproj @@ -1,4 +1,4 @@ - + @@ -78,7 +78,7 @@ - + diff --git a/samples/MauiEmbedding/MauiEmbedding/Presentation/MainPage.xaml b/samples/MauiEmbedding/MauiEmbedding/Presentation/MainPage.xaml index 71cb60c1da..6d7fbde370 100644 --- a/samples/MauiEmbedding/MauiEmbedding/Presentation/MainPage.xaml +++ b/samples/MauiEmbedding/MauiEmbedding/Presentation/MainPage.xaml @@ -6,7 +6,7 @@ xmlns:uen="using:Uno.Extensions.Navigation.UI" xmlns:embed="using:Uno.Extensions.Maui" xmlns:utu="using:Uno.Toolkit.UI" - xmlns:external="using:MauiControlsExternal" + xmlns:external="using:MauiEmbedding.MauiControls" xmlns:maui="using:Microsoft.Maui.Controls" NavigationCacheMode="Required" mc:Ignorable="d"> diff --git a/samples/MauiEmbedding/MauiProjects/Directory.Packages.props b/samples/MauiEmbedding/MauiProjects/Directory.Packages.props deleted file mode 100644 index 17999977b6..0000000000 --- a/samples/MauiEmbedding/MauiProjects/Directory.Packages.props +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/samples/MauiEmbedding/MauiProjects/MauiApp1/App.xaml b/samples/MauiEmbedding/MauiProjects/MauiApp1/App.xaml deleted file mode 100644 index 8fb5f38c68..0000000000 --- a/samples/MauiEmbedding/MauiProjects/MauiApp1/App.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - diff --git a/samples/MauiEmbedding/MauiProjects/MauiApp1/App.xaml.cs b/samples/MauiEmbedding/MauiProjects/MauiApp1/App.xaml.cs deleted file mode 100644 index dfe78276f5..0000000000 --- a/samples/MauiEmbedding/MauiProjects/MauiApp1/App.xaml.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace MauiApp1; - -public partial class App : Application -{ - public App() - { - InitializeComponent(); - - MainPage = new AppShell(); - } -} diff --git a/samples/MauiEmbedding/MauiProjects/MauiApp1/AppShell.xaml b/samples/MauiEmbedding/MauiProjects/MauiApp1/AppShell.xaml deleted file mode 100644 index b1bb675987..0000000000 --- a/samples/MauiEmbedding/MauiProjects/MauiApp1/AppShell.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - diff --git a/samples/MauiEmbedding/MauiProjects/MauiApp1/AppShell.xaml.cs b/samples/MauiEmbedding/MauiProjects/MauiApp1/AppShell.xaml.cs deleted file mode 100644 index 831b83ba1f..0000000000 --- a/samples/MauiEmbedding/MauiProjects/MauiApp1/AppShell.xaml.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace MauiApp1; - -public partial class AppShell : Shell -{ - public AppShell() - { - InitializeComponent(); - } -} diff --git a/samples/MauiEmbedding/MauiProjects/MauiApp1/MainPage.xaml b/samples/MauiEmbedding/MauiProjects/MauiApp1/MainPage.xaml deleted file mode 100644 index f9657596c0..0000000000 --- a/samples/MauiEmbedding/MauiProjects/MauiApp1/MainPage.xaml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - -