diff --git a/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Android.cs b/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Android.cs index 51c4f54d2ee1..eb643d760148 100644 --- a/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Android.cs +++ b/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Android.cs @@ -6,12 +6,12 @@ public partial class ActivityIndicatorHandler : ViewHandler new ProgressBar(Context) { Indeterminate = true }; - public static void MapIsRunning(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) + public static partial void MapIsRunning(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) { handler.PlatformView?.UpdateIsRunning(activityIndicator); } - public static void MapColor(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) + public static partial void MapColor(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) { handler.PlatformView?.UpdateColor(activityIndicator); } diff --git a/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Standard.cs b/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Standard.cs index 8b18b0b8051e..004bfea0541c 100644 --- a/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Standard.cs +++ b/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Standard.cs @@ -6,7 +6,7 @@ public partial class ActivityIndicatorHandler : ViewHandler throw new NotImplementedException(); - public static void MapIsRunning(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) { } - public static void MapColor(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) { } + public static partial void MapIsRunning(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) { } + public static partial void MapColor(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) { } } } \ No newline at end of file diff --git a/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Tizen.cs b/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Tizen.cs index 5338c9ec4580..15ee2a3f5ecb 100644 --- a/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Tizen.cs +++ b/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Tizen.cs @@ -6,12 +6,12 @@ public partial class ActivityIndicatorHandler : ViewHandler new ActivityIndicator(); - public static void MapIsRunning(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) + public static partial void MapIsRunning(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) { handler.PlatformView?.UpdateIsRunning(activityIndicator); } - public static void MapColor(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) + public static partial void MapColor(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) { handler.PlatformView?.UpdateColor(activityIndicator); } diff --git a/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Windows.cs b/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Windows.cs index 1abce2d90178..bd52f184d577 100644 --- a/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Windows.cs +++ b/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.Windows.cs @@ -15,23 +15,23 @@ public partial class ActivityIndicatorHandler : ViewHandler + /// Represents the view handler for the abstract view and its platform-specific implementation. + /// + /// Conceptual documentation on handlers public partial class ActivityIndicatorHandler : IActivityIndicatorHandler { public static IPropertyMapper Mapper = new PropertyMapper(ViewHandler.ViewMapper) @@ -49,5 +53,42 @@ public ActivityIndicatorHandler(IPropertyMapper? mapper, CommandMapper? commandM IActivityIndicator IActivityIndicatorHandler.VirtualView => VirtualView; PlatformView IActivityIndicatorHandler.PlatformView => PlatformView; + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapIsRunning(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator); + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapColor(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator); + +#if WINDOWS + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapWidth(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator); + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapHeight(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator); + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapBackground(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator); +#endif } } \ No newline at end of file diff --git a/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.iOS.cs b/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.iOS.cs index 66482a307d0c..e3fc6d68a8df 100644 --- a/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.iOS.cs +++ b/src/Core/src/Handlers/ActivityIndicator/ActivityIndicatorHandler.iOS.cs @@ -19,12 +19,12 @@ protected override MauiActivityIndicator CreatePlatformView() return platformView; } - public static void MapIsRunning(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) + public static partial void MapIsRunning(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) { handler.PlatformView?.UpdateIsRunning(activityIndicator); } - public static void MapColor(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) + public static partial void MapColor(IActivityIndicatorHandler handler, IActivityIndicator activityIndicator) { handler.PlatformView?.UpdateColor(activityIndicator); } diff --git a/src/Core/src/Handlers/Application/ApplicationHandler.Android.cs b/src/Core/src/Handlers/Application/ApplicationHandler.Android.cs index 6691c9dd14cc..5304c02b1b5e 100644 --- a/src/Core/src/Handlers/Application/ApplicationHandler.Android.cs +++ b/src/Core/src/Handlers/Application/ApplicationHandler.Android.cs @@ -5,7 +5,7 @@ namespace Microsoft.Maui.Handlers { public partial class ApplicationHandler : ElementHandler { - public static void MapTerminate(ApplicationHandler handler, IApplication application, object? args) + public static partial void MapTerminate(ApplicationHandler handler, IApplication application, object? args) { var currentActivity = ApplicationModel.Platform.CurrentActivity; @@ -17,12 +17,12 @@ public static void MapTerminate(ApplicationHandler handler, IApplication applica } } - public static void MapOpenWindow(ApplicationHandler handler, IApplication application, object? args) + public static partial void MapOpenWindow(ApplicationHandler handler, IApplication application, object? args) { handler.PlatformView?.RequestNewWindow(application, args as OpenWindowRequest); } - public static void MapCloseWindow(ApplicationHandler handler, IApplication application, object? args) + public static partial void MapCloseWindow(ApplicationHandler handler, IApplication application, object? args) { if (args is IWindow window) { diff --git a/src/Core/src/Handlers/Application/ApplicationHandler.Standard.cs b/src/Core/src/Handlers/Application/ApplicationHandler.Standard.cs index 0ef7c8cb0eb7..74c8f097d908 100644 --- a/src/Core/src/Handlers/Application/ApplicationHandler.Standard.cs +++ b/src/Core/src/Handlers/Application/ApplicationHandler.Standard.cs @@ -6,8 +6,8 @@ public partial class ApplicationHandler : ElementHandler { protected override object CreatePlatformElement() => throw new NotImplementedException(); - public static void MapTerminate(ApplicationHandler handler, IApplication application, object? args) { } - public static void MapOpenWindow(ApplicationHandler handler, IApplication application, object? args) { } - public static void MapCloseWindow(ApplicationHandler handler, IApplication application, object? args) { } + public static partial void MapTerminate(ApplicationHandler handler, IApplication application, object? args) { } + public static partial void MapOpenWindow(ApplicationHandler handler, IApplication application, object? args) { } + public static partial void MapCloseWindow(ApplicationHandler handler, IApplication application, object? args) { } } } \ No newline at end of file diff --git a/src/Core/src/Handlers/Application/ApplicationHandler.Tizen.cs b/src/Core/src/Handlers/Application/ApplicationHandler.Tizen.cs index 9234f3d3fa1f..05e4fae185f6 100644 --- a/src/Core/src/Handlers/Application/ApplicationHandler.Tizen.cs +++ b/src/Core/src/Handlers/Application/ApplicationHandler.Tizen.cs @@ -5,17 +5,17 @@ namespace Microsoft.Maui.Handlers { public partial class ApplicationHandler : ElementHandler { - public static void MapTerminate(ApplicationHandler handler, IApplication application, object? args) + public static partial void MapTerminate(ApplicationHandler handler, IApplication application, object? args) { handler.PlatformView.Exit(); } - public static void MapOpenWindow(ApplicationHandler handler, IApplication application, object? args) + public static partial void MapOpenWindow(ApplicationHandler handler, IApplication application, object? args) { handler.PlatformView?.RequestNewWindow(application, args as OpenWindowRequest); } - public static void MapCloseWindow(ApplicationHandler handler, IApplication application, object? args) + public static partial void MapCloseWindow(ApplicationHandler handler, IApplication application, object? args) { if (args is IWindow window) { diff --git a/src/Core/src/Handlers/Application/ApplicationHandler.Windows.cs b/src/Core/src/Handlers/Application/ApplicationHandler.Windows.cs index 26ba4da33d78..c3bba2bab763 100644 --- a/src/Core/src/Handlers/Application/ApplicationHandler.Windows.cs +++ b/src/Core/src/Handlers/Application/ApplicationHandler.Windows.cs @@ -5,17 +5,17 @@ namespace Microsoft.Maui.Handlers { public partial class ApplicationHandler : ElementHandler { - public static void MapTerminate(ApplicationHandler handler, IApplication application, object? args) + public static partial void MapTerminate(ApplicationHandler handler, IApplication application, object? args) { handler.PlatformView.Exit(); } - public static void MapOpenWindow(ApplicationHandler handler, IApplication application, object? args) + public static partial void MapOpenWindow(ApplicationHandler handler, IApplication application, object? args) { handler.PlatformView?.CreatePlatformWindow(application, args as OpenWindowRequest); } - public static void MapCloseWindow(ApplicationHandler handler, IApplication application, object? args) + public static partial void MapCloseWindow(ApplicationHandler handler, IApplication application, object? args) { if (args is IWindow window) { diff --git a/src/Core/src/Handlers/Application/ApplicationHandler.cs b/src/Core/src/Handlers/Application/ApplicationHandler.cs index e3ef151111ba..334d38d33748 100644 --- a/src/Core/src/Handlers/Application/ApplicationHandler.cs +++ b/src/Core/src/Handlers/Application/ApplicationHandler.cs @@ -14,6 +14,10 @@ namespace Microsoft.Maui.Handlers { + /// + /// Represents the view handler for the abstract view and its platform-specific implementation. + /// + /// Conceptual documentation on handlers public partial class ApplicationHandler { internal const string TerminateCommandKey = "Terminate"; @@ -55,5 +59,29 @@ public ApplicationHandler(IPropertyMapper? mapper, CommandMapper? commandMapper) protected override PlatformView CreatePlatformElement() => MauiContext?.Services.GetService() ?? throw new InvalidOperationException($"MauiContext did not have a valid application."); #endif + + /// + /// Maps the abstract "Terminate" command to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + /// The associated command arguments. + public static partial void MapTerminate(ApplicationHandler handler, IApplication application, object? args); + + /// + /// Maps the abstract command to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + /// The associated command arguments. + public static partial void MapOpenWindow(ApplicationHandler handler, IApplication application, object? args); + + /// + /// Maps the abstract command to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + /// The associated command arguments. + public static partial void MapCloseWindow(ApplicationHandler handler, IApplication application, object? args); } } \ No newline at end of file diff --git a/src/Core/src/Handlers/Application/ApplicationHandler.iOS.cs b/src/Core/src/Handlers/Application/ApplicationHandler.iOS.cs index 01f93e69045b..9498df89b5ee 100644 --- a/src/Core/src/Handlers/Application/ApplicationHandler.iOS.cs +++ b/src/Core/src/Handlers/Application/ApplicationHandler.iOS.cs @@ -10,7 +10,7 @@ namespace Microsoft.Maui.Handlers { public partial class ApplicationHandler : ElementHandler { - public static void MapTerminate(ApplicationHandler handler, IApplication application, object? args) + public static partial void MapTerminate(ApplicationHandler handler, IApplication application, object? args) { #if __MACCATALYST__ NSApplication.SharedApplication.Terminate(); @@ -21,14 +21,14 @@ public static void MapTerminate(ApplicationHandler handler, IApplication applica [SupportedOSPlatform("ios13.0")] [SupportedOSPlatform("tvos13.0")] - public static void MapOpenWindow(ApplicationHandler handler, IApplication application, object? args) + public static partial void MapOpenWindow(ApplicationHandler handler, IApplication application, object? args) { handler.PlatformView?.RequestNewWindow(application, args as OpenWindowRequest); } [SupportedOSPlatform("ios13.0")] [SupportedOSPlatform("tvos13.0")] - public static void MapCloseWindow(ApplicationHandler handler, IApplication application, object? args) + public static partial void MapCloseWindow(ApplicationHandler handler, IApplication application, object? args) { if (args is IWindow window) { diff --git a/src/Core/src/Handlers/Border/BorderHandler.Android.cs b/src/Core/src/Handlers/Border/BorderHandler.Android.cs index dab55056a341..f46cae72dff7 100644 --- a/src/Core/src/Handlers/Border/BorderHandler.Android.cs +++ b/src/Core/src/Handlers/Border/BorderHandler.Android.cs @@ -26,13 +26,14 @@ protected override ContentViewGroup CreatePlatformView() public override void SetVirtualView(IView view) { base.SetVirtualView(view); + _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); _ = PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class."); PlatformView.CrossPlatformLayout = VirtualView; } - static void UpdateContent(IBorderHandler handler) + static partial void UpdateContent(IBorderHandler handler) { _ = handler.PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class."); _ = handler.MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); @@ -44,23 +45,18 @@ static void UpdateContent(IBorderHandler handler) handler.PlatformView.AddView(view.ToPlatform(handler.MauiContext)); } - public static void MapHeight(IBorderHandler handler, IBorderView border) + public static partial void MapHeight(IBorderHandler handler, IBorderView border) { handler.PlatformView?.UpdateHeight(border); handler.PlatformView?.InvalidateBorderStrokeBounds(); } - public static void MapWidth(IBorderHandler handler, IBorderView border) + public static partial void MapWidth(IBorderHandler handler, IBorderView border) { handler.PlatformView?.UpdateWidth(border); handler.PlatformView?.InvalidateBorderStrokeBounds(); } - public static void MapContent(IBorderHandler handler, IBorderView border) - { - UpdateContent(handler); - } - protected override void DisconnectHandler(ContentViewGroup platformView) { // If we're being disconnected from the xplat element, then we should no longer be managing its children diff --git a/src/Core/src/Handlers/Border/BorderHandler.Standard.cs b/src/Core/src/Handlers/Border/BorderHandler.Standard.cs index 5a5e7a981374..cba6b0223867 100644 --- a/src/Core/src/Handlers/Border/BorderHandler.Standard.cs +++ b/src/Core/src/Handlers/Border/BorderHandler.Standard.cs @@ -5,9 +5,5 @@ namespace Microsoft.Maui.Handlers public partial class BorderHandler : ViewHandler { protected override object CreatePlatformView() => throw new NotImplementedException(); - - public static void MapContent(IBorderHandler handler, IBorderView border) - { - } } } diff --git a/src/Core/src/Handlers/Border/BorderHandler.Tizen.cs b/src/Core/src/Handlers/Border/BorderHandler.Tizen.cs index 9a897dfbfe66..12d3eb30ff15 100644 --- a/src/Core/src/Handlers/Border/BorderHandler.Tizen.cs +++ b/src/Core/src/Handlers/Border/BorderHandler.Tizen.cs @@ -29,6 +29,7 @@ protected override void SetupContainer() public override void SetVirtualView(IView view) { base.SetVirtualView(view); + _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); _ = PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class."); @@ -36,28 +37,25 @@ public override void SetVirtualView(IView view) PlatformView.CrossPlatformArrange = VirtualView.CrossPlatformArrange; } - public static void MapContent(IBorderHandler handler, IBorderView border) - { - if (handler is BorderHandler borderHandler) - borderHandler.UpdateContent(); - } - - void UpdateContent() + static partial void UpdateContent(IBorderHandler handler) { - _ = PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class."); - _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); - _ = MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); + _ = handler.PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class."); + _ = handler.VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); + _ = handler.MauiContext ?? throw new InvalidOperationException($"{nameof(MauiContext)} should have been set by base class."); - PlatformView.Children.Clear(); - _contentHandler?.Dispose(); - _contentHandler = null; + handler.PlatformView.Children.Clear(); + if (handler is BorderHandler borderHandler) + { + borderHandler._contentHandler?.Dispose(); + borderHandler._contentHandler = null; + } - if (VirtualView.PresentedContent is IView view) + if (handler.VirtualView.PresentedContent is IView view) { - PlatformView.Children.Add(view.ToPlatform(MauiContext)); - if (view.Handler is IPlatformViewHandler thandler) + handler.PlatformView.Children.Add(view.ToPlatform(handler.MauiContext)); + if (view.Handler is IPlatformViewHandler thandler && handler is BorderHandler alsoBorderHandler) { - _contentHandler = thandler; + alsoBorderHandler._contentHandler = thandler; } } } diff --git a/src/Core/src/Handlers/Border/BorderHandler.Windows.cs b/src/Core/src/Handlers/Border/BorderHandler.Windows.cs index a62283780f3d..cb415e9ae929 100644 --- a/src/Core/src/Handlers/Border/BorderHandler.Windows.cs +++ b/src/Core/src/Handlers/Border/BorderHandler.Windows.cs @@ -14,7 +14,7 @@ public override void SetVirtualView(IView view) PlatformView.CrossPlatformLayout = VirtualView; } - static void UpdateContent(IBorderHandler handler) + static partial void UpdateContent(IBorderHandler handler) { _ = handler.PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class."); _ = handler.VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); @@ -41,10 +41,5 @@ protected override ContentPanel CreatePlatformView() return view; } - - public static void MapContent(IBorderHandler handler, IBorderView border) - { - UpdateContent(handler); - } } } diff --git a/src/Core/src/Handlers/Border/BorderHandler.cs b/src/Core/src/Handlers/Border/BorderHandler.cs index 3a9f03fc89e0..a60148113827 100644 --- a/src/Core/src/Handlers/Border/BorderHandler.cs +++ b/src/Core/src/Handlers/Border/BorderHandler.cs @@ -13,24 +13,28 @@ namespace Microsoft.Maui.Handlers { + /// + /// Represents the view handler for the abstract view and its platform-specific implementation. + /// + /// Conceptual documentation on handlers public partial class BorderHandler : IBorderHandler { public static IPropertyMapper Mapper = new PropertyMapper(ViewMapper) { #if __ANDROID__ - [nameof(IContentView.Height)] = MapHeight, - [nameof(IContentView.Width)] = MapWidth, + [nameof(IBorderView.Height)] = MapHeight, + [nameof(IBorderView.Width)] = MapWidth, #endif - [nameof(IContentView.Background)] = MapBackground, - [nameof(IContentView.Content)] = MapContent, - [nameof(IBorderStroke.Shape)] = MapStrokeShape, - [nameof(IBorderStroke.Stroke)] = MapStroke, - [nameof(IBorderStroke.StrokeThickness)] = MapStrokeThickness, - [nameof(IBorderStroke.StrokeLineCap)] = MapStrokeLineCap, - [nameof(IBorderStroke.StrokeLineJoin)] = MapStrokeLineJoin, - [nameof(IBorderStroke.StrokeDashPattern)] = MapStrokeDashPattern, - [nameof(IBorderStroke.StrokeDashOffset)] = MapStrokeDashOffset, - [nameof(IBorderStroke.StrokeMiterLimit)] = MapStrokeMiterLimit + [nameof(IBorderView.Background)] = MapBackground, + [nameof(IBorderView.Content)] = MapContent, + [nameof(IBorderView.Shape)] = MapStrokeShape, + [nameof(IBorderView.Stroke)] = MapStroke, + [nameof(IBorderView.StrokeThickness)] = MapStrokeThickness, + [nameof(IBorderView.StrokeLineCap)] = MapStrokeLineCap, + [nameof(IBorderView.StrokeLineJoin)] = MapStrokeLineJoin, + [nameof(IBorderView.StrokeDashPattern)] = MapStrokeDashPattern, + [nameof(IBorderView.StrokeDashOffset)] = MapStrokeDashOffset, + [nameof(IBorderView.StrokeMiterLimit)] = MapStrokeMiterLimit }; public static CommandMapper CommandMapper = new(ViewCommandMapper) @@ -56,52 +60,125 @@ public BorderHandler(IPropertyMapper? mapper, CommandMapper? commandMapper) PlatformView IBorderHandler.PlatformView => PlatformView; + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. public static void MapBackground(IBorderHandler handler, IBorderView border) { ((PlatformView?)handler.PlatformView)?.UpdateBackground(border); } + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. public static void MapStrokeShape(IBorderHandler handler, IBorderView border) { ((PlatformView?)handler.PlatformView)?.UpdateStrokeShape(border); MapBackground(handler, border); } + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. public static void MapStroke(IBorderHandler handler, IBorderView border) { ((PlatformView?)handler.PlatformView)?.UpdateStroke(border); MapBackground(handler, border); } + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. public static void MapStrokeThickness(IBorderHandler handler, IBorderView border) { ((PlatformView?)handler.PlatformView)?.UpdateStrokeThickness(border); MapBackground(handler, border); } + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. public static void MapStrokeLineCap(IBorderHandler handler, IBorderView border) { ((PlatformView?)handler.PlatformView)?.UpdateStrokeLineCap(border); } + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. public static void MapStrokeLineJoin(IBorderHandler handler, IBorderView border) { ((PlatformView?)handler.PlatformView)?.UpdateStrokeLineJoin(border); } + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. public static void MapStrokeDashPattern(IBorderHandler handler, IBorderView border) { ((PlatformView?)handler.PlatformView)?.UpdateStrokeDashPattern(border); } + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. public static void MapStrokeDashOffset(IBorderHandler handler, IBorderView border) { ((PlatformView?)handler.PlatformView)?.UpdateStrokeDashOffset(border); } + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. public static void MapStrokeMiterLimit(IBorderHandler handler, IBorderView border) { ((PlatformView?)handler.PlatformView)?.UpdateStrokeMiterLimit(border); } + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static void MapContent(IBorderHandler handler, IBorderView border) + { + UpdateContent(handler); + } + + static partial void UpdateContent(IBorderHandler handler); + +#if __ANDROID__ + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapWidth(IBorderHandler handler, IBorderView border); + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapHeight(IBorderHandler handler, IBorderView border); +#endif } } diff --git a/src/Core/src/Handlers/Border/BorderHandler.iOS.cs b/src/Core/src/Handlers/Border/BorderHandler.iOS.cs index 3590bed57ae2..d0b041acabe8 100644 --- a/src/Core/src/Handlers/Border/BorderHandler.iOS.cs +++ b/src/Core/src/Handlers/Border/BorderHandler.iOS.cs @@ -31,6 +31,7 @@ protected override void DisconnectHandler(ContentView platformView) public override void SetVirtualView(IView view) { base.SetVirtualView(view); + _ = PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class."); _ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); @@ -38,7 +39,7 @@ public override void SetVirtualView(IView view) PlatformView.CrossPlatformLayout = VirtualView; } - static void UpdateContent(IBorderHandler handler) + static partial void UpdateContent(IBorderHandler handler) { _ = handler.PlatformView ?? throw new InvalidOperationException($"{nameof(PlatformView)} should have been set by base class."); _ = handler.VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} should have been set by base class."); @@ -54,10 +55,5 @@ static void UpdateContent(IBorderHandler handler) handler.PlatformView.ChildMaskLayer = null; } } - - public static void MapContent(IBorderHandler handler, IBorderView border) - { - UpdateContent(handler); - } } } diff --git a/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Android.cs b/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Android.cs index 019401ec1a81..91dd6009921a 100644 --- a/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Android.cs +++ b/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Android.cs @@ -29,17 +29,17 @@ protected override void DisconnectHandler(AppCompatCheckBox platformView) } // This is an Android-specific mapping - public static void MapBackground(ICheckBoxHandler handler, ICheckBox check) + public static partial void MapBackground(ICheckBoxHandler handler, ICheckBox check) { handler.PlatformView?.UpdateBackground(check); } - public static void MapIsChecked(ICheckBoxHandler handler, ICheckBox check) + public static partial void MapIsChecked(ICheckBoxHandler handler, ICheckBox check) { handler.PlatformView?.UpdateIsChecked(check); } - public static void MapForeground(ICheckBoxHandler handler, ICheckBox check) + public static partial void MapForeground(ICheckBoxHandler handler, ICheckBox check) { handler.PlatformView?.UpdateForeground(check); } diff --git a/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Standard.cs b/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Standard.cs index 223582cd25d8..b26000e9c8a4 100644 --- a/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Standard.cs +++ b/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Standard.cs @@ -6,8 +6,8 @@ public partial class CheckBoxHandler : ViewHandler { protected override object CreatePlatformView() => throw new NotImplementedException(); - public static void MapIsChecked(ICheckBoxHandler handler, ICheckBox check) { } + public static partial void MapIsChecked(ICheckBoxHandler handler, ICheckBox check) { } - public static void MapForeground(ICheckBoxHandler handler, ICheckBox check) { } + public static partial void MapForeground(ICheckBoxHandler handler, ICheckBox check) { } } } \ No newline at end of file diff --git a/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Tizen.cs b/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Tizen.cs index b93165d63868..82cbca56daf6 100644 --- a/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Tizen.cs +++ b/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Tizen.cs @@ -25,12 +25,12 @@ protected override void DisconnectHandler(CheckBox platformView) platformView.ValueChanged -= OnStateChanged; } - public static void MapIsChecked(ICheckBoxHandler handler, ICheckBox check) + public static partial void MapIsChecked(ICheckBoxHandler handler, ICheckBox check) { handler.PlatformView?.UpdateIsChecked(check); } - public static void MapForeground(ICheckBoxHandler handler, ICheckBox check) + public static partial void MapForeground(ICheckBoxHandler handler, ICheckBox check) { handler.PlatformView?.UpdateForeground(check); } diff --git a/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Windows.cs b/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Windows.cs index 9a5dd054557e..538cc2c31451 100644 --- a/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Windows.cs +++ b/src/Core/src/Handlers/CheckBox/CheckBoxHandler.Windows.cs @@ -61,12 +61,12 @@ protected override void DisconnectHandler(CheckBox platformView) platformView.Unchecked -= OnChecked; } - public static void MapIsChecked(ICheckBoxHandler handler, ICheckBox check) + public static partial void MapIsChecked(ICheckBoxHandler handler, ICheckBox check) { handler.PlatformView?.UpdateIsChecked(check); } - public static void MapForeground(ICheckBoxHandler handler, ICheckBox check) + public static partial void MapForeground(ICheckBoxHandler handler, ICheckBox check) { handler.PlatformView?.UpdateForeground(check); } diff --git a/src/Core/src/Handlers/CheckBox/CheckBoxHandler.cs b/src/Core/src/Handlers/CheckBox/CheckBoxHandler.cs index 3e6c54a3c609..9e3b2a7d1221 100644 --- a/src/Core/src/Handlers/CheckBox/CheckBoxHandler.cs +++ b/src/Core/src/Handlers/CheckBox/CheckBoxHandler.cs @@ -13,6 +13,10 @@ namespace Microsoft.Maui.Handlers { + /// + /// Represents the view handler for the abstract view and its platform-specific implementation. + /// + /// Conceptual documentation on handlers public partial class CheckBoxHandler : ICheckBoxHandler { public static IPropertyMapper Mapper = new PropertyMapper(ViewHandler.ViewMapper) @@ -46,5 +50,28 @@ public CheckBoxHandler(IPropertyMapper? mapper, CommandMapper? commandMapper) ICheckBox ICheckBoxHandler.VirtualView => VirtualView; PlatformView ICheckBoxHandler.PlatformView => PlatformView; + +#if MONOANDROID + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapBackground(ICheckBoxHandler handler, ICheckBox check); +#endif + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapIsChecked(ICheckBoxHandler handler, ICheckBox check); + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapForeground(ICheckBoxHandler handler, ICheckBox check); } } \ No newline at end of file diff --git a/src/Core/src/Handlers/CheckBox/CheckBoxHandler.iOS.cs b/src/Core/src/Handlers/CheckBox/CheckBoxHandler.iOS.cs index 9377866d5fdc..d283c14f22d3 100644 --- a/src/Core/src/Handlers/CheckBox/CheckBoxHandler.iOS.cs +++ b/src/Core/src/Handlers/CheckBox/CheckBoxHandler.iOS.cs @@ -29,12 +29,12 @@ protected override void DisconnectHandler(MauiCheckBox platformView) platformView.CheckedChanged -= OnCheckedChanged; } - public static void MapIsChecked(ICheckBoxHandler handler, ICheckBox check) + public static partial void MapIsChecked(ICheckBoxHandler handler, ICheckBox check) { handler.PlatformView?.UpdateIsChecked(check); } - public static void MapForeground(ICheckBoxHandler handler, ICheckBox check) + public static partial void MapForeground(ICheckBoxHandler handler, ICheckBox check) { handler.PlatformView?.UpdateForeground(check); } diff --git a/src/Core/src/Handlers/ContentView/ContentViewHandler.Android.cs b/src/Core/src/Handlers/ContentView/ContentViewHandler.Android.cs index 8240a5c00469..88cacde6a1b1 100644 --- a/src/Core/src/Handlers/ContentView/ContentViewHandler.Android.cs +++ b/src/Core/src/Handlers/ContentView/ContentViewHandler.Android.cs @@ -42,7 +42,7 @@ static void UpdateContent(IContentViewHandler handler) handler.PlatformView.AddView(view.ToPlatform(handler.MauiContext)); } - public static void MapContent(IContentViewHandler handler, IContentView page) + public static partial void MapContent(IContentViewHandler handler, IContentView page) { UpdateContent(handler); } diff --git a/src/Core/src/Handlers/ContentView/ContentViewHandler.Standard.cs b/src/Core/src/Handlers/ContentView/ContentViewHandler.Standard.cs index 786b7faeab2c..752d42069616 100644 --- a/src/Core/src/Handlers/ContentView/ContentViewHandler.Standard.cs +++ b/src/Core/src/Handlers/ContentView/ContentViewHandler.Standard.cs @@ -6,7 +6,7 @@ public partial class ContentViewHandler : ViewHandler { protected override object CreatePlatformView() => throw new NotImplementedException(); - public static void MapContent(IContentViewHandler handler, IContentView page) + public static partial void MapContent(IContentViewHandler handler, IContentView page) { } } diff --git a/src/Core/src/Handlers/ContentView/ContentViewHandler.Tizen.cs b/src/Core/src/Handlers/ContentView/ContentViewHandler.Tizen.cs index a572439b46f7..1c9f4df528ea 100644 --- a/src/Core/src/Handlers/ContentView/ContentViewHandler.Tizen.cs +++ b/src/Core/src/Handlers/ContentView/ContentViewHandler.Tizen.cs @@ -29,13 +29,13 @@ public override void SetVirtualView(IView view) PlatformView.CrossPlatformArrange = VirtualView.CrossPlatformArrange; } - public static void MapBackground(IContentViewHandler handler, IContentView view) + public static partial void MapBackground(IContentViewHandler handler, IContentView view) { handler.UpdateValue(nameof(handler.ContainerView)); handler.ToPlatform()?.UpdateBackground(view); } - public static void MapContent(IContentViewHandler handler, IContentView page) + public static partial void MapContent(IContentViewHandler handler, IContentView page) { if (handler is ContentViewHandler contentViewHandler) { diff --git a/src/Core/src/Handlers/ContentView/ContentViewHandler.Windows.cs b/src/Core/src/Handlers/ContentView/ContentViewHandler.Windows.cs index 46e9fbc71740..291ce76812ef 100644 --- a/src/Core/src/Handlers/ContentView/ContentViewHandler.Windows.cs +++ b/src/Core/src/Handlers/ContentView/ContentViewHandler.Windows.cs @@ -41,7 +41,7 @@ protected override ContentPanel CreatePlatformView() return view; } - public static void MapContent(IContentViewHandler handler, IContentView page) + public static partial void MapContent(IContentViewHandler handler, IContentView page) { UpdateContent(handler); } diff --git a/src/Core/src/Handlers/ContentView/ContentViewHandler.cs b/src/Core/src/Handlers/ContentView/ContentViewHandler.cs index 651a566d246c..3b8482f9c73a 100644 --- a/src/Core/src/Handlers/ContentView/ContentViewHandler.cs +++ b/src/Core/src/Handlers/ContentView/ContentViewHandler.cs @@ -13,6 +13,10 @@ namespace Microsoft.Maui.Handlers { + /// + /// Represents the view handler for the abstract view and its platform-specific implementation. + /// + /// Conceptual documentation on handlers public partial class ContentViewHandler : IContentViewHandler { public static IPropertyMapper Mapper = @@ -45,5 +49,21 @@ public ContentViewHandler(IPropertyMapper? mapper, CommandMapper? commandMapper) IContentView IContentViewHandler.VirtualView => VirtualView; PlatformView IContentViewHandler.PlatformView => PlatformView; + +#if TIZEN + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapBackground(IContentViewHandler handler, IContentView view); +#endif + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapContent(IContentViewHandler handler, IContentView page); } } diff --git a/src/Core/src/Handlers/ContentView/ContentViewHandler.iOS.cs b/src/Core/src/Handlers/ContentView/ContentViewHandler.iOS.cs index 0a4e4010869f..1f2ea84c600f 100644 --- a/src/Core/src/Handlers/ContentView/ContentViewHandler.iOS.cs +++ b/src/Core/src/Handlers/ContentView/ContentViewHandler.iOS.cs @@ -47,7 +47,7 @@ static void UpdateContent(IContentViewHandler handler) } } - public static void MapContent(IContentViewHandler handler, IContentView page) + public static partial void MapContent(IContentViewHandler handler, IContentView page) { UpdateContent(handler); } diff --git a/src/Core/src/Handlers/DatePicker/DatePickerHandler.Android.cs b/src/Core/src/Handlers/DatePicker/DatePickerHandler.Android.cs index 9baf18fc711a..2979a6ee14e4 100644 --- a/src/Core/src/Handlers/DatePicker/DatePickerHandler.Android.cs +++ b/src/Core/src/Handlers/DatePicker/DatePickerHandler.Android.cs @@ -77,47 +77,46 @@ protected virtual DatePickerDialog CreateDatePickerDialog(int year, int month, i return dialog; } - // This is a Android-specific mapping - public static void MapBackground(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapBackground(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView?.UpdateBackground(datePicker); } - public static void MapFormat(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapFormat(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView?.UpdateFormat(datePicker); } - public static void MapDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapDate(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView?.UpdateDate(datePicker); } - public static void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker) { if (handler is DatePickerHandler platformHandler) handler.PlatformView?.UpdateMinimumDate(datePicker, platformHandler._dialog); } - public static void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker) { if (handler is DatePickerHandler platformHandler) handler.PlatformView?.UpdateMaximumDate(datePicker, platformHandler._dialog); } - public static void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView?.UpdateCharacterSpacing(datePicker); } - public static void MapFont(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapFont(IDatePickerHandler handler, IDatePicker datePicker) { var fontManager = handler.GetRequiredService(); handler.PlatformView?.UpdateFont(datePicker, fontManager); } - public static void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker) { if (handler is DatePickerHandler platformHandler) handler.PlatformView?.UpdateTextColor(datePicker); diff --git a/src/Core/src/Handlers/DatePicker/DatePickerHandler.MacCatalyst.cs b/src/Core/src/Handlers/DatePicker/DatePickerHandler.MacCatalyst.cs index 9cb70cbc979a..2761e9b46b71 100644 --- a/src/Core/src/Handlers/DatePicker/DatePickerHandler.MacCatalyst.cs +++ b/src/Core/src/Handlers/DatePicker/DatePickerHandler.MacCatalyst.cs @@ -38,41 +38,41 @@ protected override void DisconnectHandler(UIDatePicker platformView) base.DisconnectHandler(platformView); } - public static void MapFormat(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapFormat(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView?.UpdateFormat(datePicker); } - public static void MapDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapDate(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView?.UpdateDate(datePicker); } - public static void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView?.UpdateMinimumDate(datePicker); } - public static void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView?.UpdateMaximumDate(datePicker); } - public static void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker) { } - public static void MapFont(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapFont(IDatePickerHandler handler, IDatePicker datePicker) { } - public static void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker) { } - public static void MapFlowDirection(DatePickerHandler handler, IDatePicker datePicker) + public static partial void MapFlowDirection(DatePickerHandler handler, IDatePicker datePicker) { } diff --git a/src/Core/src/Handlers/DatePicker/DatePickerHandler.Standard.cs b/src/Core/src/Handlers/DatePicker/DatePickerHandler.Standard.cs index 05b8c8586c69..52635d6682ab 100644 --- a/src/Core/src/Handlers/DatePicker/DatePickerHandler.Standard.cs +++ b/src/Core/src/Handlers/DatePicker/DatePickerHandler.Standard.cs @@ -6,12 +6,12 @@ public partial class DatePickerHandler : ViewHandler { protected override object CreatePlatformView() => throw new NotImplementedException(); - public static void MapFormat(IDatePickerHandler handler, IDatePicker datePicker) { } - public static void MapDate(IDatePickerHandler handler, IDatePicker datePicker) { } - public static void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker) { } - public static void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker) { } - public static void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker) { } - public static void MapFont(IDatePickerHandler handler, IDatePicker datePicker) { } - public static void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker) { } + public static partial void MapFormat(IDatePickerHandler handler, IDatePicker datePicker) { } + public static partial void MapDate(IDatePickerHandler handler, IDatePicker datePicker) { } + public static partial void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker) { } + public static partial void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker) { } + public static partial void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker) { } + public static partial void MapFont(IDatePickerHandler handler, IDatePicker datePicker) { } + public static partial void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker) { } } } \ No newline at end of file diff --git a/src/Core/src/Handlers/DatePicker/DatePickerHandler.Tizen.cs b/src/Core/src/Handlers/DatePicker/DatePickerHandler.Tizen.cs index 984211cb0c80..4d08aab1e3d6 100644 --- a/src/Core/src/Handlers/DatePicker/DatePickerHandler.Tizen.cs +++ b/src/Core/src/Handlers/DatePicker/DatePickerHandler.Tizen.cs @@ -25,34 +25,34 @@ protected override void DisconnectHandler(NEntry platformView) base.DisconnectHandler(platformView); } - public static void MapFormat(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapFormat(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView.UpdateFormat(datePicker); } - public static void MapDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapDate(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView.UpdateDate(datePicker); } - public static void MapFont(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapFont(IDatePickerHandler handler, IDatePicker datePicker) { var fontManager = handler.GetRequiredService(); handler.PlatformView.UpdateFont(datePicker, fontManager); } - public static void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView.UpdateTextColor(datePicker); } [MissingMapper] - public static void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker) { } + public static partial void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker) { } [MissingMapper] - public static void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker) { } + public static partial void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker) { } - public static void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView.UpdateCharacterSpacing(datePicker); } diff --git a/src/Core/src/Handlers/DatePicker/DatePickerHandler.Windows.cs b/src/Core/src/Handlers/DatePicker/DatePickerHandler.Windows.cs index 51ed98ef1f83..807af51488de 100644 --- a/src/Core/src/Handlers/DatePicker/DatePickerHandler.Windows.cs +++ b/src/Core/src/Handlers/DatePicker/DatePickerHandler.Windows.cs @@ -18,39 +18,39 @@ protected override void DisconnectHandler(CalendarDatePicker platformView) platformView.DateChanged -= DateChanged; } - public static void MapFormat(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapFormat(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView.UpdateDate(datePicker); } - public static void MapDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapDate(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView.UpdateDate(datePicker); } - public static void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView.UpdateMinimumDate(datePicker); } - public static void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView.UpdateMaximumDate(datePicker); } - public static void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView.UpdateCharacterSpacing(datePicker); } - public static void MapFont(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapFont(IDatePickerHandler handler, IDatePicker datePicker) { var fontManager = handler.GetRequiredService(); handler.PlatformView.UpdateFont(datePicker, fontManager); } - public static void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView.UpdateTextColor(datePicker); } @@ -81,8 +81,7 @@ private void DateChanged(CalendarDatePicker sender, CalendarDatePickerDateChange VirtualView.Date = args.NewDate.Value.Date; } - // TODO NET8 add to public API - internal static void MapBackground(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapBackground(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView?.UpdateBackground(datePicker); } diff --git a/src/Core/src/Handlers/DatePicker/DatePickerHandler.cs b/src/Core/src/Handlers/DatePicker/DatePickerHandler.cs index 3d71260cbb91..ba750f45223d 100644 --- a/src/Core/src/Handlers/DatePicker/DatePickerHandler.cs +++ b/src/Core/src/Handlers/DatePicker/DatePickerHandler.cs @@ -14,6 +14,10 @@ namespace Microsoft.Maui.Handlers { + /// + /// Represents the view handler for the abstract view and its platform-specific implementation. + /// + /// Conceptual documentation on handlers public partial class DatePickerHandler : IDatePickerHandler { public static IPropertyMapper Mapper = new PropertyMapper(ViewHandler.ViewMapper) @@ -53,5 +57,72 @@ public DatePickerHandler(IPropertyMapper? mapper, CommandMapper? commandMapper) IDatePicker IDatePickerHandler.VirtualView => VirtualView; PlatformView IDatePickerHandler.PlatformView => PlatformView; + +#if ANDROID || WINDOWS + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapBackground(IDatePickerHandler handler, IDatePicker datePicker); +#endif + +#if IOS || MACCATALYST + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapFlowDirection(DatePickerHandler handler, IDatePicker datePicker); +#endif + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapFormat(IDatePickerHandler handler, IDatePicker datePicker); + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapDate(IDatePickerHandler handler, IDatePicker datePicker); + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker); + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker); + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker); + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapFont(IDatePickerHandler handler, IDatePicker datePicker); + + /// + /// Maps the abstract property to the platform-specific implementations. + /// + /// The associated handler. + /// The associated instance. + public static partial void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker); } } \ No newline at end of file diff --git a/src/Core/src/Handlers/DatePicker/DatePickerHandler.iOS.cs b/src/Core/src/Handlers/DatePicker/DatePickerHandler.iOS.cs index 0714508351d0..8342976a839d 100644 --- a/src/Core/src/Handlers/DatePicker/DatePickerHandler.iOS.cs +++ b/src/Core/src/Handlers/DatePicker/DatePickerHandler.iOS.cs @@ -39,48 +39,48 @@ protected override void DisconnectHandler(MauiDatePicker platformView) base.DisconnectHandler(platformView); } - public static void MapFormat(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapFormat(IDatePickerHandler handler, IDatePicker datePicker) { var picker = (handler as DatePickerHandler)?.DatePickerDialog; handler.PlatformView?.UpdateFormat(datePicker, picker); } - public static void MapDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapDate(IDatePickerHandler handler, IDatePicker datePicker) { var picker = (handler as DatePickerHandler)?.DatePickerDialog; handler.PlatformView?.UpdateDate(datePicker, picker); } - public static void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapMinimumDate(IDatePickerHandler handler, IDatePicker datePicker) { if (handler is DatePickerHandler platformHandler) handler.PlatformView?.UpdateMinimumDate(datePicker, platformHandler.DatePickerDialog); } - public static void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapMaximumDate(IDatePickerHandler handler, IDatePicker datePicker) { if (handler is DatePickerHandler platformHandler) handler.PlatformView?.UpdateMaximumDate(datePicker, platformHandler.DatePickerDialog); } - public static void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapCharacterSpacing(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView?.UpdateCharacterSpacing(datePicker); } - public static void MapFont(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapFont(IDatePickerHandler handler, IDatePicker datePicker) { var fontManager = handler.GetRequiredService(); handler.PlatformView?.UpdateFont(datePicker, fontManager); } - public static void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker) + public static partial void MapTextColor(IDatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView?.UpdateTextColor(datePicker); } - public static void MapFlowDirection(DatePickerHandler handler, IDatePicker datePicker) + public static partial void MapFlowDirection(DatePickerHandler handler, IDatePicker datePicker) { handler.PlatformView?.UpdateFlowDirection(datePicker); handler.PlatformView?.UpdateTextAlignment(datePicker); diff --git a/src/Core/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt index d2046ff89f73..338fe09c78e8 100644 --- a/src/Core/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt +++ b/src/Core/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt @@ -87,3 +87,4 @@ static Microsoft.Maui.Handlers.MenuFlyoutSubItemHandler.MapAccelerator(Microsoft *REMOVED*Microsoft.Maui.ILayout.CrossPlatformMeasure(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size *REMOVED*override Microsoft.Maui.Platform.ContentPanel.MeasureOverride(Windows.Foundation.Size availableSize) -> Windows.Foundation.Size *REMOVED*override Microsoft.Maui.Platform.LayoutPanel.MeasureOverride(Windows.Foundation.Size availableSize) -> Windows.Foundation.Size +static Microsoft.Maui.Handlers.DatePickerHandler.MapBackground(Microsoft.Maui.Handlers.IDatePickerHandler! handler, Microsoft.Maui.IDatePicker! datePicker) -> void