diff --git a/src/Uno.Extensions.Maui/GlobalUsings.cs b/src/Uno.Extensions.Maui/GlobalUsings.cs index e62d2bcf98..478718dd08 100644 --- a/src/Uno.Extensions.Maui/GlobalUsings.cs +++ b/src/Uno.Extensions.Maui/GlobalUsings.cs @@ -24,6 +24,6 @@ global using WinUIColor = Windows.UI.Color; global using NativeMauiColor = Microsoft.Maui.Graphics.Color; global using MauiResourceDictionary = Microsoft.Maui.Controls.ResourceDictionary; -global using MauiConverter = Microsoft.Maui.Controls.IValueConverter; -global using WinUIConverter = Microsoft.UI.Xaml.Data.IValueConverter; +global using IMauiConverter = Microsoft.Maui.Controls.IValueConverter; +global using IWinUIConverter = Microsoft.UI.Xaml.Data.IValueConverter; diff --git a/src/Uno.Extensions.Maui/Internals/ConversionExtensions.cs b/src/Uno.Extensions.Maui/Internals/ConversionExtensions.cs index 6080cec2b7..d6dd287622 100644 --- a/src/Uno.Extensions.Maui/Internals/ConversionExtensions.cs +++ b/src/Uno.Extensions.Maui/Internals/ConversionExtensions.cs @@ -25,16 +25,18 @@ public static Microsoft.Maui.Controls.ResourceDictionary ToMauiResources(this Re private static void TryAddValue(ref Microsoft.Maui.Controls.ResourceDictionary resources, object sourceKey, object value) { - if (value is Style winUIStyle) - { - // This needs to be nested to prevent further processing if we cannot generate a Maui Style - if(Interop.MauiInterop.TryGetStyle(winUIStyle, out var style) && style != null) - { - var key = sourceKey is string str ? str : style.TargetType.FullName; - resources[key] = style; - } - } - else if (sourceKey is string key && !string.IsNullOrEmpty(key) && !resources.ContainsKey(key)) + // NOTE: Interop was part of the POC and is out of scope for the MVP + // if (value is Style winUIStyle) + // { + // // This needs to be nested to prevent further processing if we cannot generate a Maui Style + // if(Interop.MauiInterop.TryGetStyle(winUIStyle, out var style) && style != null) + // { + // var key = sourceKey is string str ? str : style.TargetType.FullName; + // resources[key] = style; + // } + // } + // else + if (sourceKey is string key && !string.IsNullOrEmpty(key) && !resources.ContainsKey(key)) { var mauiValue = ConversionHelpers.ToMauiValue(value); resources[key] = mauiValue ?? value; diff --git a/src/Uno.Extensions.Maui/Internals/ConversionHelpers.cs b/src/Uno.Extensions.Maui/Internals/ConversionHelpers.cs index a28e5ce4a5..5739f7782c 100644 --- a/src/Uno.Extensions.Maui/Internals/ConversionHelpers.cs +++ b/src/Uno.Extensions.Maui/Internals/ConversionHelpers.cs @@ -14,7 +14,7 @@ internal static class ConversionHelpers int valueAsInt => valueAsInt, double valueAsDouble => valueAsDouble, float valueAsFloat => valueAsFloat, - WinUIConverter converter => new UnoHostConverter(converter), + IWinUIConverter converter => new UnoHostConverter(converter), SolidColorBrush solidColorBrush => new Microsoft.Maui.Controls.SolidColorBrush(new NativeMauiColor(solidColorBrush.Color.R, solidColorBrush.Color.G, solidColorBrush.Color.B, solidColorBrush.Color.A)), WinUIColor color => new NativeMauiColor(color.R, color.G, color.B, color.A), Thickness thickness => new Microsoft.Maui.Thickness(thickness.Left, thickness.Top, thickness.Right, thickness.Bottom), @@ -42,11 +42,11 @@ private static LayoutOptions GetLayoutOptions(VerticalAlignment alignment) => _ => LayoutOptions.Fill }; - private class UnoHostConverter : MauiConverter + private class UnoHostConverter : IMauiConverter { - private WinUIConverter _converter { get; } + private IWinUIConverter _converter { get; } - public UnoHostConverter(WinUIConverter converter) => _converter = converter; + public UnoHostConverter(IWinUIConverter converter) => _converter = converter; public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => _converter.Convert(value, targetType, parameter, culture.Name); diff --git a/src/Uno.Extensions.Maui/MauiBinding.cs b/src/Uno.Extensions.Maui/MauiBinding.cs index 72bc991834..c1f20e1d36 100644 --- a/src/Uno.Extensions.Maui/MauiBinding.cs +++ b/src/Uno.Extensions.Maui/MauiBinding.cs @@ -25,15 +25,15 @@ protected override void SetValue(View view, Type viewType, Type propertyType, Mi } - MauiConverter? converter = null; - if (Converter is MauiConverter converterAsMauiConverter) + IMauiConverter? converter = null; + if (Converter is IMauiConverter converterAsMauiConverter) { converter = converterAsMauiConverter; } - else if (Converter is WinUIConverter winUIConverter) + else if (Converter is IWinUIConverter winUIConverter) { var value = ConversionHelpers.ToMauiValue(winUIConverter); - if (value is MauiConverter mauiConverter) + if (value is IMauiConverter mauiConverter) { converter = mauiConverter; } diff --git a/src/Uno.Extensions.Maui/MauiEmbedding.cs b/src/Uno.Extensions.Maui/MauiEmbedding.cs index ab2951e0b8..d1edcc1bad 100644 --- a/src/Uno.Extensions.Maui/MauiEmbedding.cs +++ b/src/Uno.Extensions.Maui/MauiEmbedding.cs @@ -51,6 +51,8 @@ public static void UseMauiEmbedding(this Microsoft.UI.Xaml.Application app, Acti } #endif + // NOTE: This was part of the POC and is out of scope for the MVP. Keeping it in case we want to add it back later. + /* public static MauiAppBuilder MapControl(this MauiAppBuilder builder) where TWinUI : FrameworkElement where TMaui : Microsoft.Maui.Controls.View @@ -65,4 +67,5 @@ public static MauiAppBuilder MapStyleHandler(this MauiAppBuilder build Interop.MauiInterop.MapStyleHandler(); return builder; } + */ } diff --git a/src/Uno.Extensions.Maui/Uno.Extensions.Maui.WinUI.csproj b/src/Uno.Extensions.Maui/Uno.Extensions.Maui.WinUI.csproj index 972dad9a92..475aac60cd 100644 --- a/src/Uno.Extensions.Maui/Uno.Extensions.Maui.WinUI.csproj +++ b/src/Uno.Extensions.Maui/Uno.Extensions.Maui.WinUI.csproj @@ -1,13 +1,13 @@  - net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst - $(TargetFrameworks);net7.0-windows10.0.19041 + net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst + $(TargetFrameworks);net6.0-windows10.0.19041 true Uno.Extensions.Maui $(NoWarn);CS1591;NU5104;NU5048;NU1009 Extensions to embed .NET MAUI controls within your Uno app. - $(DefineConstants);NO_PLATFORM + $(DefineConstants);NO_PLATFORM @@ -31,9 +31,7 @@ - - 10.0.17763.0 - $(TargetPlatformMinVersion) - win10-x86;win10-x64;win10-arm64 - + + +