diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 284dd46a..08ae77f5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -15,19 +15,12 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Install .NET 6.0.400 + - name: Install .NET uses: actions/setup-dotnet@v2 with: - dotnet-version: '6.0.400' - include-prerelease: true + dotnet-version: '7.0.x' - name: Install MAUI - run: | - dotnet workload install maui ` - --from-rollback-file https://maui.blob.core.windows.net/metadata/rollbacks/6.0.486.json ` - --source https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-a21b9a2d/nuget/v3/index.json ` - --source https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-52e9452f-3/nuget/v3/index.json ` - --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json ` - --source https://api.nuget.org/v3/index.json + run: dotnet workload install maui - name: Restore dependencies run: dotnet restore BlazorBindings.Maui.sln - name: Run tests diff --git a/BlazorBindings.Maui.sln b/BlazorBindings.Maui.sln index 09cb69db..6e54e04d 100644 --- a/BlazorBindings.Maui.sln +++ b/BlazorBindings.Maui.sln @@ -8,6 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig src\Directory.Build.props = src\Directory.Build.props src\Directory.Build.targets = src\Directory.Build.targets + .github\workflows\dotnet.yml = .github\workflows\dotnet.yml global.json = global.json nuget.config = nuget.config Readme.md = Readme.md diff --git a/samples/BlazorBindingsToDo/BlazorBindingsToDo.csproj b/samples/BlazorBindingsToDo/BlazorBindingsToDo.csproj index f4f5a2d5..16bffb08 100644 --- a/samples/BlazorBindingsToDo/BlazorBindingsToDo.csproj +++ b/samples/BlazorBindingsToDo/BlazorBindingsToDo.csproj @@ -1,8 +1,8 @@  - net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041.0 + net7.0-android;net7.0-ios;net7.0-maccatalyst + $(TargetFrameworks);net7.0-windows10.0.19041.0 Exe BlazorBindingsToDo true diff --git a/samples/BlazorBindingsToDo/Platforms/Android/AndroidManifest.xml b/samples/BlazorBindingsToDo/Platforms/Android/AndroidManifest.xml index 7570ff62..e9937ad7 100644 --- a/samples/BlazorBindingsToDo/Platforms/Android/AndroidManifest.xml +++ b/samples/BlazorBindingsToDo/Platforms/Android/AndroidManifest.xml @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/samples/BlazorBindingsXaminals/BlazorBindingsXaminals.csproj b/samples/BlazorBindingsXaminals/BlazorBindingsXaminals.csproj index e3fd66e6..f5fdcde0 100644 --- a/samples/BlazorBindingsXaminals/BlazorBindingsXaminals.csproj +++ b/samples/BlazorBindingsXaminals/BlazorBindingsXaminals.csproj @@ -1,8 +1,8 @@  - net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041.0 + net7.0-android;net7.0-ios;net7.0-maccatalyst + $(TargetFrameworks);net7.0-windows10.0.19041.0 Exe BlazorBindingsXaminals true diff --git a/samples/BlazorBindingsXaminals/Platforms/Android/AndroidManifest.xml b/samples/BlazorBindingsXaminals/Platforms/Android/AndroidManifest.xml index 7570ff62..e9937ad7 100644 --- a/samples/BlazorBindingsXaminals/Platforms/Android/AndroidManifest.xml +++ b/samples/BlazorBindingsXaminals/Platforms/Android/AndroidManifest.xml @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/samples/ControlGallery/ControlGallery.csproj b/samples/ControlGallery/ControlGallery.csproj index d0445a4e..e4baf246 100644 --- a/samples/ControlGallery/ControlGallery.csproj +++ b/samples/ControlGallery/ControlGallery.csproj @@ -1,8 +1,8 @@  - net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041.0 + net7.0-android;net7.0-ios;net7.0-maccatalyst + $(TargetFrameworks);net7.0-windows10.0.19041.0 Exe ControlGallery true diff --git a/samples/ControlGallery/Platforms/Android/AndroidManifest.xml b/samples/ControlGallery/Platforms/Android/AndroidManifest.xml index 7570ff62..e9937ad7 100644 --- a/samples/ControlGallery/Platforms/Android/AndroidManifest.xml +++ b/samples/ControlGallery/Platforms/Android/AndroidManifest.xml @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/samples/FluxorSample/FluxorSample.csproj b/samples/FluxorSample/FluxorSample.csproj index 1e16ff92..3c58adac 100644 --- a/samples/FluxorSample/FluxorSample.csproj +++ b/samples/FluxorSample/FluxorSample.csproj @@ -1,8 +1,8 @@  - net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041.0 + net7.0-android;net7.0-ios;net7.0-maccatalyst + $(TargetFrameworks);net7.0-windows10.0.19041.0 Exe FluxorSample true @@ -47,7 +47,7 @@ - + diff --git a/samples/FluxorSample/Platforms/Android/AndroidManifest.xml b/samples/FluxorSample/Platforms/Android/AndroidManifest.xml index 7570ff62..e9937ad7 100644 --- a/samples/FluxorSample/Platforms/Android/AndroidManifest.xml +++ b/samples/FluxorSample/Platforms/Android/AndroidManifest.xml @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/samples/FlyoutPageSample/FlyoutPageSample.csproj b/samples/FlyoutPageSample/FlyoutPageSample.csproj index 5f24f537..2778b364 100644 --- a/samples/FlyoutPageSample/FlyoutPageSample.csproj +++ b/samples/FlyoutPageSample/FlyoutPageSample.csproj @@ -1,10 +1,10 @@  - net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041.0 + net7.0-android;net7.0-ios;net7.0-maccatalyst + $(TargetFrameworks);net7.0-windows10.0.19041.0 - + Exe FlyoutPageSample true diff --git a/samples/ThirdPartyControlsSample/Elements/AlohaKit/Button.generated.cs b/samples/ThirdPartyControlsSample/Elements/AlohaKit/Button.generated.cs index fd03f3ca..870f99b9 100644 --- a/samples/ThirdPartyControlsSample/Elements/AlohaKit/Button.generated.cs +++ b/samples/ThirdPartyControlsSample/Elements/AlohaKit/Button.generated.cs @@ -132,7 +132,7 @@ protected override void HandleParameter(string name, object value) case nameof(OnPress): if (!Equals(OnPress, value)) { - void NativeControlPressed(object sender, EventArgs e) => InvokeAsync(() => OnPress.InvokeAsync()); + void NativeControlPressed(object sender, EventArgs e) => InvokeEventCallback(OnPress); OnPress = (EventCallback)value; NativeControl.Pressed -= NativeControlPressed; @@ -142,7 +142,7 @@ protected override void HandleParameter(string name, object value) case nameof(OnRelease): if (!Equals(OnRelease, value)) { - void NativeControlReleased(object sender, EventArgs e) => InvokeAsync(() => OnRelease.InvokeAsync()); + void NativeControlReleased(object sender, EventArgs e) => InvokeEventCallback(OnRelease); OnRelease = (EventCallback)value; NativeControl.Released -= NativeControlReleased; @@ -152,7 +152,7 @@ protected override void HandleParameter(string name, object value) case nameof(OnClick): if (!Equals(OnClick, value)) { - void NativeControlClicked(object sender, EventArgs e) => InvokeAsync(() => OnClick.InvokeAsync()); + void NativeControlClicked(object sender, EventArgs e) => InvokeEventCallback(OnClick); OnClick = (EventCallback)value; NativeControl.Clicked -= NativeControlClicked; diff --git a/samples/ThirdPartyControlsSample/Elements/AlohaKit/CheckBox.generated.cs b/samples/ThirdPartyControlsSample/Elements/AlohaKit/CheckBox.generated.cs index c5047047..10cde139 100644 --- a/samples/ThirdPartyControlsSample/Elements/AlohaKit/CheckBox.generated.cs +++ b/samples/ThirdPartyControlsSample/Elements/AlohaKit/CheckBox.generated.cs @@ -107,7 +107,7 @@ void NativeControlCheckedChanged(object sender, MC.CheckedChangedEventArgs e) { var value = NativeControl.IsChecked; IsChecked = value; - InvokeAsync(() => IsCheckedChanged.InvokeAsync(value)); + InvokeEventCallback(IsCheckedChanged, value); } IsCheckedChanged = (EventCallback)value; diff --git a/samples/ThirdPartyControlsSample/Elements/AlohaKit/NumericUpDown.generated.cs b/samples/ThirdPartyControlsSample/Elements/AlohaKit/NumericUpDown.generated.cs index 6a181b9d..a3c6b9b8 100644 --- a/samples/ThirdPartyControlsSample/Elements/AlohaKit/NumericUpDown.generated.cs +++ b/samples/ThirdPartyControlsSample/Elements/AlohaKit/NumericUpDown.generated.cs @@ -110,7 +110,7 @@ void NativeControlValueChanged(object sender, MC.ValueChangedEventArgs e) { var value = NativeControl.Value; Value = value; - InvokeAsync(() => ValueChanged.InvokeAsync(value)); + InvokeEventCallback(ValueChanged, value); } ValueChanged = (EventCallback)value; diff --git a/samples/ThirdPartyControlsSample/Elements/AlohaKit/ProgressRadial.generated.cs b/samples/ThirdPartyControlsSample/Elements/AlohaKit/ProgressRadial.generated.cs index 6730be54..e27190c3 100644 --- a/samples/ThirdPartyControlsSample/Elements/AlohaKit/ProgressRadial.generated.cs +++ b/samples/ThirdPartyControlsSample/Elements/AlohaKit/ProgressRadial.generated.cs @@ -111,7 +111,7 @@ void NativeControlValueChanged(object sender, MC.ValueChangedEventArgs e) { var value = NativeControl.Value; Value = value; - InvokeAsync(() => ValueChanged.InvokeAsync(value)); + InvokeEventCallback(ValueChanged, value); } ValueChanged = (EventCallback)value; diff --git a/samples/ThirdPartyControlsSample/Elements/AlohaKit/PulseIcon.generated.cs b/samples/ThirdPartyControlsSample/Elements/AlohaKit/PulseIcon.generated.cs index 941aa804..f2940587 100644 --- a/samples/ThirdPartyControlsSample/Elements/AlohaKit/PulseIcon.generated.cs +++ b/samples/ThirdPartyControlsSample/Elements/AlohaKit/PulseIcon.generated.cs @@ -75,7 +75,7 @@ protected override void HandleParameter(string name, object value) case nameof(OnClick): if (!Equals(OnClick, value)) { - void NativeControlClicked(object sender, EventArgs e) => InvokeAsync(() => OnClick.InvokeAsync()); + void NativeControlClicked(object sender, EventArgs e) => InvokeEventCallback(OnClick); OnClick = (EventCallback)value; NativeControl.Clicked -= NativeControlClicked; diff --git a/samples/ThirdPartyControlsSample/Elements/AlohaKit/Rating.generated.cs b/samples/ThirdPartyControlsSample/Elements/AlohaKit/Rating.generated.cs index 5ffe0520..693ac1a6 100644 --- a/samples/ThirdPartyControlsSample/Elements/AlohaKit/Rating.generated.cs +++ b/samples/ThirdPartyControlsSample/Elements/AlohaKit/Rating.generated.cs @@ -126,7 +126,7 @@ void NativeControlValueChanged(object sender, AC.RatingValueChangedEventArgs e) { var value = NativeControl.Value; Value = value; - InvokeAsync(() => ValueChanged.InvokeAsync(value)); + InvokeEventCallback(ValueChanged, value); } ValueChanged = (EventCallback)value; diff --git a/samples/ThirdPartyControlsSample/Elements/AlohaKit/Slider.generated.cs b/samples/ThirdPartyControlsSample/Elements/AlohaKit/Slider.generated.cs index 9069d9a6..e3ee97e1 100644 --- a/samples/ThirdPartyControlsSample/Elements/AlohaKit/Slider.generated.cs +++ b/samples/ThirdPartyControlsSample/Elements/AlohaKit/Slider.generated.cs @@ -120,7 +120,7 @@ void NativeControlValueChanged(object sender, MC.ValueChangedEventArgs e) { var value = NativeControl.Value; Value = value; - InvokeAsync(() => ValueChanged.InvokeAsync(value)); + InvokeEventCallback(ValueChanged, value); } ValueChanged = (EventCallback)value; diff --git a/samples/ThirdPartyControlsSample/Elements/AlohaKit/ToggleSwitch.generated.cs b/samples/ThirdPartyControlsSample/Elements/AlohaKit/ToggleSwitch.generated.cs index 1847b634..a331f864 100644 --- a/samples/ThirdPartyControlsSample/Elements/AlohaKit/ToggleSwitch.generated.cs +++ b/samples/ThirdPartyControlsSample/Elements/AlohaKit/ToggleSwitch.generated.cs @@ -87,7 +87,7 @@ void NativeControlPropertyChanged(object sender, PropertyChangedEventArgs e) { var value = NativeControl.IsOn; IsOn = value; - InvokeAsync(() => IsOnChanged.InvokeAsync(value)); + InvokeEventCallback(IsOnChanged, value); } } diff --git a/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/AvatarView.generated.cs b/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/AvatarView.generated.cs index d21502f1..cc1948d5 100644 --- a/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/AvatarView.generated.cs +++ b/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/AvatarView.generated.cs @@ -26,7 +26,6 @@ static AvatarView() [Parameter] public Color BorderColor { get; set; } [Parameter] public double? BorderWidth { get; set; } [Parameter] public double? CharacterSpacing { get; set; } - [Parameter] public CornerRadius? CornerRadius { get; set; } [Parameter] public MC.FontAttributes? FontAttributes { get; set; } [Parameter] public bool? FontAutoScalingEnabled { get; set; } [Parameter] public string FontFamily { get; set; } @@ -65,13 +64,6 @@ protected override void HandleParameter(string name, object value) NativeControl.CharacterSpacing = CharacterSpacing ?? default; } break; - case nameof(CornerRadius): - if (!Equals(CornerRadius, value)) - { - CornerRadius = (CornerRadius?)value; - NativeControl.CornerRadius = CornerRadius ?? (CornerRadius)CMV.AvatarView.CornerRadiusProperty.DefaultValue; - } - break; case nameof(FontAttributes): if (!Equals(FontAttributes, value)) { diff --git a/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/DrawingView.generated.cs b/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/DrawingView.generated.cs index b965852b..1a152162 100644 --- a/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/DrawingView.generated.cs +++ b/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/DrawingView.generated.cs @@ -86,7 +86,7 @@ protected override void HandleParameter(string name, object value) case nameof(OnDrawingLineCompleted): if (!Equals(OnDrawingLineCompleted, value)) { - void NativeControlDrawingLineCompleted(object sender, DrawingLineCompletedEventArgs e) => InvokeAsync(() => OnDrawingLineCompleted.InvokeAsync(e)); + void NativeControlDrawingLineCompleted(object sender, DrawingLineCompletedEventArgs e) => InvokeEventCallback(OnDrawingLineCompleted, e); OnDrawingLineCompleted = (EventCallback)value; NativeControl.DrawingLineCompleted -= NativeControlDrawingLineCompleted; diff --git a/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/Popup.generated.cs b/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/Popup.generated.cs index efe9d835..a36a2c2f 100644 --- a/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/Popup.generated.cs +++ b/samples/ThirdPartyControlsSample/Elements/CommunityToolkit/Popup.generated.cs @@ -33,6 +33,7 @@ static Popup() [Parameter] public MMP.LayoutAlignment? HorizontalOptions { get; set; } [Parameter] public Size? Size { get; set; } [Parameter] public MMP.LayoutAlignment? VerticalOptions { get; set; } + [Parameter] public MC.Window Window { get; set; } [Parameter] public RenderFragment ChildContent { get; set; } [Parameter] public EventCallback OnClosed { get; set; } [Parameter] public EventCallback OnOpened { get; set; } @@ -80,13 +81,20 @@ protected override void HandleParameter(string name, object value) NativeControl.VerticalOptions = VerticalOptions ?? (MMP.LayoutAlignment)CMV.Popup.VerticalOptionsProperty.DefaultValue; } break; + case nameof(Window): + if (!Equals(Window, value)) + { + Window = (MC.Window)value; + NativeControl.Window = Window; + } + break; case nameof(ChildContent): ChildContent = (RenderFragment)value; break; case nameof(OnClosed): if (!Equals(OnClosed, value)) { - void NativeControlClosed(object sender, PopupClosedEventArgs e) => InvokeAsync(() => OnClosed.InvokeAsync(e)); + void NativeControlClosed(object sender, PopupClosedEventArgs e) => InvokeEventCallback(OnClosed, e); OnClosed = (EventCallback)value; NativeControl.Closed -= NativeControlClosed; @@ -96,7 +104,7 @@ protected override void HandleParameter(string name, object value) case nameof(OnOpened): if (!Equals(OnOpened, value)) { - void NativeControlOpened(object sender, PopupOpenedEventArgs e) => InvokeAsync(() => OnOpened.InvokeAsync(e)); + void NativeControlOpened(object sender, PopupOpenedEventArgs e) => InvokeEventCallback(OnOpened, e); OnOpened = (EventCallback)value; NativeControl.Opened -= NativeControlOpened; diff --git a/samples/ThirdPartyControlsSample/Properties/Elements.cs b/samples/ThirdPartyControlsSample/Properties/Elements.cs index f70dc8d8..da83c362 100644 --- a/samples/ThirdPartyControlsSample/Properties/Elements.cs +++ b/samples/ThirdPartyControlsSample/Properties/Elements.cs @@ -19,7 +19,7 @@ [assembly: GenerateComponent(typeof(PulseIcon))] // CommunityToolkit -[assembly: GenerateComponent(typeof(CommunityToolkit.Maui.Views.AvatarView))] +[assembly: GenerateComponent(typeof(CommunityToolkit.Maui.Views.AvatarView), Exclude = new[] { nameof(CommunityToolkit.Maui.Views.AvatarView.CornerRadius) })] [assembly: GenerateComponent(typeof(CommunityToolkit.Maui.Views.DrawingView))] [assembly: GenerateComponent(typeof(CommunityToolkit.Maui.Views.Popup), Exclude = new[] { nameof(CommunityToolkit.Maui.Views.Popup.Anchor) })] diff --git a/samples/ThirdPartyControlsSample/ThirdPartyControlsSample.csproj b/samples/ThirdPartyControlsSample/ThirdPartyControlsSample.csproj index da38fc4d..f82cf0b9 100644 --- a/samples/ThirdPartyControlsSample/ThirdPartyControlsSample.csproj +++ b/samples/ThirdPartyControlsSample/ThirdPartyControlsSample.csproj @@ -1,8 +1,8 @@  - net6.0-android;net6.0-ios - $(TargetFrameworks);net6.0-windows10.0.19041.0 + net7.0-android;net7.0-ios + $(TargetFrameworks);net7.0-windows10.0.19041.0 Exe true true @@ -47,7 +47,7 @@ - + diff --git a/src/BlazorBindings.Core/BlazorBindings.Core.csproj b/src/BlazorBindings.Core/BlazorBindings.Core.csproj index 6a385f07..ca6f5ba5 100644 --- a/src/BlazorBindings.Core/BlazorBindings.Core.csproj +++ b/src/BlazorBindings.Core/BlazorBindings.Core.csproj @@ -1,14 +1,14 @@  - net6.0 + net7.0 Blazor Bindings Core Runtime Common logic for using Blazor to target native renderers. For mobile app projects for Android and iOS use the BlazorBindings.Maui package. blazor;blazorbindings - + all diff --git a/src/BlazorBindings.Maui.ComponentGenerator/BlazorBindings.Maui.ComponentGenerator.csproj b/src/BlazorBindings.Maui.ComponentGenerator/BlazorBindings.Maui.ComponentGenerator.csproj index e0d2ae27..65a04ad7 100644 --- a/src/BlazorBindings.Maui.ComponentGenerator/BlazorBindings.Maui.ComponentGenerator.csproj +++ b/src/BlazorBindings.Maui.ComponentGenerator/BlazorBindings.Maui.ComponentGenerator.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net7.0 Dotnet tool which generate BlazorBindings.Maui components for MAUI elements. true @@ -13,6 +13,6 @@ - + diff --git a/src/BlazorBindings.Maui.SkiaSharp/BlazorBindings.Maui.SkiaSharp.csproj b/src/BlazorBindings.Maui.SkiaSharp/BlazorBindings.Maui.SkiaSharp.csproj index d921eb1d..b94d0a86 100644 --- a/src/BlazorBindings.Maui.SkiaSharp/BlazorBindings.Maui.SkiaSharp.csproj +++ b/src/BlazorBindings.Maui.SkiaSharp/BlazorBindings.Maui.SkiaSharp.csproj @@ -1,8 +1,7 @@  - net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041.0 + net7.0 true Experimental binding of Skia Sharp in Maui Blazor Bindings Support for Skia Sharp for Maui Blazor Bindings. diff --git a/src/BlazorBindings.Maui/BlazorBindings.Maui.csproj b/src/BlazorBindings.Maui/BlazorBindings.Maui.csproj index ac725d98..d2b18c5f 100644 --- a/src/BlazorBindings.Maui/BlazorBindings.Maui.csproj +++ b/src/BlazorBindings.Maui/BlazorBindings.Maui.csproj @@ -1,8 +1,7 @@  - net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041.0 + net7.0 true Maui binding for Blazor Maui Blazor Bindings enables using Blazor syntax in .razor files to build native apps for iOS and Android. diff --git a/src/BlazorBindings.Maui/Elements/DataTemplates/DataTemplateItemComponent.cs b/src/BlazorBindings.Maui/Elements/DataTemplates/DataTemplateItemComponent.cs index 4abbee89..4056dec5 100644 --- a/src/BlazorBindings.Maui/Elements/DataTemplates/DataTemplateItemComponent.cs +++ b/src/BlazorBindings.Maui/Elements/DataTemplates/DataTemplateItemComponent.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; using System; +using System.Threading.Tasks; using MC = Microsoft.Maui.Controls; namespace BlazorBindings.Maui.Elements.DataTemplates @@ -12,34 +13,39 @@ namespace BlazorBindings.Maui.Elements.DataTemplates internal class DataTemplateItemComponent : ComponentBase #pragma warning restore CA1812 // Avoid uninstantiated internal classes { - private MC.BindableObject _contentView; private object _item; private bool _shouldRender = true; [Parameter] public RenderFragment Template { get; set; } - [Parameter] - public MC.BindableObject ContentView + [Parameter] public MC.BindableObject ContentView { get; set; } + + public override Task SetParametersAsync(ParameterView parameters) { - get - { - return _contentView; - } - set + foreach (var parValue in parameters) { - if (_contentView == null) + switch (parValue.Name) { - _contentView = value; - OnContentViewSet(); - } - else - { - if (_contentView != value) - { - throw new NotSupportedException("Cannot re-assign ContentView after being originally set."); - } + case nameof(Template): + Template = (RenderFragment)parValue.Value; + break; + + case nameof(ContentView): + if (ContentView == null) + { + ContentView = (MC.BindableObject)parValue.Value; + OnContentViewSet(); + } + else + { + if (ContentView != parValue.Value) + throw new NotSupportedException("Cannot re-assign ContentView after being originally set."); + } + break; } } + + return base.SetParametersAsync(ParameterView.Empty); } protected override bool ShouldRender() diff --git a/src/BlazorBindings.Maui/Elements/TapGestureRecognizer.generated.cs b/src/BlazorBindings.Maui/Elements/TapGestureRecognizer.generated.cs index 3ccce638..5e7d91aa 100644 --- a/src/BlazorBindings.Maui/Elements/TapGestureRecognizer.generated.cs +++ b/src/BlazorBindings.Maui/Elements/TapGestureRecognizer.generated.cs @@ -8,7 +8,6 @@ using BlazorBindings.Core; using MC = Microsoft.Maui.Controls; using Microsoft.AspNetCore.Components; -using System; using System.Threading.Tasks; namespace BlazorBindings.Maui.Elements @@ -20,8 +19,9 @@ static TapGestureRecognizer() RegisterAdditionalHandlers(); } + [Parameter] public MC.ButtonsMask? Buttons { get; set; } [Parameter] public int? NumberOfTapsRequired { get; set; } - [Parameter] public EventCallback OnTapped { get; set; } + [Parameter] public EventCallback OnTapped { get; set; } public new MC.TapGestureRecognizer NativeControl => (MC.TapGestureRecognizer)((BindableObject)this).NativeControl; @@ -31,6 +31,13 @@ protected override void HandleParameter(string name, object value) { switch (name) { + case nameof(Buttons): + if (!Equals(Buttons, value)) + { + Buttons = (MC.ButtonsMask?)value; + NativeControl.Buttons = Buttons ?? (MC.ButtonsMask)MC.TapGestureRecognizer.ButtonsProperty.DefaultValue; + } + break; case nameof(NumberOfTapsRequired): if (!Equals(NumberOfTapsRequired, value)) { @@ -41,9 +48,9 @@ protected override void HandleParameter(string name, object value) case nameof(OnTapped): if (!Equals(OnTapped, value)) { - void NativeControlTapped(object sender, EventArgs e) => InvokeEventCallback(OnTapped); + void NativeControlTapped(object sender, MC.TappedEventArgs e) => InvokeEventCallback(OnTapped, e); - OnTapped = (EventCallback)value; + OnTapped = (EventCallback)value; NativeControl.Tapped -= NativeControlTapped; NativeControl.Tapped += NativeControlTapped; } diff --git a/src/BlazorBindings.Maui/Elements/View.cs b/src/BlazorBindings.Maui/Elements/View.cs index 5817ed6a..fca19b17 100644 --- a/src/BlazorBindings.Maui/Elements/View.cs +++ b/src/BlazorBindings.Maui/Elements/View.cs @@ -11,8 +11,8 @@ namespace BlazorBindings.Maui.Elements { public abstract partial class View : VisualElement { - [Parameter] public EventCallback OnTap { get; set; } - [Parameter] public EventCallback OnDoubleTap { get; set; } + [Parameter] public EventCallback OnTap { get; set; } + [Parameter] public EventCallback OnDoubleTap { get; set; } [Parameter] public EventCallback OnSwipe { get; set; } [Parameter] public EventCallback OnPinchUpdate { get; set; } [Parameter] public EventCallback OnPanUpdate { get; set; } @@ -25,7 +25,7 @@ protected override bool HandleAdditionalParameter(string name, object value) if (!Equals(value, OnTap)) { HandleTap(); - OnTap = (EventCallback)value; + OnTap = (EventCallback)value; } return true; @@ -33,7 +33,7 @@ protected override bool HandleAdditionalParameter(string name, object value) if (!Equals(value, OnDoubleTap)) { HandleDoubleTap(); - OnDoubleTap = (EventCallback)value; + OnDoubleTap = (EventCallback)value; } return true; @@ -69,7 +69,7 @@ protected override bool HandleAdditionalParameter(string name, object value) private void HandleTap() { - void GestureRecognizerTapped(object sender, EventArgs e) => InvokeEventCallback(OnTap); + void GestureRecognizerTapped(object sender, MC.TappedEventArgs e) => InvokeEventCallback(OnTap, e); var tapGestureRecognizer = NativeControl.GestureRecognizers .OfType() @@ -87,7 +87,7 @@ private void HandleTap() private void HandleDoubleTap() { - void GestureRecognizerTapped(object sender, EventArgs e) => InvokeEventCallback(OnDoubleTap); + void GestureRecognizerTapped(object sender, MC.TappedEventArgs e) => InvokeEventCallback(OnDoubleTap, e); var tapGestureRecognizer = NativeControl.GestureRecognizers .OfType() diff --git a/src/BlazorBindings.Maui/Elements/VisualElement.generated.cs b/src/BlazorBindings.Maui/Elements/VisualElement.generated.cs index 0313d2ca..39c42f6d 100644 --- a/src/BlazorBindings.Maui/Elements/VisualElement.generated.cs +++ b/src/BlazorBindings.Maui/Elements/VisualElement.generated.cs @@ -226,7 +226,7 @@ protected override void HandleParameter(string name, object value) if (!Equals(ZIndex, value)) { ZIndex = (int?)value; - NativeControl.ZIndex = ZIndex ?? default; + NativeControl.ZIndex = ZIndex ?? (int)MC.VisualElement.ZIndexProperty.DefaultValue; } break; case nameof(Background): diff --git a/src/BlazorBindings.UnitTests/BlazorBindings.UnitTests.csproj b/src/BlazorBindings.UnitTests/BlazorBindings.UnitTests.csproj index 240112a3..b2e1880f 100644 --- a/src/BlazorBindings.UnitTests/BlazorBindings.UnitTests.csproj +++ b/src/BlazorBindings.UnitTests/BlazorBindings.UnitTests.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 false true @@ -9,7 +9,7 @@ - + diff --git a/templates/BlazorBindingsMaui-app/NewApp/NewApp.csproj b/templates/BlazorBindingsMaui-app/NewApp/NewApp.csproj index 7eaa1210..2dbf368f 100644 --- a/templates/BlazorBindingsMaui-app/NewApp/NewApp.csproj +++ b/templates/BlazorBindingsMaui-app/NewApp/NewApp.csproj @@ -1,8 +1,8 @@  - net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041.0 + net7.0-android;net7.0-ios;net7.0-maccatalyst + $(TargetFrameworks);net7.0-windows10.0.19041.0 Exe NewApp true diff --git a/templates/BlazorBindingsMaui-app/NewApp/Platforms/Android/AndroidManifest.xml b/templates/BlazorBindingsMaui-app/NewApp/Platforms/Android/AndroidManifest.xml index 7570ff62..e9937ad7 100644 --- a/templates/BlazorBindingsMaui-app/NewApp/Platforms/Android/AndroidManifest.xml +++ b/templates/BlazorBindingsMaui-app/NewApp/Platforms/Android/AndroidManifest.xml @@ -1,6 +1,6 @@  - + \ No newline at end of file