Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamescaper committed Nov 10, 2024
2 parents 1e02dc3 + 3644af3 commit a1e5a1f
Show file tree
Hide file tree
Showing 48 changed files with 1,301 additions and 317 deletions.
13 changes: 10 additions & 3 deletions samples/ControlGallery/AppShell.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@using ControlGallery.Views.PresentData
@using ControlGallery.Views.SetValues
@using ControlGallery.Views.Shell
@using ControlGallery.Views.Menus

<Shell BackgroundColor="_backgroundColor"
ForegroundColor="_foregroundColor"
Expand Down Expand Up @@ -62,9 +63,9 @@
<ShellContent Title="Shell Properties">
<ContentTemplate>
<ShellPropertiesPage @bind-ShellBackgroundColor="_backgroundColor"
@bind-ShellForegroundColor="_foregroundColor"
@bind-ShellUnselectedColor="_unselectedColor"
@bind-ShellTabBarTitleColor="_tabBarTitleColor" />
@bind-ShellForegroundColor="_foregroundColor"
@bind-ShellUnselectedColor="_unselectedColor"
@bind-ShellTabBarTitleColor="_tabBarTitleColor" />
</ContentTemplate>
</ShellContent>

Expand All @@ -81,6 +82,12 @@
<GestureEvents />
<GestureRecognizersPage />
<ErrorBoundariesPage />

@if (DeviceInfo.Platform == DevicePlatform.WinUI || DeviceInfo.Platform == DevicePlatform.MacCatalyst)
{
<ContextMenuPage />
<MenuBarPage />
}
</Shell>

@code {
Expand Down
30 changes: 30 additions & 0 deletions samples/ControlGallery/Views/Menus/ContextMenuPage.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<ContentPage Title="Context Menu" BackgroundColor="_selectedColor">
<VerticalStackLayout>
<Label Text="Right click to open context menu">
<ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Text="Black" OnClick="() => SelectColor(Colors.Black)" />

<MenuFlyoutSubItem Text="Light">
<MenuFlyoutItem Text="Blue" OnClick="() => SelectColor(Colors.LightBlue)" />
<MenuFlyoutItem Text="Coral" OnClick="() => SelectColor(Colors.LightCoral)" />
<MenuFlyoutItem Text="Cyan" OnClick="() => SelectColor(Colors.LightCyan)" />
</MenuFlyoutSubItem>

<MenuFlyoutSubItem Text="Dark">
<MenuFlyoutItem Text="Blue" OnClick="() => SelectColor(Colors.DarkBlue)" />
<MenuFlyoutItem Text="DarkMagenta" OnClick="() => SelectColor(Colors.DarkMagenta)" />
<MenuFlyoutItem Text="Cyan" OnClick="() => SelectColor(Colors.DarkCyan)" />
</MenuFlyoutSubItem>
</MenuFlyout>
</ContextFlyout>
</Label>
</VerticalStackLayout>

</ContentPage>

@code {
Color? _selectedColor = null;

void SelectColor(Color color) => _selectedColor = color;
}
57 changes: 57 additions & 0 deletions samples/ControlGallery/Views/Menus/MenuBarPage.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<ContentPage Title="Menu Bar">
<MenuBarItems>
<MenuBarItem Text="File">
<MenuFlyoutItem Text="Save" OnClick="Save">
<KeyboardAccelerators>
<KeyboardAccelerator Key="S" Modifiers="KeyboardAcceleratorModifiers.Ctrl" />
</KeyboardAccelerators>
</MenuFlyoutItem>

<MenuFlyoutItem Text="Exit" OnClick="Exit">
<KeyboardAccelerators>
<KeyboardAccelerator Key="Q" Modifiers="KeyboardAcceleratorModifiers.Ctrl" />
</KeyboardAccelerators>
</MenuFlyoutItem>
</MenuBarItem>

<MenuBarItem Text="Update">
<MenuFlyoutSubItem Text="Set Value">
<MenuFlyoutItem Text="1" OnClick="() => SetValue(1)" />
<MenuFlyoutItem Text="2" OnClick="() => SetValue(2)" />
<MenuFlyoutItem Text="3" OnClick="() => SetValue(3)" />
</MenuFlyoutSubItem>
</MenuBarItem>

</MenuBarItems>

<ChildContent>
<VerticalStackLayout>
<Label>Selected value: @value</Label>
@if (_saved)
{
<Label>Values are saved.</Label>
}
</VerticalStackLayout>
</ChildContent>
</ContentPage>

@code {
bool _saved;
int? value;

void SetValue(int i)
{
value = i;
_saved = false;
}

void Save()
{
_saved = true;
}

void Exit()
{
Application.Current.Quit();
}
}
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
15 changes: 10 additions & 5 deletions samples/ThirdPartyControlsSample/AppShell.razor
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
@using ThirdPartyControlsSample.Pages

<Shell>
<CommunityToolkitPage/>
<CommunityToolkitBehaviors/>
<XCalendarPage/>
<MaterialComponentsPage/>
<SkiaCanvasPage/>
<CommunityToolkitPage />
<CommunityToolkitBehaviors />
<XCalendarPage />
<SkiaCanvasPage />

@if (DeviceInfo.Platform == DevicePlatform.Android || DeviceInfo.Platform == DevicePlatform.iOS)
{
<MaterialComponentsPage />
<BottomSheetPage />
}
</Shell>

This file was deleted.

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

0 comments on commit a1e5a1f

Please sign in to comment.