From 1d048acd3b5e11d60f17cb3eb478ff2a1e167592 Mon Sep 17 00:00:00 2001 From: Adolfo Marinucci Date: Thu, 21 Nov 2024 00:07:07 +0100 Subject: [PATCH] Working on StartupSample template --- .../Framework/Syncfusion.cs | 71 ++++++++++--------- ...uiReactorTemplate.StartupSampleXaml.csproj | 2 +- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/templates/MauiReactorTemplate.StartupSampleXaml/Framework/Syncfusion.cs b/templates/MauiReactorTemplate.StartupSampleXaml/Framework/Syncfusion.cs index 12a4ab0..0add623 100644 --- a/templates/MauiReactorTemplate.StartupSampleXaml/Framework/Syncfusion.cs +++ b/templates/MauiReactorTemplate.StartupSampleXaml/Framework/Syncfusion.cs @@ -1,9 +1,4 @@ using MauiReactor.Internals; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace MauiReactorTemplate.StartupSampleXaml.Framework; @@ -61,44 +56,53 @@ partial class SfShimmer { } -//partial interface ISfShimmer -//{ -// public VisualNode CustomView { get; set; } -//} +partial interface ISfShimmer +{ + public VisualNode? CustomView { get; set; } +} -//partial class SfShimmer -//{ -// VisualNode ISfShimmer.CustomView { get; set; } +partial class SfShimmer +{ + VisualNode? ISfShimmer.CustomView { get; set; } -// protected override IEnumerable RenderChildren() -// { -// var thisAsISfShimmer = (ISfShimmer)this; + protected override IEnumerable RenderChildren() + { + var thisAsISfShimmer = (ISfShimmer)this; -// var children = base.RenderChildren(); + var children = base.RenderChildren(); -// if (thisAsISfShimmer.CustomView != null) -// { -// children = children.Concat(new[] { thisAsISfShimmer.CustomView }); -// } + if (thisAsISfShimmer.CustomView != null) + { + children = children.Concat([thisAsISfShimmer.CustomView]); + } -// return children; -// } + return children; + } -// protected override void OnAddChild(VisualNode widget, BindableObject childControl) -// { -// Validate.EnsureNotNull(NativeControl); + protected override void OnAddChild(VisualNode widget, BindableObject childControl) + { + Validate.EnsureNotNull(NativeControl); -// var thisAsISfShimmer = (ISfShimmer)this; + var thisAsISfShimmer = (ISfShimmer)this; -// if (widget == thisAsISfShimmer.CustomView) -// { -// NativeControl.CustomView = (View)childControl; -// } + if (widget == thisAsISfShimmer.CustomView) + { + NativeControl.CustomView = (View)childControl; + } + + base.OnAddChild(widget, childControl); + } +} -// base.OnAddChild(widget, childControl); -// } -//} +partial class SfShimmerExtensions +{ + public static T CustomView(this T shimmer, VisualNode? customView) where T : ISfShimmer + { + shimmer.CustomView = customView; + return shimmer; + } +} [Scaffold(typeof(Syncfusion.Maui.Toolkit.Shimmer.ShimmerView))] partial class ShimmerView @@ -112,7 +116,6 @@ partial class SfEffectsView } - [Scaffold(typeof(Syncfusion.Maui.Toolkit.SegmentedControl.SfSegmentedControl))] partial class SfSegmentedControl { diff --git a/templates/MauiReactorTemplate.StartupSampleXaml/MauiReactorTemplate.StartupSampleXaml.csproj b/templates/MauiReactorTemplate.StartupSampleXaml/MauiReactorTemplate.StartupSampleXaml.csproj index ca69944..3ddc020 100644 --- a/templates/MauiReactorTemplate.StartupSampleXaml/MauiReactorTemplate.StartupSampleXaml.csproj +++ b/templates/MauiReactorTemplate.StartupSampleXaml/MauiReactorTemplate.StartupSampleXaml.csproj @@ -61,7 +61,7 @@ - +