From 0ef114cc39c1eda8829cfff1f8cd76984299e09e Mon Sep 17 00:00:00 2001 From: Oleksandr Liakhevych Date: Sat, 9 Nov 2024 15:32:39 +0200 Subject: [PATCH 1/6] feat: Allow to generate non-Element components from assembly (#161) --- src/BlazorBindings.Maui.ComponentGenerator/Program.cs | 6 +++++- .../GenerateComponentsFromAssemblyAttribute.cs | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/BlazorBindings.Maui.ComponentGenerator/Program.cs b/src/BlazorBindings.Maui.ComponentGenerator/Program.cs index cca75637..506be9e9 100644 --- a/src/BlazorBindings.Maui.ComponentGenerator/Program.cs +++ b/src/BlazorBindings.Maui.ComponentGenerator/Program.cs @@ -64,6 +64,7 @@ private static GenerateComponentSettings[] GetTypesToGenerate(Compilation compil Console.WriteLine("Finding types to generate."); var elementType = compilation.GetTypeByMetadataName("Microsoft.Maui.Controls.Element"); + var bindableObjectType = compilation.GetTypeByMetadataName("Microsoft.Maui.Controls.BindableObject"); var attributes = compilation.Assembly.GetAttributes(); var typesToGenerate = attributes @@ -104,16 +105,19 @@ private static GenerateComponentSettings[] GetTypesToGenerate(Compilation compil { var containingTypeSymbol = a.ConstructorArguments.FirstOrDefault().Value as INamedTypeSymbol; var typeNamePrefix = a.NamedArguments.FirstOrDefault(a => a.Key == "TypeNamePrefix").Value.Value as string; + var includeNonElements = a.NamedArguments.FirstOrDefault(a => a.Key == "IncludeNonElements").Value.Value as bool?; var excludeTypes = a.NamedArguments.FirstOrDefault(a => a.Key == "Exclude").Value is { Kind: TypedConstantKind.Array } array ? array.Values.Select(v => (INamedTypeSymbol)v.Value).ToArray() : []; + var requiredBaseType = includeNonElements == true ? bindableObjectType : elementType; + var typesInAssembly = containingTypeSymbol.ContainingAssembly .GlobalNamespace.GetAllTypes() .Where(t => t.DeclaredAccessibility == Accessibility.Public && t.IsBrowsable() && !t.IsObsolete()) .Where(t => !(t.IsGenericType && t.IsDefinition)) .Where(t => !excludeTypes.Any(excludeType => SymbolEqualityComparer.Default.Equals(excludeType, t))) - .Where(t => compilation.ClassifyCommonConversion(t, elementType) is { IsReference: true, IsImplicit: true }); + .Where(t => compilation.ClassifyCommonConversion(t, requiredBaseType) is { IsReference: true, IsImplicit: true }); return typesInAssembly .Where(typeSymbol => !typesToGenerate.Any(t => SymbolEqualityComparer.Default.Equals(t.TypeSymbol, typeSymbol))) diff --git a/src/BlazorBindings.Maui/ComponentGenerator/GenerateComponentsFromAssemblyAttribute.cs b/src/BlazorBindings.Maui/ComponentGenerator/GenerateComponentsFromAssemblyAttribute.cs index 8e3c2c82..031269b2 100644 --- a/src/BlazorBindings.Maui/ComponentGenerator/GenerateComponentsFromAssemblyAttribute.cs +++ b/src/BlazorBindings.Maui/ComponentGenerator/GenerateComponentsFromAssemblyAttribute.cs @@ -15,4 +15,10 @@ public class GenerateComponentsFromAssemblyAttribute(Type containingType) : Attr /// Exclude specific types from generation. /// public Type[] Exclude { get; set; } + + /// + /// By default, only types inherited from are included. + /// Set to true to include everything inherited from . + /// + public bool IncludeNonElements { get; set; } } \ No newline at end of file From 14c7a6a2e265d1321342484103c22c50d71ba09c Mon Sep 17 00:00:00 2001 From: Oleksandr Liakhevych Date: Sat, 9 Nov 2024 16:18:34 +0200 Subject: [PATCH 2/6] Add The49.Maui.BottomSheet sample page (#162) --- samples/ThirdPartyControlsSample/App.cs | 4 +- .../ThirdPartyControlsSample/AppShell.razor | 1 + .../AnchorDetent.generated.cs | 55 ++++++++ .../BottomSheet.generated.cs | 130 ++++++++++++++++++ .../ContentDetent.generated.cs | 33 +++++ .../The49.BottomSheet/Detent.generated.cs | 59 ++++++++ .../FullscreenDetent.generated.cs | 33 +++++ .../HeightDetent.generated.cs | 52 +++++++ .../MediumDetent.generated.cs | 33 +++++ .../RatioDetent.generated.cs | 52 +++++++ .../Extensions/NavigationExtensions.cs | 9 +- .../ThirdPartyControlsSample/MauiProgram.cs | 2 + .../Pages/BottomSheetExample.razor | 37 +++++ .../Pages/BottomSheetPage.razor | 14 ++ .../Pages/CommunityToolkitPage.razor | 1 - .../Android/Resources/values/styles.xml | 4 + .../Properties/Elements.cs | 5 + .../ThirdPartyControlsSample.csproj | 5 +- .../ThirdPartyControlsSample/_Imports.razor | 3 +- 19 files changed, 525 insertions(+), 7 deletions(-) create mode 100644 samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/AnchorDetent.generated.cs create mode 100644 samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/BottomSheet.generated.cs create mode 100644 samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/ContentDetent.generated.cs create mode 100644 samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/Detent.generated.cs create mode 100644 samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/FullscreenDetent.generated.cs create mode 100644 samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/HeightDetent.generated.cs create mode 100644 samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/MediumDetent.generated.cs create mode 100644 samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/RatioDetent.generated.cs create mode 100644 samples/ThirdPartyControlsSample/Pages/BottomSheetExample.razor create mode 100644 samples/ThirdPartyControlsSample/Pages/BottomSheetPage.razor create mode 100644 samples/ThirdPartyControlsSample/Platforms/Android/Resources/values/styles.xml diff --git a/samples/ThirdPartyControlsSample/App.cs b/samples/ThirdPartyControlsSample/App.cs index ca7d28c9..b1c9da66 100644 --- a/samples/ThirdPartyControlsSample/App.cs +++ b/samples/ThirdPartyControlsSample/App.cs @@ -3,9 +3,9 @@ namespace ThirdPartyControlsSample; -public class App(IServiceProvider services) : BlazorBindingsApplication(services) +public class App : BlazorBindingsApplication { - protected override void Configure() + public App() { Resources.Add(new MaterialStyles()); } diff --git a/samples/ThirdPartyControlsSample/AppShell.razor b/samples/ThirdPartyControlsSample/AppShell.razor index e6d25361..3b8c63c6 100644 --- a/samples/ThirdPartyControlsSample/AppShell.razor +++ b/samples/ThirdPartyControlsSample/AppShell.razor @@ -6,4 +6,5 @@ + \ No newline at end of file diff --git a/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/AnchorDetent.generated.cs b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/AnchorDetent.generated.cs new file mode 100644 index 00000000..4eafdc57 --- /dev/null +++ b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/AnchorDetent.generated.cs @@ -0,0 +1,55 @@ +// +// This code was generated by a BlazorBindings.Maui component generator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +using BlazorBindings.Core; +using BlazorBindings.Maui.Elements; +using MC = Microsoft.Maui.Controls; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Rendering; +using System.Threading.Tasks; +using TMB = The49.Maui.BottomSheet; + +#pragma warning disable MBB001 + +namespace BlazorBindings.Maui.Elements.The49.BottomSheet +{ + public partial class AnchorDetent : Detent + { + static AnchorDetent() + { + RegisterAdditionalHandlers(); + } + + [Parameter] public RenderFragment Anchor { get; set; } + + public new TMB.AnchorDetent NativeControl => (TMB.AnchorDetent)((BindableObject)this).NativeControl; + + protected override TMB.AnchorDetent CreateNativeElement() => new(); + + protected override void HandleParameter(string name, object value) + { + switch (name) + { + case nameof(Anchor): + Anchor = (RenderFragment)value; + break; + + default: + base.HandleParameter(name, value); + break; + } + } + + protected override void RenderAdditionalElementContent(RenderTreeBuilder builder, ref int sequence) + { + base.RenderAdditionalElementContent(builder, ref sequence); + RenderTreeBuilderHelper.AddContentProperty(builder, sequence++, Anchor, (x, value) => x.Anchor = (MC.VisualElement)value); + } + + static partial void RegisterAdditionalHandlers(); + } +} diff --git a/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/BottomSheet.generated.cs b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/BottomSheet.generated.cs new file mode 100644 index 00000000..6f663105 --- /dev/null +++ b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/BottomSheet.generated.cs @@ -0,0 +1,130 @@ +// +// This code was generated by a BlazorBindings.Maui component generator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +using BlazorBindings.Core; +using BlazorBindings.Maui.Elements; +using MC = Microsoft.Maui.Controls; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Rendering; +using Microsoft.Maui.Graphics; +using System; +using System.Threading.Tasks; +using TMB = The49.Maui.BottomSheet; + +#pragma warning disable MBB001 + +namespace BlazorBindings.Maui.Elements.The49.BottomSheet +{ + public partial class BottomSheet : BlazorBindings.Maui.Elements.ContentView + { + static BottomSheet() + { + RegisterAdditionalHandlers(); + } + + [Parameter] public double? CornerRadius { get; set; } + [Parameter] public Color HandleColor { get; set; } + [Parameter] public bool? HasBackdrop { get; set; } + [Parameter] public bool? HasHandle { get; set; } + [Parameter] public bool? IsCancelable { get; set; } + [Parameter] public RenderFragment Detents { get; set; } + [Parameter] public EventCallback OnDismissed { get; set; } + [Parameter] public EventCallback OnShowing { get; set; } + [Parameter] public EventCallback OnShown { get; set; } + + public new TMB.BottomSheet NativeControl => (TMB.BottomSheet)((BindableObject)this).NativeControl; + + protected override TMB.BottomSheet CreateNativeElement() => new(); + + protected override void HandleParameter(string name, object value) + { + switch (name) + { + case nameof(CornerRadius): + if (!Equals(CornerRadius, value)) + { + CornerRadius = (double?)value; + NativeControl.CornerRadius = CornerRadius ?? (double)TMB.BottomSheet.CornerRadiusProperty.DefaultValue; + } + break; + case nameof(HandleColor): + if (!Equals(HandleColor, value)) + { + HandleColor = (Color)value; + NativeControl.HandleColor = HandleColor; + } + break; + case nameof(HasBackdrop): + if (!Equals(HasBackdrop, value)) + { + HasBackdrop = (bool?)value; + NativeControl.HasBackdrop = HasBackdrop ?? (bool)TMB.BottomSheet.HasBackdropProperty.DefaultValue; + } + break; + case nameof(HasHandle): + if (!Equals(HasHandle, value)) + { + HasHandle = (bool?)value; + NativeControl.HasHandle = HasHandle ?? (bool)TMB.BottomSheet.HasHandleProperty.DefaultValue; + } + break; + case nameof(IsCancelable): + if (!Equals(IsCancelable, value)) + { + IsCancelable = (bool?)value; + NativeControl.IsCancelable = IsCancelable ?? (bool)TMB.BottomSheet.IsCancelableProperty.DefaultValue; + } + break; + case nameof(Detents): + Detents = (RenderFragment)value; + break; + case nameof(OnDismissed): + if (!Equals(OnDismissed, value)) + { + void NativeControlDismissed(object sender, TMB.DismissOrigin e) => InvokeEventCallback(OnDismissed, e); + + OnDismissed = (EventCallback)value; + NativeControl.Dismissed -= NativeControlDismissed; + NativeControl.Dismissed += NativeControlDismissed; + } + break; + case nameof(OnShowing): + if (!Equals(OnShowing, value)) + { + void NativeControlShowing(object sender, EventArgs e) => InvokeEventCallback(OnShowing); + + OnShowing = (EventCallback)value; + NativeControl.Showing -= NativeControlShowing; + NativeControl.Showing += NativeControlShowing; + } + break; + case nameof(OnShown): + if (!Equals(OnShown, value)) + { + void NativeControlShown(object sender, EventArgs e) => InvokeEventCallback(OnShown); + + OnShown = (EventCallback)value; + NativeControl.Shown -= NativeControlShown; + NativeControl.Shown += NativeControlShown; + } + break; + + default: + base.HandleParameter(name, value); + break; + } + } + + protected override void RenderAdditionalElementContent(RenderTreeBuilder builder, ref int sequence) + { + base.RenderAdditionalElementContent(builder, ref sequence); + RenderTreeBuilderHelper.AddListContentProperty(builder, sequence++, Detents, x => x.Detents); + } + + static partial void RegisterAdditionalHandlers(); + } +} diff --git a/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/ContentDetent.generated.cs b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/ContentDetent.generated.cs new file mode 100644 index 00000000..72c4227e --- /dev/null +++ b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/ContentDetent.generated.cs @@ -0,0 +1,33 @@ +// +// This code was generated by a BlazorBindings.Maui component generator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +using BlazorBindings.Core; +using BlazorBindings.Maui.Elements; +using MC = Microsoft.Maui.Controls; +using Microsoft.AspNetCore.Components; +using System.Threading.Tasks; +using TMB = The49.Maui.BottomSheet; + +#pragma warning disable MBB001 + +namespace BlazorBindings.Maui.Elements.The49.BottomSheet +{ + public partial class ContentDetent : Detent + { + static ContentDetent() + { + RegisterAdditionalHandlers(); + } + + public new TMB.ContentDetent NativeControl => (TMB.ContentDetent)((BindableObject)this).NativeControl; + + protected override TMB.ContentDetent CreateNativeElement() => new(); + + + static partial void RegisterAdditionalHandlers(); + } +} diff --git a/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/Detent.generated.cs b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/Detent.generated.cs new file mode 100644 index 00000000..95598624 --- /dev/null +++ b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/Detent.generated.cs @@ -0,0 +1,59 @@ +// +// This code was generated by a BlazorBindings.Maui component generator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +using BlazorBindings.Core; +using BlazorBindings.Maui.Elements; +using MC = Microsoft.Maui.Controls; +using Microsoft.AspNetCore.Components; +using System.Threading.Tasks; +using TMB = The49.Maui.BottomSheet; + +#pragma warning disable MBB001 + +namespace BlazorBindings.Maui.Elements.The49.BottomSheet +{ + public abstract partial class Detent : BlazorBindings.Maui.Elements.BindableObject + { + static Detent() + { + RegisterAdditionalHandlers(); + } + + [Parameter] public bool? IsDefault { get; set; } + [Parameter] public bool? IsEnabled { get; set; } + + public new TMB.Detent NativeControl => (TMB.Detent)((BindableObject)this).NativeControl; + + + protected override void HandleParameter(string name, object value) + { + switch (name) + { + case nameof(IsDefault): + if (!Equals(IsDefault, value)) + { + IsDefault = (bool?)value; + NativeControl.IsDefault = IsDefault ?? (bool)TMB.Detent.IsDefaultProperty.DefaultValue; + } + break; + case nameof(IsEnabled): + if (!Equals(IsEnabled, value)) + { + IsEnabled = (bool?)value; + NativeControl.IsEnabled = IsEnabled ?? (bool)TMB.Detent.IsEnabledProperty.DefaultValue; + } + break; + + default: + base.HandleParameter(name, value); + break; + } + } + + static partial void RegisterAdditionalHandlers(); + } +} diff --git a/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/FullscreenDetent.generated.cs b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/FullscreenDetent.generated.cs new file mode 100644 index 00000000..3e9ce9fb --- /dev/null +++ b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/FullscreenDetent.generated.cs @@ -0,0 +1,33 @@ +// +// This code was generated by a BlazorBindings.Maui component generator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +using BlazorBindings.Core; +using BlazorBindings.Maui.Elements; +using MC = Microsoft.Maui.Controls; +using Microsoft.AspNetCore.Components; +using System.Threading.Tasks; +using TMB = The49.Maui.BottomSheet; + +#pragma warning disable MBB001 + +namespace BlazorBindings.Maui.Elements.The49.BottomSheet +{ + public partial class FullscreenDetent : Detent + { + static FullscreenDetent() + { + RegisterAdditionalHandlers(); + } + + public new TMB.FullscreenDetent NativeControl => (TMB.FullscreenDetent)((BindableObject)this).NativeControl; + + protected override TMB.FullscreenDetent CreateNativeElement() => new(); + + + static partial void RegisterAdditionalHandlers(); + } +} diff --git a/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/HeightDetent.generated.cs b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/HeightDetent.generated.cs new file mode 100644 index 00000000..22709c0b --- /dev/null +++ b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/HeightDetent.generated.cs @@ -0,0 +1,52 @@ +// +// This code was generated by a BlazorBindings.Maui component generator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +using BlazorBindings.Core; +using BlazorBindings.Maui.Elements; +using MC = Microsoft.Maui.Controls; +using Microsoft.AspNetCore.Components; +using System.Threading.Tasks; +using TMB = The49.Maui.BottomSheet; + +#pragma warning disable MBB001 + +namespace BlazorBindings.Maui.Elements.The49.BottomSheet +{ + public partial class HeightDetent : Detent + { + static HeightDetent() + { + RegisterAdditionalHandlers(); + } + + [Parameter] public double? Height { get; set; } + + public new TMB.HeightDetent NativeControl => (TMB.HeightDetent)((BindableObject)this).NativeControl; + + protected override TMB.HeightDetent CreateNativeElement() => new(); + + protected override void HandleParameter(string name, object value) + { + switch (name) + { + case nameof(Height): + if (!Equals(Height, value)) + { + Height = (double?)value; + NativeControl.Height = Height ?? (double)TMB.HeightDetent.HeightProperty.DefaultValue; + } + break; + + default: + base.HandleParameter(name, value); + break; + } + } + + static partial void RegisterAdditionalHandlers(); + } +} diff --git a/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/MediumDetent.generated.cs b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/MediumDetent.generated.cs new file mode 100644 index 00000000..7b814c4b --- /dev/null +++ b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/MediumDetent.generated.cs @@ -0,0 +1,33 @@ +// +// This code was generated by a BlazorBindings.Maui component generator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +using BlazorBindings.Core; +using BlazorBindings.Maui.Elements; +using MC = Microsoft.Maui.Controls; +using Microsoft.AspNetCore.Components; +using System.Threading.Tasks; +using TMB = The49.Maui.BottomSheet; + +#pragma warning disable MBB001 + +namespace BlazorBindings.Maui.Elements.The49.BottomSheet +{ + public partial class MediumDetent : RatioDetent + { + static MediumDetent() + { + RegisterAdditionalHandlers(); + } + + public new TMB.MediumDetent NativeControl => (TMB.MediumDetent)((BindableObject)this).NativeControl; + + protected override TMB.MediumDetent CreateNativeElement() => new(); + + + static partial void RegisterAdditionalHandlers(); + } +} diff --git a/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/RatioDetent.generated.cs b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/RatioDetent.generated.cs new file mode 100644 index 00000000..da90b242 --- /dev/null +++ b/samples/ThirdPartyControlsSample/Elements/The49.BottomSheet/RatioDetent.generated.cs @@ -0,0 +1,52 @@ +// +// This code was generated by a BlazorBindings.Maui component generator. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +using BlazorBindings.Core; +using BlazorBindings.Maui.Elements; +using MC = Microsoft.Maui.Controls; +using Microsoft.AspNetCore.Components; +using System.Threading.Tasks; +using TMB = The49.Maui.BottomSheet; + +#pragma warning disable MBB001 + +namespace BlazorBindings.Maui.Elements.The49.BottomSheet +{ + public partial class RatioDetent : Detent + { + static RatioDetent() + { + RegisterAdditionalHandlers(); + } + + [Parameter] public float? Ratio { get; set; } + + public new TMB.RatioDetent NativeControl => (TMB.RatioDetent)((BindableObject)this).NativeControl; + + protected override TMB.RatioDetent CreateNativeElement() => new(); + + protected override void HandleParameter(string name, object value) + { + switch (name) + { + case nameof(Ratio): + if (!Equals(Ratio, value)) + { + Ratio = (float?)value; + NativeControl.Ratio = Ratio ?? (float)TMB.RatioDetent.RatioProperty.DefaultValue; + } + break; + + default: + base.HandleParameter(name, value); + break; + } + } + + static partial void RegisterAdditionalHandlers(); + } +} diff --git a/samples/ThirdPartyControlsSample/Extensions/NavigationExtensions.cs b/samples/ThirdPartyControlsSample/Extensions/NavigationExtensions.cs index db40cc45..0a28809b 100644 --- a/samples/ThirdPartyControlsSample/Extensions/NavigationExtensions.cs +++ b/samples/ThirdPartyControlsSample/Extensions/NavigationExtensions.cs @@ -1,5 +1,6 @@ using BlazorBindings.Maui; using CommunityToolkit.Maui.Views; +using The49.Maui.BottomSheet; using INavigation = BlazorBindings.Maui.INavigation; namespace ThirdPartyControlsSample.Extensions; @@ -17,4 +18,10 @@ public static async Task ShowMDPopupAsync(this INavigation navigation var popup = await ((Navigation)navigation).BuildElement(typeof(T), null); return await popup.ShowAtAsync(Application.Current.MainPage); } -} + + public static async Task ShowBottomSheet(this INavigation navigation) + { + var bottomSheet = await ((Navigation)navigation).BuildElement(typeof(T), null); + await bottomSheet.ShowAsync(); + } +} \ No newline at end of file diff --git a/samples/ThirdPartyControlsSample/MauiProgram.cs b/samples/ThirdPartyControlsSample/MauiProgram.cs index 927b51b0..acade91b 100644 --- a/samples/ThirdPartyControlsSample/MauiProgram.cs +++ b/samples/ThirdPartyControlsSample/MauiProgram.cs @@ -1,6 +1,7 @@ using BlazorBindings.Maui; using CommunityToolkit.Maui; using Material.Components.Maui.Extensions; +using The49.Maui.BottomSheet; namespace ThirdPartyControlsSample; @@ -13,6 +14,7 @@ public static MauiApp CreateMauiApp() .UseMauiApp() .UseMauiBlazorBindings() .UseMauiCommunityToolkit() + .UseBottomSheet() .UseMaterialComponents(["OpenSans-Regular.ttf"]) .ConfigureFonts(fonts => { diff --git a/samples/ThirdPartyControlsSample/Pages/BottomSheetExample.razor b/samples/ThirdPartyControlsSample/Pages/BottomSheetExample.razor new file mode 100644 index 00000000..9797a873 --- /dev/null +++ b/samples/ThirdPartyControlsSample/Pages/BottomSheetExample.razor @@ -0,0 +1,37 @@ +@using BlazorBindings.Maui.Elements.The49.BottomSheet + + + + + + + + + + + @for (int i = 0; i < 16; i++) + { + var index = i; + + + + + + + + +@code { + Color GetColor(int i) => colors[i % colors.Length]; + + Color[] colors = [ + Colors.Salmon, Colors.Green, Colors.AliceBlue, Colors.Yellow + ]; +} diff --git a/samples/ThirdPartyControlsSample/Pages/BottomSheetPage.razor b/samples/ThirdPartyControlsSample/Pages/BottomSheetPage.razor new file mode 100644 index 00000000..6d026d99 --- /dev/null +++ b/samples/ThirdPartyControlsSample/Pages/BottomSheetPage.razor @@ -0,0 +1,14 @@ + + +