Skip to content

Commit

Permalink
Add The49.Maui.BottomSheet sample page (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamescaper authored Nov 9, 2024
1 parent 0ef114c commit 14c7a6a
Show file tree
Hide file tree
Showing 19 changed files with 525 additions and 7 deletions.
4 changes: 2 additions & 2 deletions samples/ThirdPartyControlsSample/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace ThirdPartyControlsSample;

public class App(IServiceProvider services) : BlazorBindingsApplication<AppShell>(services)
public class App : BlazorBindingsApplication<AppShell>
{
protected override void Configure()
public App()
{
Resources.Add(new MaterialStyles());
}
Expand Down
1 change: 1 addition & 0 deletions samples/ThirdPartyControlsSample/AppShell.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<XCalendarPage/>
<MaterialComponentsPage/>
<SkiaCanvasPage/>
<BottomSheetPage/>
</Shell>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// <auto-generated>
// 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.
// </auto-generated>

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<TMB.AnchorDetent>(builder, sequence++, Anchor, (x, value) => x.Anchor = (MC.VisualElement)value);
}

static partial void RegisterAdditionalHandlers();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// <auto-generated>
// 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.
// </auto-generated>

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<TMB.DismissOrigin> 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<TMB.DismissOrigin>)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<TMB.BottomSheet, TMB.Detent>(builder, sequence++, Detents, x => x.Detents);
}

static partial void RegisterAdditionalHandlers();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// <auto-generated>
// 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.
// </auto-generated>

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();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// <auto-generated>
// 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.
// </auto-generated>

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();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// <auto-generated>
// 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.
// </auto-generated>

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();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// <auto-generated>
// 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.
// </auto-generated>

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();
}
}
Loading

0 comments on commit 14c7a6a

Please sign in to comment.