From c4169edb795bbf6ba917393cf5f0897769239def Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:13:31 +0100 Subject: [PATCH 001/171] Point to the .NET 9.0 release candidate --- Directory.Build.props | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index d96f40baad..49354d4cd3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,8 +1,8 @@ - net8.0 - 8.0.71 + net9.0 + 9.0.0-rc.1.24453.9 latest enable enable diff --git a/global.json b/global.json index ce2e41208c..227dee71fb 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.303", + "version": "9.0.100-rc.1.24452.12", "rollForward": "latestFeature", "allowPrerelease": false } From e8e4c21b15126b693be0106787dbfbbf8c73482b Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Wed, 18 Sep 2024 20:51:36 +0100 Subject: [PATCH 002/171] Tweak versions in the pipeline --- azure-pipelines.yml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a45eee7a9f..877822625f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,8 +6,8 @@ variables: NugetPackageVersionCamera: '$(CurrentSemanticVersion)' NugetPackageVersionMediaElement: '$(CurrentSemanticVersion)' NugetPackageVersionMaps: '$(CurrentSemanticVersion)' - TOOLKIT_NET_VERSION: '8.0.303' - LATEST_NET_VERSION: '8.0.x' + TOOLKIT_NET_VERSION: '9.0.100-rc.1.24452.12' + LATEST_NET_VERSION: '9.0.x' PathToLibrarySolution: 'src/CommunityToolkit.Maui.sln' PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Sample.sln' PathToCommunityToolkitCsproj: 'src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj' diff --git a/global.json b/global.json index 227dee71fb..9c2a135743 100644 --- a/global.json +++ b/global.json @@ -2,6 +2,6 @@ "sdk": { "version": "9.0.100-rc.1.24452.12", "rollForward": "latestFeature", - "allowPrerelease": false + "allowPrerelease": true } } From 0223b47581fdb63b6c46859ea28e5761e291138f Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Wed, 18 Sep 2024 20:57:22 +0100 Subject: [PATCH 003/171] allow prerelease builds --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 877822625f..c0f4c2ce69 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -75,7 +75,7 @@ jobs: inputs: packageType: 'sdk' version: '$(LATEST_NET_VERSION)' - includePreviewVersions: false + includePreviewVersions: true - task: CmdLine@2 displayName: 'Install Latest .NET MAUI Workload' @@ -205,7 +205,7 @@ jobs: inputs: packageType: 'sdk' version: '$(TOOLKIT_NET_VERSION)' - includePreviewVersions: false + includePreviewVersions: true - task: CmdLine@2 displayName: 'Install .NET MAUI Workload $(TOOLKIT_NET_VERSION)' From 24f10265a3ff40f517ebabfc32ff386e42b48f87 Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:14:20 +0100 Subject: [PATCH 004/171] Find overlapping versions for AnxroidX libraries --- .../CommunityToolkit.Maui.Camera.csproj | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj index b34b26d4ee..7484e1b419 100644 --- a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj +++ b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj @@ -51,8 +51,8 @@ - - + + - + + + - - + + From 616ca9c90204659155f91e1d049c65d2693c200a Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:29:40 +0100 Subject: [PATCH 005/171] Fix null reference type issue --- .../Behaviors/Validators/ValidationBehavior.shared.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs index a9f324ad00..e898ccb2ca 100644 --- a/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs @@ -410,13 +410,8 @@ async ValueTask UpdateStateAsync(VisualElement? view, ValidationFlags flags, boo void UpdateStyle(in VisualElement view, bool isValid) { VisualStateManager.GoToState(view, isValid ? ValidVisualState : InvalidVisualState); - - if ((ValidStyle ?? InvalidStyle) == null) - { - return; - } - - view.Style = isValid ? ValidStyle : InvalidStyle; + + view.Style = (isValid ? ValidStyle : InvalidStyle) ?? view.Style; } void ResetValidationTokenSource(CancellationTokenSource? newTokenSource) From 590d8df9e8f609d70c11ad846ae7267bfd0c1d1a Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:02:10 +0100 Subject: [PATCH 006/171] Shift to TypedBindings --- .../ImageSources/GravatarImageSource.shared.cs | 8 +++++--- src/CommunityToolkit.Maui/Views/AvatarView.shared.cs | 4 ++-- .../Views/Expander/Expander.shared.cs | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs b/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs index c8b35a52e5..1d187d5b3a 100644 --- a/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs +++ b/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs @@ -1,4 +1,6 @@ -namespace CommunityToolkit.Maui.ImageSources; +using Microsoft.Maui.Controls.Internals; + +namespace CommunityToolkit.Maui.ImageSources; using CommunityToolkit.Maui.Extensions; using Microsoft.Maui.Controls; @@ -143,8 +145,8 @@ protected override void OnParentSet() return; } - SetBinding(ParentWidthProperty, new Binding(nameof(VisualElement.Width), BindingMode.OneWay, source: parentElement)); - SetBinding(ParentHeightProperty, new Binding(nameof(VisualElement.Height), BindingMode.OneWay, source: parentElement)); + SetBinding(ParentWidthProperty, BindingBase.Create(static p => p.Width, source: parentElement)); + SetBinding(ParentHeightProperty, BindingBase.Create(static p => p.Height, source: parentElement)); } static string DefaultGravatarName(DefaultImage defaultGravatar) => defaultGravatar switch diff --git a/src/CommunityToolkit.Maui/Views/AvatarView.shared.cs b/src/CommunityToolkit.Maui/Views/AvatarView.shared.cs index cc2b21fa24..c66d1b3f04 100644 --- a/src/CommunityToolkit.Maui/Views/AvatarView.shared.cs +++ b/src/CommunityToolkit.Maui/Views/AvatarView.shared.cs @@ -72,8 +72,8 @@ public AvatarView() CornerRadius = new CornerRadius(AvatarViewDefaults.DefaultCornerRadius.TopLeft, AvatarViewDefaults.DefaultCornerRadius.TopRight, AvatarViewDefaults.DefaultCornerRadius.BottomLeft, AvatarViewDefaults.DefaultCornerRadius.BottomRight), }; Content = avatarLabel; - avatarImage.SetBinding(WidthRequestProperty, new Binding(nameof(WidthRequest), source: this)); - avatarImage.SetBinding(HeightRequestProperty, new Binding(nameof(HeightRequest), source: this)); + avatarImage.SetBinding(WidthRequestProperty, BindingBase.Create(static p => p.WidthRequest, source: this)); + avatarImage.SetBinding(HeightRequestProperty, BindingBase.Create(static p => p.HeightRequest, source: this)); } /// Gets or sets the control font. diff --git a/src/CommunityToolkit.Maui/Views/Expander/Expander.shared.cs b/src/CommunityToolkit.Maui/Views/Expander/Expander.shared.cs index 6743bd9b55..86e417c0ac 100644 --- a/src/CommunityToolkit.Maui/Views/Expander/Expander.shared.cs +++ b/src/CommunityToolkit.Maui/Views/Expander/Expander.shared.cs @@ -81,7 +81,7 @@ static void OnContentPropertyChanged(BindableObject bindable, object oldValue, o var expander = (Expander)bindable; if (newValue is View view) { - view.SetBinding(IsVisibleProperty, new Binding(nameof(IsExpanded), source: bindable)); + view.SetBinding(IsVisibleProperty, BindingBase.Create(static p => p.IsExpanded, source: expander)); expander.ContentGrid.Remove(oldValue); expander.ContentGrid.Add(newValue); From 39df165571104e5d60d374d64c2f8e036d182652 Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:04:24 +0100 Subject: [PATCH 007/171] Keep disabling IL2092 for NET9_0 --- .../Converters/ICommunityToolkitValueConverter.shared.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CommunityToolkit.Maui/Converters/ICommunityToolkitValueConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/ICommunityToolkitValueConverter.shared.cs index d0a86cb842..3588699880 100644 --- a/src/CommunityToolkit.Maui/Converters/ICommunityToolkitValueConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/ICommunityToolkitValueConverter.shared.cs @@ -52,7 +52,7 @@ public interface ICommunityToolkitValueConverter : IValueConverter /// -#if NET8_0 // Should be fixed in .NET 9 +#if NET8_0 || NET9_0 // Should be fixed in .NET 9 - Not fixed in the first RC #pragma warning disable IL2092 #endif object? IValueConverter.Convert(object? value, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type targetType, object? parameter, CultureInfo culture) => @@ -61,7 +61,7 @@ public interface ICommunityToolkitValueConverter : IValueConverter /// object? IValueConverter.ConvertBack(object? value, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type targetType, object? parameter, CultureInfo culture) => ConvertBack(value, targetType, parameter, culture); -#if NET8_0 +#if NET8_0 || NET9_0 #pragma warning restore IL2092 #endif } \ No newline at end of file From 39de8a0d6a3d1a2e092e2f9fcce4b9faf7c3f5ce Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:13:03 +0100 Subject: [PATCH 008/171] Mark types as Dynamically accessed --- .../Converters/IsInRangeConverter.shared.cs | 2 +- src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CommunityToolkit.Maui/Converters/IsInRangeConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsInRangeConverter.shared.cs index 5c99330d6b..2405970861 100644 --- a/src/CommunityToolkit.Maui/Converters/IsInRangeConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IsInRangeConverter.shared.cs @@ -7,7 +7,7 @@ namespace CommunityToolkit.Maui.Converters; public sealed class IsInRangeConverter : IsInRangeConverter; /// Converts the incoming value to a indicating whether or not the value is within a range. -public abstract class IsInRangeConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TValue, TReturnObject> : BaseConverterOneWay where TValue : IComparable +public abstract class IsInRangeConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TValue, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TReturnObject> : BaseConverterOneWay where TValue : IComparable { /// /// Bindable property for diff --git a/src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs index 9e99150953..1eceedeb12 100644 --- a/src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs @@ -17,7 +17,7 @@ public class MultiConverter : List, ICommunityT [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type ICommunityToolkitValueConverter.ToType => throw new NotSupportedException($"{nameof(ICommunityToolkitMultiValueConverter)} does not implement {nameof(ICommunityToolkitValueConverter.ToType)}"); -#if NET8_0 // Should be fixed in .NET 9 +#if NET8_0 || NET9_0 // Should be fixed in .NET 9 #pragma warning disable IL2092 #endif /// @@ -44,7 +44,7 @@ public class MultiConverter : List, ICommunityT /// N/A public object? ConvertBack(object? value, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type targetType, object? parameter, System.Globalization.CultureInfo? culture) => throw new NotSupportedException("Impossible to revert to original value. Consider setting BindingMode to OneWay."); -#if NET8_0 // Should be fixed in .NET 9 +#if NET8_0 || NET9_0 // Should be fixed in .NET 9 #pragma warning restore IL2092 #endif } \ No newline at end of file From 9514390186ebc871f10b138044ab77a1d85108d3 Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Thu, 19 Sep 2024 20:13:26 +0100 Subject: [PATCH 009/171] Patch up Analyzer unit tests --- .../Verifiers/CSharpAnalyzerVerifier`1+Test.cs | 2 ++ .../Verifiers/CSharpCodeFixVerifier`2+Test.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpAnalyzerVerifier`1+Test.cs b/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpAnalyzerVerifier`1+Test.cs index de07fb6431..206fdc97c2 100644 --- a/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpAnalyzerVerifier`1+Test.cs +++ b/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpAnalyzerVerifier`1+Test.cs @@ -12,6 +12,8 @@ public Test(params Type[] assembliesUnderTest) { #if NET8_0 ReferenceAssemblies = Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.Net.Net80; +#elif NET9_0 + ReferenceAssemblies = Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.Net.Net90; #else #error ReferenceAssemblies must be updated to current version of .NET #endif diff --git a/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2+Test.cs b/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2+Test.cs index c44215a564..c34f2f306c 100644 --- a/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2+Test.cs +++ b/src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2+Test.cs @@ -15,6 +15,8 @@ public Test(params Type[] assembliesUnderTest) { #if NET8_0 ReferenceAssemblies = ReferenceAssemblies.Net.Net80; +#elif NET9_0 + ReferenceAssemblies = ReferenceAssemblies.Net.Net90; #else #error ReferenceAssemblies must be updated to current version of .NET #endif From 5677465c0e1179909f6ce923115e87a91b920dc2 Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Thu, 19 Sep 2024 20:13:41 +0100 Subject: [PATCH 010/171] Fix the AvatarView unit tests --- .../Views/AvatarView/AvatarViewTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs index be24e71749..81ec646cf7 100644 --- a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs +++ b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs @@ -108,7 +108,7 @@ public void ConstructorTest() avatarView.TextColor.Should().Be(Colors.Pink); avatarView.Text.Should().Be("GL"); avatarView.TextTransform.Should().Be(TextTransform.Lowercase); - Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity).Request; + Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity); request.Width.Should().Be(10); request.Height.Should().Be(20); } @@ -191,7 +191,7 @@ public void DefaultFontSize() public void DefaultHeightRequest() { var avatarView = new Maui.Views.AvatarView(); - Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity).Request; + Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity); request.Height.Should().Be(AvatarViewDefaults.DefaultHeightRequest); } @@ -228,7 +228,7 @@ public void DefaultProperties() public void DefaultWidthRequest() { var avatarView = new Maui.Views.AvatarView(); - Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity).Request; + Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity); request.Width.Should().Be(AvatarViewDefaults.DefaultWidthRequest); } From 0e90207e2634a39b8f45edbd3b34891d078e3364 Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Thu, 19 Sep 2024 20:15:19 +0100 Subject: [PATCH 011/171] Suppress warning disable IL2026 --- .../Behaviors/EventToCommandBehavior.shared.cs | 2 ++ .../Behaviors/ICommunityToolkitBehavior.shared.cs | 2 ++ .../Behaviors/Validators/ValidationBehavior.shared.cs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/CommunityToolkit.Maui/Behaviors/EventToCommandBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/EventToCommandBehavior.shared.cs index 801c92fb64..e9b45d4fb4 100644 --- a/src/CommunityToolkit.Maui/Behaviors/EventToCommandBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/EventToCommandBehavior.shared.cs @@ -34,7 +34,9 @@ public class EventToCommandBehavior : BaseBehavior public static readonly BindableProperty EventArgsConverterProperty = BindableProperty.Create(nameof(EventArgsConverter), typeof(IValueConverter), typeof(EventToCommandBehavior)); +#pragma warning disable IL2026 // NET9.0 - check if this can be fixed readonly MethodInfo eventHandlerMethodInfo = typeof(EventToCommandBehavior).GetTypeInfo().GetDeclaredMethod(nameof(OnTriggerHandled)) ?? throw new InvalidOperationException($"Cannot find method {nameof(OnTriggerHandled)}"); +#pragma warning restore IL2026 Delegate? eventHandler; diff --git a/src/CommunityToolkit.Maui/Behaviors/ICommunityToolkitBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/ICommunityToolkitBehavior.shared.cs index 0df155889f..3efe333778 100644 --- a/src/CommunityToolkit.Maui/Behaviors/ICommunityToolkitBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/ICommunityToolkitBehavior.shared.cs @@ -26,11 +26,13 @@ internal bool TrySetBindingContextToAttachedViewBindingContext() return false; } +#pragma warning disable IL2026 // NET9.0 - check if this can be fixed behavior.SetBinding(BindableObject.BindingContextProperty, new Binding { Source = View, Path = BindableObject.BindingContextProperty.PropertyName }); +#pragma warning restore IL2026 return true; diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs index e898ccb2ca..cafb654ecc 100644 --- a/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs @@ -346,11 +346,13 @@ async Task OnValuePropertyChanged(CancellationToken token) void OnValuePropertyNamePropertyChanged() { +#pragma warning disable IL2026 // NET9.0 - check if this can be fixed SetBinding(ValueProperty, new Binding { Path = ValuePropertyName, Source = View }); +#pragma warning restore IL2026 } async ValueTask UpdateStateAsync(VisualElement? view, ValidationFlags flags, bool isForced, CancellationToken? parentToken = null) From 0674abffedfb5198e0d9dc12d9f0e8b27083c73b Mon Sep 17 00:00:00 2001 From: Shaun Lawrence <17139988+bijington@users.noreply.github.com> Date: Thu, 19 Sep 2024 20:16:51 +0100 Subject: [PATCH 012/171] Update comments in Camera project --- .../CommunityToolkit.Maui.Camera.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj index 7484e1b419..81b2e99275 100644 --- a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj +++ b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj @@ -54,9 +54,9 @@ - nullable, CS0419,CS1570,CS1571,CS1572,CS1573,CS1574,CS1580,CS1581,CS1584,CS1587,CS1589,CS1590,CS1591,CS1592,CS1598,CS1658,CS1710,CS1711,CS1712,CS1723,CS1734, + NU1900,NU1901,NU1902,NU1903,NU1904,NU1905, xUnit1012,xUnit2021, IL2001,IL2002,IL2003,IL2004,IL2005,IL2006,IL2007,IL2008,IL2009, IL2010,IL2011,IL2012,IL2013,IL2014,IL2015,IL2016,IL2017,IL2018,IL2019, From 83ba19a281515176c94071ff3689c6e739cf48d0 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:17:13 -0700 Subject: [PATCH 027/171] Remove Obsolete PopupService method --- .../IPopupService.cs | 18 ---- .../PopupServiceTests.cs | 96 +------------------ src/CommunityToolkit.Maui/PopupService.cs | 76 +++++---------- 3 files changed, 27 insertions(+), 163 deletions(-) diff --git a/src/CommunityToolkit.Maui.Core/IPopupService.cs b/src/CommunityToolkit.Maui.Core/IPopupService.cs index 59008d80f7..2a59a7b640 100644 --- a/src/CommunityToolkit.Maui.Core/IPopupService.cs +++ b/src/CommunityToolkit.Maui.Core/IPopupService.cs @@ -21,14 +21,6 @@ public interface IPopupService /// An that will be performed before the popup is presented. void ShowPopup(Action onPresenting) where TViewModel : INotifyPropertyChanged; - /// - /// Resolves and displays a and pair that was registered with AddTransientPopup. - /// - /// The type of the view model registered with the . - /// The view model to use as the BindingContext for the . - [Obsolete("This method will be removed in an upcoming version. Use ShowPopup instead.")] - void ShowPopup(TViewModel viewModel) where TViewModel : INotifyPropertyChanged; - /// /// Resolves and displays a and pair that was registered with AddTransientPopup. /// @@ -46,14 +38,4 @@ public interface IPopupService /// An that will be performed before the popup is presented. /// Task ShowPopupAsync(Action onPresenting, CancellationToken token = default) where TViewModel : INotifyPropertyChanged; - - /// - /// Resolves and displays a and pair that was registered with AddTransientPopup. - /// - /// The type of the view model registered with the . - /// The view model to use as the BindingContext for the . - /// - /// A that can be awaited to return the result of the once it has been dismissed. - [Obsolete("This method will be removed in an upcoming version. Use ShowPopupAsync instead.")] - Task ShowPopupAsync(TViewModel viewModel, CancellationToken token = default) where TViewModel : INotifyPropertyChanged; } \ No newline at end of file diff --git a/src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs b/src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs index 3a86273211..d80cd28779 100644 --- a/src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs +++ b/src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs @@ -26,17 +26,6 @@ static PopupServiceTests() PopupService.AddTransientPopup(serviceCollection); } - [Fact] - public async Task ShowPopupAsyncWithNullViewModelShouldThrowArgumentNullException() - { - var popupService = new PopupService(new MockServiceProvider()); - -#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. - await Assert.ThrowsAsync(() => - popupService.ShowPopupAsync(viewModel: null, CancellationToken.None)); -#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. - } - [Fact] public async Task ShowPopupAsyncWithNullOnPresentingShouldThrowArgumentNullException() { @@ -86,17 +75,6 @@ public async Task ShowPopupAsync_CancellationTokenCanceled() await Assert.ThrowsAsync(() => popupService.ShowPopupAsync(cts.Token)); } - [Fact] - public async Task ShowPopupAsyncWithMismatchedViewModelTypeShouldThrowInvalidOperationException() - { - var popupService = new PopupService(new MockServiceProvider()); - -#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. - await Assert.ThrowsAsync(() => - popupService.ShowPopupAsync(viewModel: null, CancellationToken.None)); -#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. - } - [Fact(Timeout = (int)TestDuration.Short)] public async Task ShowPopupAsyncShouldThrowInvalidOperationExceptionWhenNoViewModelIsRegistered() { @@ -196,16 +174,6 @@ public async Task ShowPopupAsyncShouldReturnResultOnceClosed() Assert.Same(expectedResult, result); } - [Fact] - public void ShowPopupWithNullViewModelShouldThrowArgumentNullException() - { - var popupService = new PopupService(new MockServiceProvider()); - -#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. - Assert.Throws(() => popupService.ShowPopup(viewModel: null)); -#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. - } - [Fact] public void ShowPopupWithNullOnPresentingShouldThrowArgumentNullException() { @@ -216,54 +184,6 @@ public void ShowPopupWithNullOnPresentingShouldThrowArgumentNullException() #pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. } - [Fact] - public void ShowPopupWithMismatchedViewModelTypeShouldThrowInvalidOperationException() - { - var popupService = new PopupService(new MockServiceProvider()); - -#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. - Assert.Throws(() => popupService.ShowPopup(viewModel: null)); -#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type. - } - - [Fact(Timeout = (int)TestDuration.Short)] - public async Task ShowPopupAsyncWithViewModel_CancellationTokenExpired() - { - var popupViewModel = new MockPageViewModel(); - var popupInstance = new MockSelfClosingPopup(string.Empty) - { - BindingContext = popupViewModel - }; - - SetupTest(popupInstance, () => popupViewModel, out var popupService); - - var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(1)); - - // Ensure CancellationToken has expired - await Task.Delay(100, CancellationToken.None); - - await Assert.ThrowsAsync(() => popupService.ShowPopupAsync(popupViewModel, cts.Token)); - } - - [Fact(Timeout = (int)TestDuration.Short)] - public async Task ShowPopupAsyncWithViewModel_CancellationTokenCanceled() - { - var popupViewModel = new MockPageViewModel(); - var popupInstance = new MockSelfClosingPopup(string.Empty) - { - BindingContext = popupViewModel - }; - - SetupTest(popupInstance, () => popupViewModel, out var popupService); - - var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(1)); - - // Ensure CancellationToken has expired - await cts.CancelAsync(); - - await Assert.ThrowsAsync(() => popupService.ShowPopupAsync(popupViewModel, cts.Token)); - } - [Fact] public void ShowPopupShouldThrowInvalidOperationExceptionWhenNoViewModelIsRegistered() { @@ -354,21 +274,13 @@ public static MockServiceProvider ThatProvides(params (object implementation, Ty } } - class MockPopup : Popup + sealed class MockPopup : Popup { - public MockPopup() - { - } } - class MockSelfClosingPopup : Popup + sealed class MockSelfClosingPopup(object result) : Popup { - readonly object result; - - public MockSelfClosingPopup(object result) - { - this.result = result; - } + readonly object result = result; internal override async void OnOpened() { @@ -380,7 +292,7 @@ internal override async void OnOpened() } } - class MockMismatchedPopup : Popup + sealed class MockMismatchedPopup : Popup { public MockMismatchedPopup() { diff --git a/src/CommunityToolkit.Maui/PopupService.cs b/src/CommunityToolkit.Maui/PopupService.cs index c7649be975..14cbfdcca5 100644 --- a/src/CommunityToolkit.Maui/PopupService.cs +++ b/src/CommunityToolkit.Maui/PopupService.cs @@ -13,7 +13,7 @@ public class PopupService : IPopupService static readonly Dictionary viewModelToViewMappings = []; - static Page CurrentPage => + static Page CurrentPage => PageExtensions.GetCurrentPage( Application.Current?.MainPage ?? throw new InvalidOperationException("Application.Current.MainPage cannot be null.")); @@ -56,18 +56,6 @@ public void ShowPopup() where TViewModel : INotifyPropertyChanged ShowPopup(popup); } - /// - public void ShowPopup(TViewModel viewModel) where TViewModel : INotifyPropertyChanged - { - ArgumentNullException.ThrowIfNull(viewModel); - - var popup = GetPopup(typeof(TViewModel)); - - ValidateBindingContext(popup, out _); - - ShowPopup(popup); - } - /// public void ShowPopup(Action onPresenting) where TViewModel : INotifyPropertyChanged { @@ -82,26 +70,6 @@ public void ShowPopup(Action onPresenting) where TViewMo ShowPopup(popup); } - static void ShowPopup(Popup popup) - { -#if WINDOWS - if (Application.Current is Application app) - { - if (app.Windows.FirstOrDefault(x => x.IsActivated) is Window activeWindow) - { - if (activeWindow.Page is Page page) - { - page.ShowPopup(popup); - return; - } - } - } - CurrentPage.ShowPopup(popup); -#else - CurrentPage.ShowPopup(popup); -#endif - } - /// public Task ShowPopupAsync(CancellationToken token = default) where TViewModel : INotifyPropertyChanged { @@ -112,18 +80,6 @@ static void ShowPopup(Popup popup) return ShowPopupAsync(popup, token); } - /// - public Task ShowPopupAsync(TViewModel viewModel, CancellationToken token = default) where TViewModel : INotifyPropertyChanged - { - ArgumentNullException.ThrowIfNull(viewModel); - - var popup = GetPopup(typeof(TViewModel)); - - ValidateBindingContext(popup, out _); - - return ShowPopupAsync(popup, token); - } - /// public Task ShowPopupAsync(Action onPresenting, CancellationToken token = default) where TViewModel : INotifyPropertyChanged { @@ -173,17 +129,31 @@ static void ValidateBindingContext(Popup popup, out TViewModel bindi bindingContext = viewModel; } - - Popup GetPopup(Type viewModelType) + + static void ShowPopup(Popup popup) { - var popup = serviceProvider.GetService(viewModelToViewMappings[viewModelType]) as Popup; - - if (popup is null) +#if WINDOWS + if (Application.Current is Application app) { - throw new InvalidOperationException( - $"Unable to resolve popup type for {viewModelType} please make sure that you have called {nameof(AddTransientPopup)}"); + if (app.Windows.FirstOrDefault(x => x.IsActivated) is Window activeWindow) + { + if (activeWindow.Page is Page page) + { + page.ShowPopup(popup); + return; + } + } } + CurrentPage.ShowPopup(popup); +#else + CurrentPage.ShowPopup(popup); +#endif + } - return popup; + Popup GetPopup(Type viewModelType) + { + var popup = (Popup)(serviceProvider.GetService(viewModelToViewMappings[viewModelType]) + ?? throw new InvalidOperationException($"Unable to resolve popup type for {viewModelType} please make sure that you have called {nameof(PopupService)}.{nameof(AddTransientPopup)} in MauiProgram.cs")); + return popup; } } \ No newline at end of file From 8bdbc6fbd2f003f5406e6ca48c71bb238590370a Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:25:03 -0700 Subject: [PATCH 028/171] Update for .NET 9 RC 2 --- azure-pipelines.yml | 2 +- global.json | 2 +- .../CommunityToolkit.Maui.Sample.csproj | 4 ++-- .../CommunityToolkit.Maui.Camera.csproj | 4 ++-- .../CommunityToolkit.Maui.Core.csproj | 4 ++-- .../CommunityToolkit.Maui.Maps.csproj | 4 ++-- .../CommunityToolkit.Maui.MediaElement.csproj | 4 ++-- src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 203550339e..d85b29fd21 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,7 +6,7 @@ variables: NugetPackageVersionCamera: '$(CurrentSemanticVersion)' NugetPackageVersionMediaElement: '$(CurrentSemanticVersion)' NugetPackageVersionMaps: '$(CurrentSemanticVersion)' - TOOLKIT_NET_VERSION: '9.0.100-rc.1.24452.12' + TOOLKIT_NET_VERSION: '9.0.100-rc.2.24474.11' LATEST_NET_VERSION: '9.0.x' PathToLibrarySolution: 'src/CommunityToolkit.Maui.sln' PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Sample.sln' diff --git a/global.json b/global.json index 9c2a135743..1ada742598 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.100-rc.1.24452.12", + "version": "9.0.100-rc.2.24474.11", "rollForward": "latestFeature", "allowPrerelease": true } diff --git a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj index ab7ba34c21..d6081ce0ce 100644 --- a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj +++ b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj @@ -69,8 +69,8 @@ - 14.2 - 14.0 + 15.0 + 15.0 21.0 10.0.17763.0 6.5 diff --git a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj index 81b2e99275..ae358aa359 100644 --- a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj +++ b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj @@ -8,8 +8,8 @@ true true - 11.0 - 13.1 + 15.0 + 15.0 21.0 10.0.17763.0 10.0.17763.0 diff --git a/src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj b/src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj index a85cb7a014..716125b0a2 100644 --- a/src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj +++ b/src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj @@ -8,8 +8,8 @@ true true - 11.0 - 13.1 + 15.0 + 15.0 21.0 10.0.17763.0 10.0.17763.0 diff --git a/src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj b/src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj index 401ed42d7e..602a2844e2 100644 --- a/src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj +++ b/src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj @@ -8,8 +8,8 @@ true true - 11.0 - 13.1 + 15.0 + 15.0 21.0 10.0.17763.0 10.0.17763.0 diff --git a/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj b/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj index 8fab04e6d9..ea625fe51a 100644 --- a/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj +++ b/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj @@ -8,8 +8,8 @@ true true - 11.0 - 13.1 + 15.0 + 15.0 21.0 10.0.17763.0 10.0.17763.0 diff --git a/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj b/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj index 90e5296dc5..d5c17eed11 100644 --- a/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj +++ b/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj @@ -11,8 +11,8 @@ true $(BaseIntermediateOutputPath)\GeneratedFiles - 11.0 - 13.1 + 15.0 + 15.0 21.0 10.0.17763.0 10.0.17763.0 From 189c16db235ad1db6c488ffc5cc81eee1137352d Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:35:30 -0700 Subject: [PATCH 029/171] Update Android dependencies --- .../CommunityToolkit.Maui.Camera.csproj | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj index ae358aa359..348ff1275f 100644 --- a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj +++ b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj @@ -50,31 +50,16 @@ - - - - - - - - - - - - - + + + + + + - From 5daf80496d4fa18422cecec32ea341c0c4603f17 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:38:32 -0700 Subject: [PATCH 030/171] Remove unrequired NuGet Packages --- .../CommunityToolkit.Maui.Camera.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj index 348ff1275f..be6b3e102b 100644 --- a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj +++ b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj @@ -53,9 +53,6 @@ - - - From b66ae8348c12239caa49e4eac64a47d363484402 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:41:43 -0700 Subject: [PATCH 031/171] Fix Vulnerabilities --- .../CommunityToolkit.Maui.Analyzers.UnitTests.csproj | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj b/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj index 9ef490244c..0350e09073 100644 --- a/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj +++ b/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj @@ -23,9 +23,7 @@ - - - + From c0b7a6e69618e0ddbcc425597ffbd92f4e43b94f Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:29:37 -0700 Subject: [PATCH 032/171] Resolve NuGet Dependency Conflicts --- .../CommunityToolkit.Maui.Camera.csproj | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj index be6b3e102b..492a385575 100644 --- a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj +++ b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj @@ -53,6 +53,13 @@ + + + + + + + From 552c31c4b09099cf9149b3ac5cbd3fd453f68056 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:01:41 -0700 Subject: [PATCH 033/171] Remove reflection --- .../Views/Popup/PopupExtensions.windows.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.windows.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.windows.cs index c4e9da01fb..19b9ec17c4 100644 --- a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.windows.cs +++ b/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.windows.cs @@ -2,6 +2,7 @@ using Microsoft.Maui.Platform; using Microsoft.Maui.Primitives; using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; namespace CommunityToolkit.Maui.Core.Views; @@ -21,10 +22,9 @@ public static void SetColor(this Popup mauiPopup, IPopup popup) ArgumentNullException.ThrowIfNull(popup.Content); var color = popup.Color ?? Colors.Transparent; - if (mauiPopup.Child is FrameworkElement content) + if (mauiPopup.Child is Panel panel) { - var backgroundProperty = content.GetType().GetProperty("Background"); - backgroundProperty?.SetValue(content, color.ToPlatform()); + panel.Background = color.ToPlatform(); } } From e1e3f5e0a7f672d7f2095b3d97f3425f0c230d95 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:16:07 -0700 Subject: [PATCH 034/171] Fix `Camera` Android Dependencies --- .../CommunityToolkit.Maui.Camera.csproj | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj index 492a385575..77820ec321 100644 --- a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj +++ b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj @@ -51,15 +51,8 @@ - - - - - - - - - + + From 9a0b53760568d572b100c40cd7ec16511fa9fb8d Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:16:14 -0700 Subject: [PATCH 035/171] Refactor return statement --- .../Extensions/PageExtensions.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs b/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs index 26b41bb920..c0ce337910 100644 --- a/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs +++ b/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs @@ -47,11 +47,8 @@ public static bool Exists { return false; } - if (CurrentPage.GetParentWindow().Handler.PlatformView is null) - { - return false; - } - return true; + + return CurrentPage.GetParentWindow().Handler?.PlatformView is not null; } } } From 2f20c4aad688b0cdd43b00ac1f0d1962a8f0199b Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:30:13 -0700 Subject: [PATCH 036/171] Fix nullability error --- .../Views/Popup/PopupExtensions.windows.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.windows.cs b/src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.windows.cs index 37a7c672ec..756a98f18b 100644 --- a/src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.windows.cs +++ b/src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.windows.cs @@ -1,5 +1,4 @@ using CommunityToolkit.Maui.Core; -using Microsoft.Maui.Controls.Platform; using Microsoft.Maui.Platform; namespace CommunityToolkit.Maui.Views; @@ -11,10 +10,12 @@ public static partial class PopupExtensions { static void PlatformShowPopup(Popup popup, IMauiContext mauiContext) { - var window = mauiContext.GetPlatformWindow().GetWindow() ?? throw new NullReferenceException("Window is null."); + if(mauiContext.GetPlatformWindow().GetWindow()?.Content is not Page parent) + { + throw new InvalidOperationException("Window Content cannot be null"); + } - Page parent = ((Page)window.Content).GetCurrentPage(); - parent?.AddLogicalChild(popup); + parent.AddLogicalChild(popup); var platform = popup.ToHandler(mauiContext); platform?.Invoke(nameof(IPopup.OnOpened)); From 1996cd5e30448e93bb7fc5678092dc171bf87446 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:31:25 -0700 Subject: [PATCH 037/171] Update AppShell.xaml --- samples/CommunityToolkit.Maui.Sample/AppShell.xaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/CommunityToolkit.Maui.Sample/AppShell.xaml b/samples/CommunityToolkit.Maui.Sample/AppShell.xaml index 1ee3e5751a..ceb1a787b6 100644 --- a/samples/CommunityToolkit.Maui.Sample/AppShell.xaml +++ b/samples/CommunityToolkit.Maui.Sample/AppShell.xaml @@ -17,8 +17,8 @@ x:Name="flyout" Title="{OnPlatform WinUI='Toolkit Features', Default={x:Null}}" FlyoutBackgroundColor="{OnPlatform WinUI=Transparent, - Default={AppThemeBinding Light={StaticResource White}, - Dark={StaticResource Black}}}" + Default={AppThemeBinding Light= White, + Dark= Black}}" FlyoutBehavior="{OnPlatform WinUI=Locked, Default=Flyout}"> From e5bc87b91e5e71199fa947548605df63b9e09c65 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:36:46 -0700 Subject: [PATCH 038/171] Increase to RC2 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 51e920792a..bb650835ce 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ net9.0 - 9.0.0-rc.1.24453.9 + 9.0.0-rc.2.24503.2 latest enable enable From b6841ce8fe845ccc1eacdd1b7ff0943cff9ec6ca Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:52:23 -0700 Subject: [PATCH 039/171] Use `static` --- .../Pages/Alerts/SnackbarPage.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml.cs index a304c4cb54..07d655f0f1 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml.cs @@ -105,7 +105,7 @@ await Application.Current.MainPage.Navigation.PushModalAsync(new ContentPage Children = { - new Button { Command = new AsyncRelayCommand(token => Snackbar.Make("Snackbar in a Modal Page").Show(token)) } + new Button { Command = new AsyncRelayCommand(static token => Snackbar.Make("Snackbar in a Modal Page").Show(token)) } .Top().CenterHorizontal() .Text("Display Snackbar"), From e119e5342a32a9a877a89064343712650c5b055f Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 09:33:22 -0700 Subject: [PATCH 040/171] Use `private protected` constructor --- .../Converters/BaseConverter.shared.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs index cf020e530b..0b2e9cd8a1 100644 --- a/src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs @@ -13,6 +13,11 @@ namespace CommunityToolkit.Maui.Converters; /// Type of parameter public abstract class BaseConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TFrom, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TTo, TParam> : ValueConverterExtension, ICommunityToolkitValueConverter { + private protected BaseConverter() + { + + } + /// /// Default value to return when throws an . /// This value is used when is set to . @@ -105,6 +110,11 @@ public abstract class BaseConverter<[DynamicallyAccessedMembers(DynamicallyAcces /// Type of the output value. public abstract class BaseConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TFrom, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TTo> : ValueConverterExtension, ICommunityToolkitValueConverter { + private protected BaseConverter() + { + + } + /// /// Default value to return when throws an . /// This value is used when is set to . From f2a36fd1a7d3edb8b9fa90954cbbd67f8d2350ff Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 09:35:58 -0700 Subject: [PATCH 041/171] Stop automatically assigning Behavior BindingContext --- .../Behaviors/BaseBehavior.shared.cs | 4 +- .../ICommunityToolkitBehavior.shared.cs | 47 +------------------ .../BasePlatformBehavior.shared.cs | 4 +- 3 files changed, 6 insertions(+), 49 deletions(-) diff --git a/src/CommunityToolkit.Maui/Behaviors/BaseBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/BaseBehavior.shared.cs index c64cbb98ca..6458a0cecc 100644 --- a/src/CommunityToolkit.Maui/Behaviors/BaseBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/BaseBehavior.shared.cs @@ -39,7 +39,7 @@ protected override void OnAttachedTo(TView bindable) { base.OnAttachedTo(bindable); - ((ICommunityToolkitBehavior)this).AssignViewAndBingingContext(bindable); + ((ICommunityToolkitBehavior)this).InitializeBehavior(bindable); } /// @@ -47,7 +47,7 @@ protected override void OnDetachingFrom(TView bindable) { base.OnDetachingFrom(bindable); - ((ICommunityToolkitBehavior)this).UnassignViewAndBingingContext(bindable); + ((ICommunityToolkitBehavior)this).UninitializeBehavior(bindable); } void ICommunityToolkitBehavior.OnViewPropertyChanged(TView sender, PropertyChangedEventArgs e) => OnViewPropertyChanged(sender, e); diff --git a/src/CommunityToolkit.Maui/Behaviors/ICommunityToolkitBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/ICommunityToolkitBehavior.shared.cs index 0311fb8316..0f461d4048 100644 --- a/src/CommunityToolkit.Maui/Behaviors/ICommunityToolkitBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/ICommunityToolkitBehavior.shared.cs @@ -15,59 +15,16 @@ public interface ICommunityToolkitBehavior where TView : Element /// protected TView? View { get; set; } - internal bool TrySetBindingContextToAttachedViewBindingContext() - { - if (this is not Behavior behavior) - { - throw new InvalidOperationException($"{nameof(ICommunityToolkitBehavior)} can only be used for a {nameof(Behavior)}"); - } - - if (behavior.IsSet(BindableObject.BindingContextProperty) || View is null) - { - return false; - } - - behavior.SetBinding( - BindableObject.BindingContextProperty, - new TypedBinding( - static x => (x?.BindingContext, true), - (source, property) => { }, - null)); - - return true; - } - - internal bool TryRemoveBindingContext() - { - if (this is not Behavior behavior) - { - throw new InvalidOperationException($"{nameof(ICommunityToolkitBehavior)} can only be used for a {nameof(Behavior)}"); - } - - if (behavior.IsSet(BindableObject.BindingContextProperty)) - { - behavior.RemoveBinding(BindableObject.BindingContextProperty); - return true; - } - - return false; - } - [MemberNotNull(nameof(View))] - internal void AssignViewAndBingingContext(TView bindable) + internal void InitializeBehavior(TView bindable) { View = bindable; bindable.PropertyChanged += OnViewPropertyChanged; - - TrySetBindingContextToAttachedViewBindingContext(); } - internal void UnassignViewAndBingingContext(TView bindable) + internal void UninitializeBehavior(TView bindable) { - TryRemoveBindingContext(); - bindable.PropertyChanged -= OnViewPropertyChanged; - View = null; } diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/BasePlatformBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/BasePlatformBehavior.shared.cs index 4ea86e5db9..dfa28bd6ce 100644 --- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/BasePlatformBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/BasePlatformBehavior.shared.cs @@ -68,7 +68,7 @@ protected override void OnAttachedTo(TView bindable, TPlatformView platformView) { base.OnAttachedTo(bindable, platformView); - ((ICommunityToolkitBehavior)this).AssignViewAndBingingContext(bindable); + ((ICommunityToolkitBehavior)this).InitializeBehavior(bindable); } /// @@ -76,7 +76,7 @@ protected override void OnDetachedFrom(TView bindable, TPlatformView platformVie { base.OnDetachedFrom(bindable, platformView); - ((ICommunityToolkitBehavior)this).UnassignViewAndBingingContext(bindable); + ((ICommunityToolkitBehavior)this).UninitializeBehavior(bindable); } void ICommunityToolkitBehavior.OnViewPropertyChanged(TView sender, PropertyChangedEventArgs e) => OnViewPropertyChanged(sender, e); From 7c004e4c8c843c216f9e5cb9dd14253dc2379834 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 09:50:42 -0700 Subject: [PATCH 042/171] Remove References to `TrySetBindingContextToAttachedViewBindingContext` --- .../MultiValidationBehavior.shared.cs | 30 +------------------ 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs index 5275c32094..7c215f5636 100644 --- a/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs @@ -24,18 +24,13 @@ public class MultiValidationBehavior : ValidationBehavior readonly ObservableCollection children = []; - /// - /// Constructor for this behavior. - /// - public MultiValidationBehavior() => children.CollectionChanged += OnChildrenCollectionChanged; - /// /// All child behaviors that are part of this . This is a bindable property. /// public IList Children => children; /// - /// Holds the errors from all of the nested invalid validators in . This is a bindable property. + /// Holds the errors from all the nested invalid validators in . This is a bindable property. /// public List? Errors { @@ -81,27 +76,4 @@ await Task.WhenAll(children.Select(c => return false; } - - static void OnChildrenCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) - { - if (e.NewItems is not null) - { - foreach (var child in e.NewItems.OfType()) - { - var isSuccessful = ((ICommunityToolkitBehavior)child).TrySetBindingContextToAttachedViewBindingContext(); - if (!isSuccessful) - { - Trace.TraceInformation($"Setting {nameof(BindingContext)} for {child.GetType()} failed"); - } - } - } - - if (e.OldItems is not null) - { - foreach (var child in e.OldItems.OfType()) - { - ((ICommunityToolkitBehavior)child).TryRemoveBindingContext(); - } - } - } } \ No newline at end of file From a5f0e86b56a8808e2e3c445d97561bbba6316a6a Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 09:50:45 -0700 Subject: [PATCH 043/171] Update BaseBehaviorTest.cs --- .../Behaviors/BaseBehaviorTest.cs | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/BaseBehaviorTest.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/BaseBehaviorTest.cs index b580e057d1..47d89a3609 100644 --- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/BaseBehaviorTest.cs +++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/BaseBehaviorTest.cs @@ -25,7 +25,7 @@ public void EnsureICommunityToolkitBehaviorIsBehavior() } [Fact] - public void VerifyTrySetBindingContextIsCalledWhenViewAttached() + public void VerifyBindingContextNotAutomaticallySetWhenViewAttached() { if (behavior is BasePlatformBehavior) { @@ -36,13 +36,12 @@ public void VerifyTrySetBindingContextIsCalledWhenViewAttached() view.Behaviors.Add((Behavior)behavior); - var falseResult = behavior.TrySetBindingContextToAttachedViewBindingContext(); - - Assert.False(falseResult); + Assert.Single(view.Behaviors); + Assert.Null(view.Behaviors[0].BindingContext); } [Fact] - public void EnsureTryRemoveBindingContextWhenViewAttached() + public void EnsureTryRemoveBindingContextUnchangedWhenViewAttached() { if (behavior is BasePlatformBehavior) { @@ -52,17 +51,20 @@ public void EnsureTryRemoveBindingContextWhenViewAttached() return; } - // Ensure false by default - var falseResult = behavior.TryRemoveBindingContext(); - Assert.False(falseResult); - - view.Behaviors.Add((Behavior)behavior); + // Ensure empty by default + Assert.Empty(view.Behaviors); - Assert.False(behavior.TrySetBindingContextToAttachedViewBindingContext()); + var attachedBehavior = (Behavior)behavior; + + view.Behaviors.Add(attachedBehavior); + view.Behaviors[0].BindingContext = view.BindingContext; + + Assert.Equal(view.BindingContext, attachedBehavior.BindingContext); - var trueResult = behavior.TryRemoveBindingContext(); + var wasSuccessful = view.Behaviors.TryRemove(attachedBehavior); - Assert.True(trueResult); + Assert.True(wasSuccessful); + Assert.Equal(view.BindingContext, attachedBehavior.BindingContext); } protected class MockValidationBehavior : ValidationBehavior From c2bbb86071df6e20f45d3e7395c4a02a87da5b1a Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:00:28 -0700 Subject: [PATCH 044/171] Refactor GravatarImageSource --- .../GravatarImageSource/GravatarImageSourceTests.cs | 2 +- .../ImageSources/GravatarImageSource.shared.cs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/CommunityToolkit.Maui.UnitTests/ImageSources/GravatarImageSource/GravatarImageSourceTests.cs b/src/CommunityToolkit.Maui.UnitTests/ImageSources/GravatarImageSource/GravatarImageSourceTests.cs index 9f5210e36a..bcaff810b2 100644 --- a/src/CommunityToolkit.Maui.UnitTests/ImageSources/GravatarImageSource/GravatarImageSourceTests.cs +++ b/src/CommunityToolkit.Maui.UnitTests/ImageSources/GravatarImageSource/GravatarImageSourceTests.cs @@ -66,7 +66,7 @@ public void Default404Image() { Image testControl = new() { - Source = new GravatarImageSource() + Source = new GravatarImageSource { Email = email, } diff --git a/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs b/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs index 1d187d5b3a..e996fbdfa3 100644 --- a/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs +++ b/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs @@ -26,12 +26,13 @@ public class GravatarImageSource : StreamImageSource, IDisposable /// The backing store for the bindable property. internal static readonly BindableProperty ParentWidthProperty = BindableProperty.Create(nameof(ParentWidth), typeof(int), typeof(GravatarImageSource), defaultValue: defaultSize, propertyChanged: OnSizePropertyChanged); - - const int cancellationTokenSourceTimeout = 737; + const string defaultGravatarImageAddress = "https://www.gravatar.com/avatar/"; const int defaultSize = 80; - + static readonly Lazy singletonHttpClientHolder = new(); + + readonly TimeSpan cancellationTokenSourceTimeout = TimeSpan.FromMilliseconds(737); int? gravatarSize; Uri? lastDispatch; @@ -170,7 +171,7 @@ static async void OnEmailPropertyChanged(BindableObject bindable, object oldValu static async void OnSizePropertyChanged(BindableObject bindable, object oldValue, object newValue) { - if (newValue is not int intNewValue || intNewValue <= -1) + if (newValue is not (int intNewValue and > -1)) { return; } From 0bae4749c55d20b97efa480d336e39219196fb2f Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:29:51 -0700 Subject: [PATCH 045/171] Update CommunityToolkit.Maui.Sample.csproj --- .../CommunityToolkit.Maui.Sample.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj index 5134ce24dc..98b4c43859 100644 --- a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj +++ b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj @@ -64,7 +64,7 @@ - + From 3210586da7d3a1306c5e610d28ef2e718225cb20 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:25:55 -0700 Subject: [PATCH 046/171] Update for CsWinRT1028, CsWinRT1030, XC0045, and XC0103 --- Directory.Build.props | 13 +++++++-- .../CommunityToolkit.Maui.Sample.csproj | 3 +++ .../CompareDoubleToColorConverter.cs | 3 ++- .../Pages/Alerts/AlertsGalleryPage.cs | 2 +- .../Pages/Base/BaseGalleryPage.cs | 7 ++--- .../Behaviors/AnimationBehaviorPage.xaml.cs | 4 +-- .../Pages/Behaviors/BehaviorsGalleryPage.cs | 2 +- ...viorCollectionViewMultipleSelectionPage.cs | 2 +- .../Pages/Converters/ConvertersGalleryPage.cs | 2 +- .../Converters/IsInRangeConverterPage.cs | 4 +-- .../Pages/Essentials/EssentialsGalleryPage.cs | 2 +- .../Pages/Essentials/SpeechToTextPage.xaml.cs | 3 ++- .../Pages/Extensions/ExtensionsGalleryPage.cs | 2 +- .../ImageSources/ImageSourcesGalleryPage.cs | 2 +- .../Pages/Layouts/LayoutsGalleryPage.cs | 2 +- .../Pages/Views/Expander/ExpanderPageCS.cs | 2 +- .../Pages/Views/LazyView/CustomLazyView.cs | 2 +- .../Pages/Views/LazyView/MyViewLazyView.cs | 2 +- .../MediaElementMultipleWindowsPage.cs | 2 +- .../Pages/Views/ViewsGalleryPage.cs | 2 +- .../Pages/WelcomePage.cs | 2 +- .../Alerts/AlertsGalleryViewModel.cs | 2 +- .../ViewModels/Alerts/SnackbarViewModel.cs | 2 +- .../ViewModels/Alerts/ToastViewModel.cs | 2 +- .../Behaviors/BehaviorsGalleryViewModel.cs | 2 +- .../CharactersValidationBehaviorViewModel.cs | 2 +- .../EmailValidationBehaviorViewModel.cs | 2 +- .../Behaviors/MaskedBehaviorViewModel.cs | 2 +- .../MultiValidationBehaviorViewModel.cs | 2 +- .../NumericValidationBehaviorViewModel.cs | 2 +- ...quiredStringValidationBehaviorViewModel.cs | 2 +- .../SelectAllTextBehaviorViewModel.cs | 2 +- ...tFocusOnEntryCompletedBehaviorViewModel.cs | 2 +- .../TextValidationBehaviorViewModel.cs | 2 +- .../UriValidationBehaviorViewModel.cs | 2 +- .../BoolToObjectConverterViewModel.cs | 2 +- .../Converters/ColorsConverterViewModel.cs | 2 +- .../Converters/ConvertersGalleryViewModel.cs | 2 +- .../ImageResourceConverterViewModel.cs | 2 +- .../IsListNotNullOrEmptyConverterViewModel.cs | 2 +- .../IsListNullOrEmptyConverterViewModel.cs | 2 +- .../ListToStringConverterViewModel.cs | 2 +- .../Essentials/AppThemeViewModel.cs | 2 +- .../Essentials/EssentialsGalleryViewModel.cs | 2 +- .../ColorAnimationExtensionsViewModel.cs | 2 +- .../Extensions/ExtensionsGalleryViewModel.cs | 2 +- .../ImageSourcesGalleryViewModel.cs | 2 +- .../ViewModels/Layouts/DockLayoutViewModel.cs | 2 +- .../Layouts/LayoutsGalleryViewModel.cs | 2 +- .../PlatformSpecificGalleryViewModel.cs | 2 +- .../AvatarViewBindablePropertiesViewModel.cs | 2 +- .../AvatarView/AvatarViewBordersViewModel.cs | 2 +- .../AvatarView/AvatarViewColorsViewModel.cs | 2 +- .../AvatarViewDayOfWeekViewModel.cs | 2 +- .../AvatarView/AvatarViewGesturesPage.cs | 2 +- .../AvatarView/AvatarViewImagesViewModel.cs | 2 +- .../AvatarView/AvatarViewKeyboardViewModel.cs | 2 +- .../AvatarView/AvatarViewRatingViewModel.cs | 2 +- .../AvatarView/AvatarViewShadowsViewModel.cs | 2 +- .../AvatarView/AvatarViewShapesViewModel.cs | 2 +- .../AvatarView/AvatarViewSizesViewModel.cs | 2 +- .../Views/LazyView/LazyViewViewModel.cs | 2 +- .../Views/Maps/MapsPinsViewModel.cs | 2 +- .../ViewModels/Views/Maps/MapsViewModel.cs | 2 +- .../MediaElementMultipleWindowsViewModel.cs | 2 +- .../CustomSizeAndPositionPopupViewModel.cs | 2 +- .../Popup/PopupLayoutAlignmentViewModel.cs | 2 +- .../Views/Popup/PopupSizingIssuesViewModel.cs | 2 +- .../ShowPopupInOnAppearingPageViewModel.cs | 2 +- .../SemanticOrderViewPageViewModel.cs | 2 +- .../ViewModels/Views/ViewsGalleryViewModel.cs | 2 +- .../Views/Popups/TransparentPopupCSharp.cs | 2 +- .../CommunityToolkit.Maui.Camera.csproj | 2 ++ .../Handlers/CameraViewHandler.shared.cs | 2 +- .../Views/CameraView.shared.cs | 2 +- .../CommunityToolkit.Maui.Core.csproj | 2 ++ .../MauiSemanticOrderView.windows.cs | 9 ++----- .../CommunityToolkit.Maui.Maps.csproj | 2 ++ .../MediaElement.shared.cs | 2 +- .../MediaSource/FileMediaSource.shared.cs | 2 +- .../MediaSource/ResourceMediaSource.shared.cs | 2 +- .../MediaSource/UriMediaSource.shared.cs | 2 +- .../Views/MauiMediaElement.windows.cs | 2 +- .../Animations/FadeAnimation.shared.cs | 2 +- .../Behaviors/AnimationBehavior.shared.cs | 2 +- ...SetFocusOnEntryCompletedBehavior.shared.cs | 2 +- .../EventToCommandBehavior.shared.cs | 2 +- .../EventToCommandBehaviorGeneric.shared.cs | 2 +- .../ImpliedOrderGridBehavior.shared.cs | 2 +- .../Behaviors/MaskedBehavior.shared.cs | 2 +- .../MaxLengthReachedBehavior.shared.cs | 2 +- .../MaxLengthReachedEventArgs.shared.cs | 15 +++++------ .../SelectAllTextBehavior.windows.cs | 9 ++----- .../StatusBar/StatusBarBehavior.shared.cs | 2 +- .../Touch/GestureManager.shared.cs | 2 +- .../ProgressBarAnimationBehavior.shared.cs | 2 +- .../UserStoppedTypingBehavior.shared.cs | 2 +- .../CharactersValidationBehavior.shared.cs | 2 +- .../MultiValidationBehavior.shared.cs | 2 +- .../NumericValidationBehavior.shared.cs | 2 +- ...RequiredStringValidationBehavior.shared.cs | 2 +- .../TextValidationBehavior.shared.cs | 2 +- .../UriValidationBehavior.shared.cs | 2 +- .../CommunityToolkit.Maui.csproj | 2 ++ .../BoolToObjectConverter.shared.cs | 6 +++-- .../ByteArrayToImageSourceConverter.shared.cs | 3 ++- .../ColorToColorConverters.shared.cs | 12 ++++++--- .../ColorToComponentConverter.shared.cs | 27 ++++++++++++------- .../ColorToStringConverter.shared.cs | 27 ++++++++++++------- .../Converters/CompareConverter.shared.cs | 3 ++- .../DateTimeOffsetConverter.shared.cs | 3 ++- .../Converters/DoubleToIntConverter.shared.cs | 4 +-- .../Converters/EnumToBoolConverter.shared.cs | 3 ++- .../Converters/EnumToIntConverter.shared.cs | 3 ++- .../ImageResourceConverter.shared.cs | 3 ++- .../IndexToArrayItemConverter.shared.cs | 3 ++- .../Converters/IntToBoolConverter.shared.cs | 3 ++- .../InvertedBoolConverter.shared.cs | 3 ++- .../Converters/IsEqualConverter.shared.cs | 3 ++- .../Converters/IsInRangeConverter.shared.cs | 3 ++- .../IsListNotNullOrEmptyConverter.shared.cs | 3 ++- .../IsListNullOrEmptyConverter.shared.cs | 3 ++- .../Converters/IsNotEqualConverter.shared.cs | 3 ++- .../Converters/IsNotNullConverter.shared.cs | 3 ++- .../Converters/IsNullConverter.shared.cs | 3 ++- .../IsStringNotNullOrEmptyConverter.shared.cs | 3 ++- .../IsStringNotNullOrWhiteSpaceConverter.cs | 3 ++- .../IsStringNullOrEmptyConverter.shared.cs | 3 ++- ...sStringNullOrWhiteSpaceConverter.shared.cs | 3 ++- .../ItemTappedEventArgsConverter.shared.cs | 3 ++- .../ListToStringConverter.shared.cs | 3 ++- .../MathExpressionConverter.shared.cs | 3 ++- .../MultiMathExpressionConverter.shared.cs | 1 + .../Converters/MultiConverter.shared.cs | 3 ++- .../MultiConverterParameter.shared.cs | 3 ++- .../SelectedItemEventArgsConverter.cs | 3 ++- .../StateToBooleanConverter.shared.cs | 3 ++- .../StringToListConverter.shared.cs | 3 ++- .../Converters/TextCaseConverter.shared.cs | 6 ++--- .../TimeSpanToSecondsConverter.shared.cs | 3 ++- .../VariableMultiValueConverter.shared.cs | 3 ++- .../AppThemeResourceExtension.shared.cs | 2 +- .../GravatarImageSource.shared.cs | 2 +- .../Layouts/DockLayout.shared.cs | 2 +- .../Layouts/UniformItemsLayout.shared.cs | 2 +- .../Views/AvatarView.shared.cs | 2 +- .../Views/DrawingView/DrawingView.shared.cs | 2 +- .../Views/LazyView/LazyView.shared.cs | 2 +- .../SemanticOrderView.shared.cs | 2 +- .../Views/WrapperControl.windows.cs | 2 +- 150 files changed, 257 insertions(+), 192 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index bb650835ce..2289b06545 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,6 +14,8 @@ false true true + true + true false @@ -41,6 +43,8 @@ CS1712: Type parameter has no matching typeparam tag in the XML comment CS1723: XML comment has cref attribute that refers to a type parameter CS1734: XML comment has a paramref tag, but there is no parameter by that name + CsWinRT1028: Class implements WinRT interfaces but isn't marked partial + CsWinRT1030: Class implements WinRT interfaces that require unsafe code NU1900 Error communicating with package source, while getting vulnerability information. NU1901 Package with low severity detected NU1902 Package with moderate severity detected @@ -48,14 +52,19 @@ NU1904 Package with critical severity detected NU1905 An audit source does not provide a vulnerability database xUnit1012: Null should not be used for type parameter - xUnit2021: Assert.ThrowsAsync is async. The resulting task should be awaited + xUnit2021: Assert.ThrowsAsync is async. The resulting task should be awaited + XC0045: Binding: Property not found + XC0103: Consider attributing the markup extension with [RequireService] or [AcceptEmptyServiceProvider] if it doesn't require any IL2***: Trim Warnings IL3***: AOT Warnings RS2007: Analyzer release file 'AnalyzerReleases.Shipped.md' has a missing or invalid release header--> - nullable, + + nullable, CS0419,CS1570,CS1571,CS1572,CS1573,CS1574,CS1580,CS1581,CS1584,CS1587,CS1589,CS1590,CS1591,CS1592,CS1598,CS1658,CS1710,CS1711,CS1712,CS1723,CS1734, + CsWinRT1028,CsWinRT1030, NU1900,NU1901,NU1902,NU1903,NU1904,NU1905, xUnit1012,xUnit2021, + XC0045,XC0103, IL2001,IL2002,IL2003,IL2004,IL2005,IL2006,IL2007,IL2008,IL2009, IL2010,IL2011,IL2012,IL2013,IL2014,IL2015,IL2016,IL2017,IL2018,IL2019, IL2020,IL2021,IL2022,IL2023,IL2024,IL2025,IL2026,IL2027,IL2028,IL2029, diff --git a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj index 98b4c43859..86c0a7ece6 100644 --- a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj +++ b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj @@ -34,6 +34,9 @@ 10.0.19041.53 true + + + CsWinRT1028 based on the comparison. /// -public sealed class CompareDoubleToColorConverter : CompareConverter +[AcceptEmptyServiceProvider] +public sealed partial class CompareDoubleToColorConverter : CompareConverter { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/AlertsGalleryPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/AlertsGalleryPage.cs index fdf18c116f..7e40a465eb 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/AlertsGalleryPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/AlertsGalleryPage.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Alerts; -public class AlertsGalleryPage(IDeviceInfo deviceInfo, AlertsGalleryViewModel alertsGalleryViewModel) : BaseGalleryPage("Alerts", deviceInfo, alertsGalleryViewModel) +public partial class AlertsGalleryPage(IDeviceInfo deviceInfo, AlertsGalleryViewModel alertsGalleryViewModel) : BaseGalleryPage("Alerts", deviceInfo, alertsGalleryViewModel) { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Base/BaseGalleryPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Base/BaseGalleryPage.cs index d2ac55a6f0..abc3b8cd4c 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Base/BaseGalleryPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Base/BaseGalleryPage.cs @@ -5,7 +5,7 @@ namespace CommunityToolkit.Maui.Sample.Pages; -public abstract class BaseGalleryPage : BasePage where TViewModel : BaseGalleryViewModel +public abstract partial class BaseGalleryPage : BasePage where TViewModel : BaseGalleryViewModel { protected BaseGalleryPage(string title, IDeviceInfo deviceInfo, TViewModel viewModel) : base(viewModel) { @@ -13,6 +13,7 @@ protected BaseGalleryPage(string title, IDeviceInfo deviceInfo, TViewModel viewM Padding = 0; + Content = new CollectionView { SelectionMode = SelectionMode.Single } .ItemTemplate(new GalleryDataTemplate(deviceInfo)) .Bind(ItemsView.ItemsSourceProperty, @@ -34,7 +35,7 @@ static async void HandleSelectionChanged(object? sender, SelectionChangedEventAr } } - sealed class GalleryDataTemplate(IDeviceInfo deviceInfo) : DataTemplate(() => CreateDataTemplate(deviceInfo)) + sealed partial class GalleryDataTemplate(IDeviceInfo deviceInfo) : DataTemplate(() => CreateDataTemplate(deviceInfo)) { enum Row { TopPadding, Content, BottomPadding } enum Column { LeftPadding, Content, RightPadding } @@ -57,7 +58,7 @@ enum Column { LeftPadding, Content, RightPadding } } }; - sealed class Card : Border + sealed partial class Card : Border { public Card() { diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/AnimationBehaviorPage.xaml.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/AnimationBehaviorPage.xaml.cs index 2152a8e920..5daca3439f 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/AnimationBehaviorPage.xaml.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/AnimationBehaviorPage.xaml.cs @@ -11,7 +11,7 @@ public AnimationBehaviorPage(AnimationBehaviorViewModel animationBehaviorViewMod } } -class SampleScaleAnimation : BaseAnimation +partial class SampleScaleAnimation : BaseAnimation { public override async Task Animate(VisualElement view, CancellationToken token) { @@ -20,7 +20,7 @@ public override async Task Animate(VisualElement view, CancellationToken token) } } -class SampleScaleToAnimation : BaseAnimation +partial class SampleScaleToAnimation : BaseAnimation { public double Scale { get; set; } diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/BehaviorsGalleryPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/BehaviorsGalleryPage.cs index 4fbcb787f1..e7478ad4e8 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/BehaviorsGalleryPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/BehaviorsGalleryPage.cs @@ -3,7 +3,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Behaviors; -public class BehaviorsGalleryPage : BaseGalleryPage +public partial class BehaviorsGalleryPage : BaseGalleryPage { public BehaviorsGalleryPage(IDeviceInfo deviceInfo, BehaviorsGalleryViewModel behaviorsGalleryViewModel) : base("Behaviors", deviceInfo, behaviorsGalleryViewModel) diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/TouchBehavior/TouchBehaviorCollectionViewMultipleSelectionPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/TouchBehavior/TouchBehaviorCollectionViewMultipleSelectionPage.cs index 4cd7a111b6..27da2db4ca 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/TouchBehavior/TouchBehaviorCollectionViewMultipleSelectionPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/TouchBehavior/TouchBehaviorCollectionViewMultipleSelectionPage.cs @@ -5,7 +5,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Behaviors; -public class TouchBehaviorCollectionViewMultipleSelectionPage : BasePage +public partial class TouchBehaviorCollectionViewMultipleSelectionPage : BasePage { readonly CollectionView collectionView; diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Converters/ConvertersGalleryPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Converters/ConvertersGalleryPage.cs index 367423f23c..8c991df4d1 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Converters/ConvertersGalleryPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Converters/ConvertersGalleryPage.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Converters; -public class ConvertersGalleryPage(IDeviceInfo deviceInfo, ConvertersGalleryViewModel convertersGalleryViewModel) : BaseGalleryPage("Converters", deviceInfo, convertersGalleryViewModel) +public partial class ConvertersGalleryPage(IDeviceInfo deviceInfo, ConvertersGalleryViewModel convertersGalleryViewModel) : BaseGalleryPage("Converters", deviceInfo, convertersGalleryViewModel) { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Converters/IsInRangeConverterPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Converters/IsInRangeConverterPage.cs index 0b156099e8..557027adda 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Converters/IsInRangeConverterPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Converters/IsInRangeConverterPage.cs @@ -6,7 +6,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Converters; -public class IsInRangeConverterPage : BasePage +public partial class IsInRangeConverterPage : BasePage { public IsInRangeConverterPage(IsInRangeConverterViewModel viewModel) : base(viewModel) { @@ -381,7 +381,7 @@ enum Column { Input, Result } static Line GetSeparator() => new Line { X2 = 300 }.Center() .AppThemeBinding(Line.StrokeProperty, Colors.Black, Colors.White); - class ExampleLabel : Label + sealed partial class ExampleLabel : Label { public ExampleLabel() { diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Essentials/EssentialsGalleryPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Essentials/EssentialsGalleryPage.cs index b21ad0d290..c29d28889a 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Essentials/EssentialsGalleryPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Essentials/EssentialsGalleryPage.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Essentials; -public class EssentialsGalleryPage(IDeviceInfo deviceInfo, EssentialsGalleryViewModel essentialsGalleryViewModel) : BaseGalleryPage("Essentials", deviceInfo, essentialsGalleryViewModel) +public partial class EssentialsGalleryPage(IDeviceInfo deviceInfo, EssentialsGalleryViewModel essentialsGalleryViewModel) : BaseGalleryPage("Essentials", deviceInfo, essentialsGalleryViewModel) { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Essentials/SpeechToTextPage.xaml.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Essentials/SpeechToTextPage.xaml.cs index c577fde686..7c72ae9015 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Essentials/SpeechToTextPage.xaml.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Essentials/SpeechToTextPage.xaml.cs @@ -19,7 +19,8 @@ protected override async void OnAppearing() } } -class PickerLocaleDisplayConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +partial class PickerLocaleDisplayConverter : BaseConverterOneWay { public override string DefaultConvertReturnValue { get; set; } = string.Empty; diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Extensions/ExtensionsGalleryPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Extensions/ExtensionsGalleryPage.cs index efa1399522..b62e9eb276 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Extensions/ExtensionsGalleryPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Extensions/ExtensionsGalleryPage.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Extensions; -public class ExtensionsGalleryPage(IDeviceInfo deviceInfo, ExtensionsGalleryViewModel extensionsGalleryViewModel) : BaseGalleryPage("Extensions", deviceInfo, extensionsGalleryViewModel) +public partial class ExtensionsGalleryPage(IDeviceInfo deviceInfo, ExtensionsGalleryViewModel extensionsGalleryViewModel) : BaseGalleryPage("Extensions", deviceInfo, extensionsGalleryViewModel) { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/ImageSources/ImageSourcesGalleryPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/ImageSources/ImageSourcesGalleryPage.cs index 0040379b2e..ef093815eb 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/ImageSources/ImageSourcesGalleryPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/ImageSources/ImageSourcesGalleryPage.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.ImageSources; -public class ImageSourcesGalleryPage(IDeviceInfo deviceInfo, ImageSourcesGalleryViewModel imageSourcesGalleryViewModel) : BaseGalleryPage("Image Sources", deviceInfo, imageSourcesGalleryViewModel) +public partial class ImageSourcesGalleryPage(IDeviceInfo deviceInfo, ImageSourcesGalleryViewModel imageSourcesGalleryViewModel) : BaseGalleryPage("Image Sources", deviceInfo, imageSourcesGalleryViewModel) { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Layouts/LayoutsGalleryPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Layouts/LayoutsGalleryPage.cs index c66887f7f6..fe3109f3e4 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Layouts/LayoutsGalleryPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Layouts/LayoutsGalleryPage.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Layouts; -public class LayoutsGalleryPage(IDeviceInfo deviceInfo, LayoutsGalleryViewModel layoutGalleryViewModel) : BaseGalleryPage("Layouts", deviceInfo, layoutGalleryViewModel) +public partial class LayoutsGalleryPage(IDeviceInfo deviceInfo, LayoutsGalleryViewModel layoutGalleryViewModel) : BaseGalleryPage("Layouts", deviceInfo, layoutGalleryViewModel) { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs index 71ee424832..6003f2fec6 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs @@ -5,7 +5,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Views; -public class ExpanderPageCS : ContentPage +public partial class ExpanderPageCS : ContentPage { public ExpanderPageCS() { diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/CustomLazyView.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/CustomLazyView.cs index 8d1ef1e28f..3f8a4bbc97 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/CustomLazyView.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/CustomLazyView.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Views.LazyView; -public class CustomLazyView : Maui.Views.LazyView where TView : View, new() +public partial class CustomLazyView : Maui.Views.LazyView where TView : View, new() { public override async ValueTask LoadViewAsync(CancellationToken token = default) { diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/MyViewLazyView.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/MyViewLazyView.cs index c71ea68ae7..891c77f993 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/MyViewLazyView.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/MyViewLazyView.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Views.LazyView; -class MyViewLazyView : LazyView +partial class MyViewLazyView : LazyView { public override async ValueTask LoadViewAsync(CancellationToken token = default) { diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementMultipleWindowsPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementMultipleWindowsPage.cs index ed20588e1a..98301cb8f3 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementMultipleWindowsPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementMultipleWindowsPage.cs @@ -7,7 +7,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Views; -public class MediaElementMultipleWindowsPage : BasePage +public partial class MediaElementMultipleWindowsPage : BasePage { const string buckBunnyMp4Url = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"; #if WINDOWS || MACCATALYST diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/ViewsGalleryPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Views/ViewsGalleryPage.cs index 08828a7940..7800c0997a 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/ViewsGalleryPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/ViewsGalleryPage.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.Pages.Views; -public class ViewsGalleryPage(IDeviceInfo deviceInfo, ViewsGalleryViewModel viewsGalleryViewModel) : BaseGalleryPage("Views", deviceInfo, viewsGalleryViewModel) +public partial class ViewsGalleryPage(IDeviceInfo deviceInfo, ViewsGalleryViewModel viewsGalleryViewModel) : BaseGalleryPage("Views", deviceInfo, viewsGalleryViewModel) { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/WelcomePage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/WelcomePage.cs index 2645d79857..717936dd41 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/WelcomePage.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/WelcomePage.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.Pages; -public class WelcomePage : ContentPage +public partial class WelcomePage : ContentPage { public WelcomePage() { diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Alerts/AlertsGalleryViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Alerts/AlertsGalleryViewModel.cs index aae2876844..fe10d9f1c7 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Alerts/AlertsGalleryViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Alerts/AlertsGalleryViewModel.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Alerts; -public class AlertsGalleryViewModel() : BaseGalleryViewModel( +public partial class AlertsGalleryViewModel() : BaseGalleryViewModel( [ SectionModel.Create("Snackbar", "Show Snackbar"), SectionModel.Create("Toast", "Show Toast") diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Alerts/SnackbarViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Alerts/SnackbarViewModel.cs index d5a5b331d5..9b992f6e74 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Alerts/SnackbarViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Alerts/SnackbarViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Alerts; -public class SnackbarViewModel : BaseViewModel +public partial class SnackbarViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Alerts/ToastViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Alerts/ToastViewModel.cs index e878e307a1..f1ebfa2e34 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Alerts/ToastViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Alerts/ToastViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Alerts; -public class ToastViewModel : BaseViewModel +public partial class ToastViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/BehaviorsGalleryViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/BehaviorsGalleryViewModel.cs index 8d7c83eee9..b20a1ebbb8 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/BehaviorsGalleryViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/BehaviorsGalleryViewModel.cs @@ -3,7 +3,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; -public class BehaviorsGalleryViewModel() : BaseGalleryViewModel( +public partial class BehaviorsGalleryViewModel() : BaseGalleryViewModel( [ SectionModel.Create(nameof(EventToCommandBehavior), "Turns any event into a command that can be bound to"), SectionModel.Create(nameof(MaskedBehavior), "Masked text in entry with specific pattern"), diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/CharactersValidationBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/CharactersValidationBehaviorViewModel.cs index b8638e40c7..14d7435460 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/CharactersValidationBehaviorViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/CharactersValidationBehaviorViewModel.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; -public class CharactersValidationBehaviorViewModel : BaseViewModel +public partial class CharactersValidationBehaviorViewModel : BaseViewModel { public IReadOnlyList CharacterTypes { get; } = [.. Enum.GetValues()]; } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/EmailValidationBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/EmailValidationBehaviorViewModel.cs index 4d38d843b6..e223e28eb8 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/EmailValidationBehaviorViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/EmailValidationBehaviorViewModel.cs @@ -1,6 +1,6 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; -public class EmailValidationBehaviorViewModel : BaseViewModel +public partial class EmailValidationBehaviorViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/MaskedBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/MaskedBehaviorViewModel.cs index 037462d888..645fedc98d 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/MaskedBehaviorViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/MaskedBehaviorViewModel.cs @@ -1,6 +1,6 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; -public class MaskedBehaviorViewModel : BaseViewModel +public partial class MaskedBehaviorViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/MultiValidationBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/MultiValidationBehaviorViewModel.cs index ce724f8d72..a7e5b09256 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/MultiValidationBehaviorViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/MultiValidationBehaviorViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; -public class MultiValidationBehaviorViewModel : BaseViewModel +public partial class MultiValidationBehaviorViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/NumericValidationBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/NumericValidationBehaviorViewModel.cs index ad66156a0a..4578396f92 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/NumericValidationBehaviorViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/NumericValidationBehaviorViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; -public class NumericValidationBehaviorViewModel : BaseViewModel +public partial class NumericValidationBehaviorViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/RequiredStringValidationBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/RequiredStringValidationBehaviorViewModel.cs index 3fdd79166d..29b1248644 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/RequiredStringValidationBehaviorViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/RequiredStringValidationBehaviorViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; -public class RequiredStringValidationBehaviorViewModel : BaseViewModel +public partial class RequiredStringValidationBehaviorViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/SelectAllTextBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/SelectAllTextBehaviorViewModel.cs index 415359e38d..04ed43efc6 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/SelectAllTextBehaviorViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/SelectAllTextBehaviorViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; -public sealed class SelectAllTextBehaviorViewModel : BaseViewModel +public sealed partial class SelectAllTextBehaviorViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/SetFocusOnEntryCompletedBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/SetFocusOnEntryCompletedBehaviorViewModel.cs index 4fb8294006..074d3b60bc 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/SetFocusOnEntryCompletedBehaviorViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/SetFocusOnEntryCompletedBehaviorViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; -public class SetFocusOnEntryCompletedBehaviorViewModel : BaseViewModel +public partial class SetFocusOnEntryCompletedBehaviorViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/TextValidationBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/TextValidationBehaviorViewModel.cs index f2cd3164f1..ed0a839955 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/TextValidationBehaviorViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/TextValidationBehaviorViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; -public class TextValidationBehaviorViewModel : BaseViewModel +public partial class TextValidationBehaviorViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/UriValidationBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/UriValidationBehaviorViewModel.cs index 63b663876f..6aafaa70fd 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/UriValidationBehaviorViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/UriValidationBehaviorViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; -public class UriValidationBehaviorViewModel : BaseViewModel +public partial class UriValidationBehaviorViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/BoolToObjectConverterViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/BoolToObjectConverterViewModel.cs index e57e181f72..254cb1f1db 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/BoolToObjectConverterViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/BoolToObjectConverterViewModel.cs @@ -1,6 +1,6 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Converters; -public class BoolToObjectConverterViewModel : BaseViewModel +public partial class BoolToObjectConverterViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ColorsConverterViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ColorsConverterViewModel.cs index 8c3e42aa99..5bf0a4a89d 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ColorsConverterViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ColorsConverterViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Converters; -public class ColorsConverterViewModel : BaseViewModel +public partial class ColorsConverterViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ConvertersGalleryViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ConvertersGalleryViewModel.cs index aca9a1700a..bbd355b545 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ConvertersGalleryViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ConvertersGalleryViewModel.cs @@ -3,7 +3,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Converters; -public class ConvertersGalleryViewModel() : BaseGalleryViewModel( +public partial class ConvertersGalleryViewModel() : BaseGalleryViewModel( [ SectionModel.Create(nameof(BoolToObjectConverter), "A converter that allows users to convert a bool value binding to a specific object."), SectionModel.Create(nameof(IsStringNullOrEmptyConverter), "A converter that allows users to convert an incoming binding to a bool value. This value represents if the incoming binding value is null or empty."), diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ImageResourceConverterViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ImageResourceConverterViewModel.cs index 28ac44b19b..50fe334908 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ImageResourceConverterViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ImageResourceConverterViewModel.cs @@ -1,6 +1,6 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Converters; -public class ImageResourceConverterViewModel : BaseViewModel +public partial class ImageResourceConverterViewModel : BaseViewModel { public string XamarinImageResource { get; } = BuildImageResource("XCT.png"); public string MauiImageResource { get; } = BuildImageResource("MCT.png"); diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/IsListNotNullOrEmptyConverterViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/IsListNotNullOrEmptyConverterViewModel.cs index 71b279fbf8..9928a18d53 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/IsListNotNullOrEmptyConverterViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/IsListNotNullOrEmptyConverterViewModel.cs @@ -4,7 +4,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Converters; -public class IsListNotNullOrEmptyConverterViewModel : BaseViewModel +public partial class IsListNotNullOrEmptyConverterViewModel : BaseViewModel { public IsListNotNullOrEmptyConverterViewModel() { diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/IsListNullOrEmptyConverterViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/IsListNullOrEmptyConverterViewModel.cs index e35f89da9b..276fcccdd9 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/IsListNullOrEmptyConverterViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/IsListNullOrEmptyConverterViewModel.cs @@ -1,6 +1,6 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Converters; -public class IsListNullOrEmptyConverterViewModel : IsListNotNullOrEmptyConverterViewModel +public partial class IsListNullOrEmptyConverterViewModel : IsListNotNullOrEmptyConverterViewModel { public IsListNullOrEmptyConverterViewModel() { diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ListToStringConverterViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ListToStringConverterViewModel.cs index 2a0fa8fe34..cc10acfbe2 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ListToStringConverterViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ListToStringConverterViewModel.cs @@ -1,7 +1,7 @@  namespace CommunityToolkit.Maui.Sample.ViewModels.Converters; -public class ListToStringConverterViewModel : BaseViewModel +public partial class ListToStringConverterViewModel : BaseViewModel { public IReadOnlyList ItemSource { get; } = [ diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/AppThemeViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/AppThemeViewModel.cs index 10da038634..2c8b1a50ab 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/AppThemeViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/AppThemeViewModel.cs @@ -1,6 +1,6 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Essentials; -public class AppThemeViewModel : BaseViewModel +public partial class AppThemeViewModel : BaseViewModel { public AppThemeViewModel() : base() { diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/EssentialsGalleryViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/EssentialsGalleryViewModel.cs index 9ed0760b30..7fb3de2b4b 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/EssentialsGalleryViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/EssentialsGalleryViewModel.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Essentials; -public class EssentialsGalleryViewModel() : BaseGalleryViewModel( +public partial class EssentialsGalleryViewModel() : BaseGalleryViewModel( [ SectionModel.Create("AppThemeResource", "AppThemeResource provides extension methods and markup extensions that make it easy to assign Light Theme, Dark Theme and Default Theme"), SectionModel.Create("Badge", "Allows the user to set app icon badge count on the home screen"), diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Extensions/ColorAnimationExtensionsViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Extensions/ColorAnimationExtensionsViewModel.cs index 90b6b54ae7..192fce7ac8 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Extensions/ColorAnimationExtensionsViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Extensions/ColorAnimationExtensionsViewModel.cs @@ -1,6 +1,6 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Converters; -public class ColorAnimationExtensionsViewModel : BaseViewModel +public partial class ColorAnimationExtensionsViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Extensions/ExtensionsGalleryViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Extensions/ExtensionsGalleryViewModel.cs index a449c6e37c..b7b6d35089 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Extensions/ExtensionsGalleryViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Extensions/ExtensionsGalleryViewModel.cs @@ -5,7 +5,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Converters; -public class ExtensionsGalleryViewModel() : BaseGalleryViewModel( +public partial class ExtensionsGalleryViewModel() : BaseGalleryViewModel( [ SectionModel.Create(nameof(ColorAnimationExtensions), "Extension methods that provide color animations"), SectionModel.Create(nameof(KeyboardExtensions), "Extension methods that provide keyboard interactions") diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/ImageSources/ImageSourcesGalleryViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/ImageSources/ImageSourcesGalleryViewModel.cs index c99205172e..7d58cae05a 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/ImageSources/ImageSourcesGalleryViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/ImageSources/ImageSourcesGalleryViewModel.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.ImageSources; -public class ImageSourcesGalleryViewModel() : BaseGalleryViewModel( +public partial class ImageSourcesGalleryViewModel() : BaseGalleryViewModel( [ SectionModel.Create("GravatarImageSource", Colors.Red, "GravatarImageSource allows you to use as an Image source, a users Gravatar registered image via their email address.") ]); \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Layouts/DockLayoutViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Layouts/DockLayoutViewModel.cs index f74c007b6f..07583ff835 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Layouts/DockLayoutViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Layouts/DockLayoutViewModel.cs @@ -1,6 +1,6 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Layouts; -public class DockLayoutViewModel : BaseViewModel +public partial class DockLayoutViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Layouts/LayoutsGalleryViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Layouts/LayoutsGalleryViewModel.cs index ccc3eedb62..61488bf8ad 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Layouts/LayoutsGalleryViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Layouts/LayoutsGalleryViewModel.cs @@ -3,7 +3,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Layouts; -public class LayoutsGalleryViewModel() : BaseGalleryViewModel( +public partial class LayoutsGalleryViewModel() : BaseGalleryViewModel( [ SectionModel.Create(nameof(StateContainerPage), "Properties enabling any Layout derived element to become state-aware"), SectionModel.Create(nameof(UniformItemsLayoutPage), "A Grid where all rows and columns have the same size"), diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/PlatformSpecific/PlatformSpecificGalleryViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/PlatformSpecific/PlatformSpecificGalleryViewModel.cs index 9854d80a8a..99eb652db7 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/PlatformSpecific/PlatformSpecificGalleryViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/PlatformSpecific/PlatformSpecificGalleryViewModel.cs @@ -2,7 +2,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.PlatformSpecific; -public sealed class PlatformSpecificGalleryViewModel() : BaseGalleryViewModel( +public sealed partial class PlatformSpecificGalleryViewModel() : BaseGalleryViewModel( [ SectionModel.Create("NavigationBar (Android)", "Change the Navigation Bar color on Android"), ]); \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewBindablePropertiesViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewBindablePropertiesViewModel.cs index dbb85b408f..3f5e91e71d 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewBindablePropertiesViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewBindablePropertiesViewModel.cs @@ -3,7 +3,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView; -public class AvatarViewBindablePropertiesViewModel : BaseViewModel +public partial class AvatarViewBindablePropertiesViewModel : BaseViewModel { public ObservableCollection AvatarList { get; } = [ diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewBordersViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewBordersViewModel.cs index d758cc9b36..4e7acd39eb 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewBordersViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewBordersViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView; -public class AvatarViewBordersViewModel : BaseViewModel +public partial class AvatarViewBordersViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewColorsViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewColorsViewModel.cs index 4f06dbc498..abbc7e4194 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewColorsViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewColorsViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView; -public class AvatarViewColorsViewModel : BaseViewModel +public partial class AvatarViewColorsViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewDayOfWeekViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewDayOfWeekViewModel.cs index 1c24bbd879..951a825ed0 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewDayOfWeekViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewDayOfWeekViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView; -public class AvatarViewDayOfWeekViewModel : BaseViewModel +public partial class AvatarViewDayOfWeekViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewGesturesPage.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewGesturesPage.cs index b4a6c21ea8..cfe2aa9769 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewGesturesPage.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewGesturesPage.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView; -public class AvatarViewGesturesViewModel : BaseViewModel +public partial class AvatarViewGesturesViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewImagesViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewImagesViewModel.cs index 3daec55c62..21adb1497c 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewImagesViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewImagesViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView; -public class AvatarViewImagesViewModel : BaseViewModel +public partial class AvatarViewImagesViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewKeyboardViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewKeyboardViewModel.cs index 3e88d3d5b0..354e278fba 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewKeyboardViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewKeyboardViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView; -public class AvatarViewKeyboardViewModel : BaseViewModel +public partial class AvatarViewKeyboardViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewRatingViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewRatingViewModel.cs index 5a857b3131..dfc9c8413a 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewRatingViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewRatingViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView; -public class AvatarViewRatingViewModel : BaseViewModel +public partial class AvatarViewRatingViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewShadowsViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewShadowsViewModel.cs index 3d5607052b..c54917fb69 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewShadowsViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewShadowsViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView; -public class AvatarViewShadowsViewModel : BaseViewModel +public partial class AvatarViewShadowsViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewShapesViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewShapesViewModel.cs index c9136f7b5a..84dbb8233f 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewShapesViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewShapesViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView; -public class AvatarViewShapesViewModel : BaseViewModel +public partial class AvatarViewShapesViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewSizesViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewSizesViewModel.cs index 8dca7a5759..4304314ddb 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewSizesViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/AvatarView/AvatarViewSizesViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView; -public class AvatarViewSizesViewModel : BaseViewModel +public partial class AvatarViewSizesViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/LazyView/LazyViewViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/LazyView/LazyViewViewModel.cs index e6d5ebc144..88cfaf7361 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/LazyView/LazyViewViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/LazyView/LazyViewViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views; -public class LazyViewViewModel : BaseViewModel +public partial class LazyViewViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Maps/MapsPinsViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Maps/MapsPinsViewModel.cs index 3e8559b521..673a6ae0ef 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Maps/MapsPinsViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Maps/MapsPinsViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views; -public class MapsPinsViewModel : BaseViewModel +public partial class MapsPinsViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Maps/MapsViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Maps/MapsViewModel.cs index 375615e6b1..8ae096325b 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Maps/MapsViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Maps/MapsViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views; -public class BasicMapsViewModel : BaseViewModel +public partial class BasicMapsViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/MediaElement/MediaElementMultipleWindowsViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/MediaElement/MediaElementMultipleWindowsViewModel.cs index 4ace0acdc0..6dc10010ab 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/MediaElement/MediaElementMultipleWindowsViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/MediaElement/MediaElementMultipleWindowsViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views; -public class MediaElementMultipleWindowsViewModel : BaseViewModel +public partial class MediaElementMultipleWindowsViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/CustomSizeAndPositionPopupViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/CustomSizeAndPositionPopupViewModel.cs index b2d7adde88..d93b08187c 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/CustomSizeAndPositionPopupViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/CustomSizeAndPositionPopupViewModel.cs @@ -91,7 +91,7 @@ bool CanShowButtonExecute() => (IsStartHorizontalOptionSelected || IsCenterHoriz && Width > 0 && IsFlowDirectionSelectionValid(FlowDirectionSelectedIndex, FlowDirectionOptions.Count); - class FlowDirectionPopup : RedBlueBoxPopup + partial class FlowDirectionPopup : RedBlueBoxPopup { readonly FlowDirection flowDirection; diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupLayoutAlignmentViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupLayoutAlignmentViewModel.cs index 86e1ad07ff..d3ec9f8be1 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupLayoutAlignmentViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupLayoutAlignmentViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views; -public class PopupLayoutAlignmentViewModel : BaseViewModel +public partial class PopupLayoutAlignmentViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupSizingIssuesViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupSizingIssuesViewModel.cs index 63f18a0578..ab852b0034 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupSizingIssuesViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupSizingIssuesViewModel.cs @@ -68,7 +68,7 @@ async Task OnShowPopup(Page page) }; } -public class ContainerModel(string name, ControlTemplate controlTemplate) : ObservableObject +public partial class ContainerModel(string name, ControlTemplate controlTemplate) : ObservableObject { public string Name { get; } = name; diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/ShowPopupInOnAppearingPageViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/ShowPopupInOnAppearingPageViewModel.cs index 4ab04db15d..a2eadf9bb5 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/ShowPopupInOnAppearingPageViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/ShowPopupInOnAppearingPageViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views; -public class ShowPopupInOnAppearingPageViewModel : BaseViewModel +public partial class ShowPopupInOnAppearingPageViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/SemanticOrderView/SemanticOrderViewPageViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/SemanticOrderView/SemanticOrderViewPageViewModel.cs index 4e715bcaf3..fd5ff2e3b8 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/SemanticOrderView/SemanticOrderViewPageViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/SemanticOrderView/SemanticOrderViewPageViewModel.cs @@ -1,5 +1,5 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views; -public class SemanticOrderViewPageViewModel : BaseViewModel +public partial class SemanticOrderViewPageViewModel : BaseViewModel { } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/ViewsGalleryViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/ViewsGalleryViewModel.cs index a372f0c786..3cff5ce945 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/ViewsGalleryViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/ViewsGalleryViewModel.cs @@ -3,7 +3,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views; -public sealed class ViewsGalleryViewModel() : BaseGalleryViewModel( +public sealed partial class ViewsGalleryViewModel() : BaseGalleryViewModel( [ SectionModel.Create("AvatarView Bindable Properties Page", Colors.Red, "A page demonstrating how to bind to various AvatarView properties."), SectionModel.Create("AvatarView Borders Page", Colors.Red, "A page demonstrating AvatarView borders."), diff --git a/samples/CommunityToolkit.Maui.Sample/Views/Popups/TransparentPopupCSharp.cs b/samples/CommunityToolkit.Maui.Sample/Views/Popups/TransparentPopupCSharp.cs index 7a53e92cc1..31003e057c 100644 --- a/samples/CommunityToolkit.Maui.Sample/Views/Popups/TransparentPopupCSharp.cs +++ b/samples/CommunityToolkit.Maui.Sample/Views/Popups/TransparentPopupCSharp.cs @@ -3,7 +3,7 @@ namespace CommunityToolkit.Maui.Sample.Views.Popups; -public sealed class TransparentPopupCSharp : Popup +public sealed partial class TransparentPopupCSharp : Popup { public TransparentPopupCSharp(Size popupSize) : this() { diff --git a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj index 77820ec321..2a975c23c7 100644 --- a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj +++ b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj @@ -8,6 +8,8 @@ true true + true + 15.0 15.0 21.0 diff --git a/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs b/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs index e940034c0e..2d28f10a2e 100644 --- a/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs +++ b/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs @@ -9,7 +9,7 @@ namespace CommunityToolkit.Maui.Core.Handlers; #if TIZEN public class CameraViewHandler : ViewHandler #else -public class CameraViewHandler : ViewHandler, IDisposable +public partial class CameraViewHandler : ViewHandler, IDisposable #endif { /// diff --git a/src/CommunityToolkit.Maui.Camera/Views/CameraView.shared.cs b/src/CommunityToolkit.Maui.Camera/Views/CameraView.shared.cs index 3773f8f949..5e0619416d 100644 --- a/src/CommunityToolkit.Maui.Camera/Views/CameraView.shared.cs +++ b/src/CommunityToolkit.Maui.Camera/Views/CameraView.shared.cs @@ -14,7 +14,7 @@ namespace CommunityToolkit.Maui.Views; [SupportedOSPlatform("android21.0")] [SupportedOSPlatform("ios")] [SupportedOSPlatform("maccatalyst")] -public class CameraView : View, ICameraView +public partial class CameraView : View, ICameraView { static readonly BindablePropertyKey isAvailablePropertyKey = BindableProperty.CreateReadOnly(nameof(IsAvailable), typeof(bool), typeof(CameraView), CameraViewDefaults.IsAvailable); diff --git a/src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj b/src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj index 716125b0a2..e1b5897517 100644 --- a/src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj +++ b/src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj @@ -8,6 +8,8 @@ true true + true + 15.0 15.0 21.0 diff --git a/src/CommunityToolkit.Maui.Core/Views/SemanticOrderView/MauiSemanticOrderView.windows.cs b/src/CommunityToolkit.Maui.Core/Views/SemanticOrderView/MauiSemanticOrderView.windows.cs index 7641ace901..9902d93bc6 100644 --- a/src/CommunityToolkit.Maui.Core/Views/SemanticOrderView/MauiSemanticOrderView.windows.cs +++ b/src/CommunityToolkit.Maui.Core/Views/SemanticOrderView/MauiSemanticOrderView.windows.cs @@ -1,16 +1,11 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Text; -using Microsoft.Maui.Platform; -using Windows.UI.Xaml; +using Microsoft.Maui.Platform; namespace CommunityToolkit.Maui.Core.Views; /// /// The native implementation of the control. /// -public class MauiSemanticOrderView : ContentPanel +public partial class MauiSemanticOrderView : ContentPanel { ISemanticOrderView? virtualView; diff --git a/src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj b/src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj index 602a2844e2..dc757ba95f 100644 --- a/src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj +++ b/src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj @@ -8,6 +8,8 @@ true true + true + 15.0 15.0 21.0 diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs index 272b4cb4ef..6fcb682b50 100644 --- a/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs +++ b/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs @@ -8,7 +8,7 @@ namespace CommunityToolkit.Maui.Views; /// /// Represents an object that is used to render audio and video to the display. /// -public class MediaElement : View, IMediaElement, IDisposable +public partial class MediaElement : View, IMediaElement, IDisposable { /// /// Backing store for the property. diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaSource/FileMediaSource.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaSource/FileMediaSource.shared.cs index 68f7f60018..8a83771a42 100644 --- a/src/CommunityToolkit.Maui.MediaElement/MediaSource/FileMediaSource.shared.cs +++ b/src/CommunityToolkit.Maui.MediaElement/MediaSource/FileMediaSource.shared.cs @@ -7,7 +7,7 @@ namespace CommunityToolkit.Maui.Views; /// Represents a source, loaded from local filesystem, that can be played by . /// [TypeConverter(typeof(FileMediaSourceConverter))] -public sealed class FileMediaSource : MediaSource +public sealed partial class FileMediaSource : MediaSource { /// /// Backing store for the property. diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaSource/ResourceMediaSource.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaSource/ResourceMediaSource.shared.cs index 48ac994e7d..8314c160b2 100644 --- a/src/CommunityToolkit.Maui.MediaElement/MediaSource/ResourceMediaSource.shared.cs +++ b/src/CommunityToolkit.Maui.MediaElement/MediaSource/ResourceMediaSource.shared.cs @@ -7,7 +7,7 @@ namespace CommunityToolkit.Maui.Views; /// Represents a source, loaded from the application's resources, that can be played by . /// [TypeConverter(typeof(FileMediaSourceConverter))] -public sealed class ResourceMediaSource : MediaSource +public sealed partial class ResourceMediaSource : MediaSource { /// /// Backing store for the property. diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaSource/UriMediaSource.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaSource/UriMediaSource.shared.cs index 73667417e5..c05c97df93 100644 --- a/src/CommunityToolkit.Maui.MediaElement/MediaSource/UriMediaSource.shared.cs +++ b/src/CommunityToolkit.Maui.MediaElement/MediaSource/UriMediaSource.shared.cs @@ -6,7 +6,7 @@ namespace CommunityToolkit.Maui.Views; /// /// Represents a source, loaded from a remote URI, that can be played by . /// -public sealed class UriMediaSource : MediaSource +public sealed partial class UriMediaSource : MediaSource { /// /// Backing store for the property. diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs index edac52be68..737688fa58 100644 --- a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs +++ b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs @@ -21,7 +21,7 @@ namespace CommunityToolkit.Maui.Core.Views; /// /// The user-interface element that represents the on Windows. /// -public class MauiMediaElement : Grid, IDisposable +public partial class MauiMediaElement : Grid, IDisposable { static readonly AppWindow appWindow = GetAppWindowForCurrentWindow(); readonly Popup popup = new(); diff --git a/src/CommunityToolkit.Maui/Animations/FadeAnimation.shared.cs b/src/CommunityToolkit.Maui/Animations/FadeAnimation.shared.cs index f600e3a71d..ce9f43a1f5 100644 --- a/src/CommunityToolkit.Maui/Animations/FadeAnimation.shared.cs +++ b/src/CommunityToolkit.Maui/Animations/FadeAnimation.shared.cs @@ -4,7 +4,7 @@ /// Animation that will fade the supplied view to the specified /// and then back to it's original . /// -public class FadeAnimation : BaseAnimation +public partial class FadeAnimation : BaseAnimation { /// /// Backing BindableProperty for the property. diff --git a/src/CommunityToolkit.Maui/Behaviors/AnimationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/AnimationBehavior.shared.cs index 87247e8ea2..ff2bb8f3f3 100644 --- a/src/CommunityToolkit.Maui/Behaviors/AnimationBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/AnimationBehavior.shared.cs @@ -6,7 +6,7 @@ namespace CommunityToolkit.Maui.Behaviors; /// /// The is a behavior that shows an animation on any when the is called. /// -public class AnimationBehavior : EventToCommandBehavior +public partial class AnimationBehavior : EventToCommandBehavior { /// /// Backing BindableProperty for the property. diff --git a/src/CommunityToolkit.Maui/Behaviors/AttachedBehaviors/SetFocusOnEntryCompletedBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/AttachedBehaviors/SetFocusOnEntryCompletedBehavior.shared.cs index f092461301..32e1f6c15f 100644 --- a/src/CommunityToolkit.Maui/Behaviors/AttachedBehaviors/SetFocusOnEntryCompletedBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/AttachedBehaviors/SetFocusOnEntryCompletedBehavior.shared.cs @@ -3,7 +3,7 @@ /// /// The is an attached property for entries that allows the user to specify what should gain focus after the user completes that entry. /// -public class SetFocusOnEntryCompletedBehavior : BaseBehavior +public partial class SetFocusOnEntryCompletedBehavior : BaseBehavior { /// /// The attached property. diff --git a/src/CommunityToolkit.Maui/Behaviors/EventToCommandBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/EventToCommandBehavior.shared.cs index 801c92fb64..928b9c14fe 100644 --- a/src/CommunityToolkit.Maui/Behaviors/EventToCommandBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/EventToCommandBehavior.shared.cs @@ -8,7 +8,7 @@ namespace CommunityToolkit.Maui.Behaviors; /// /// The is a behavior that allows the user to invoke a through an event. It is designed to associate Commands to events exposed by controls that were not designed to support Commands. It allows you to map any arbitrary event on a control to a Command. /// -public class EventToCommandBehavior : BaseBehavior +public partial class EventToCommandBehavior : BaseBehavior { /// /// Backing BindableProperty for the property. diff --git a/src/CommunityToolkit.Maui/Behaviors/EventToCommandBehaviorGeneric.shared.cs b/src/CommunityToolkit.Maui/Behaviors/EventToCommandBehaviorGeneric.shared.cs index 1b50f9eccc..2c59496ac2 100644 --- a/src/CommunityToolkit.Maui/Behaviors/EventToCommandBehaviorGeneric.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/EventToCommandBehaviorGeneric.shared.cs @@ -6,7 +6,7 @@ namespace CommunityToolkit.Maui.Behaviors; /// This cast the sender object to a specific type defined by the user. /// /// The type that you want to receive in your -public sealed class EventToCommandBehavior : EventToCommandBehavior +public sealed partial class EventToCommandBehavior : EventToCommandBehavior { /// protected override void OnTriggerHandled(object? sender = null, object? eventArgs = null) diff --git a/src/CommunityToolkit.Maui/Behaviors/ImpliedOrderGridBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/ImpliedOrderGridBehavior.shared.cs index 4ee8fd8cc8..ba71e5ff06 100644 --- a/src/CommunityToolkit.Maui/Behaviors/ImpliedOrderGridBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/ImpliedOrderGridBehavior.shared.cs @@ -5,7 +5,7 @@ namespace CommunityToolkit.Maui.Behaviors; /// /// The enables you to automatically assign a row and column to a view based on the order the view is added to the . You only need to setup the row and column definitions and then add children to the . You may still assign RowSpan and ColumnSpan to views and their values will be taken into account when assigning a row and column to a view. If a view has a user defined row or column value it will be honored. /// -public class ImpliedOrderGridBehavior : BaseBehavior +public partial class ImpliedOrderGridBehavior : BaseBehavior { bool[][]? usedMatrix; int rowCount; diff --git a/src/CommunityToolkit.Maui/Behaviors/MaskedBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/MaskedBehavior.shared.cs index 0818dbe522..7e2d8175b1 100644 --- a/src/CommunityToolkit.Maui/Behaviors/MaskedBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/MaskedBehavior.shared.cs @@ -7,7 +7,7 @@ namespace CommunityToolkit.Maui.Behaviors; /// /// The MaskedBehavior is a behavior that allows the user to define an input mask for data entry. Adding this behavior to an (i.e. ) control will force the user to only input values matching a given mask. Examples of its usage include input of a credit card number or a phone number. /// -public class MaskedBehavior : BaseBehavior, IDisposable +public partial class MaskedBehavior : BaseBehavior, IDisposable { /// /// BindableProperty for the property. diff --git a/src/CommunityToolkit.Maui/Behaviors/MaxLengthReachedBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/MaxLengthReachedBehavior.shared.cs index b1b4b74467..2445d152bf 100644 --- a/src/CommunityToolkit.Maui/Behaviors/MaxLengthReachedBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/MaxLengthReachedBehavior.shared.cs @@ -6,7 +6,7 @@ namespace CommunityToolkit.Maui.Behaviors; /// /// The is a behavior that allows the user to trigger an action when a user has reached the maximum length allowed on an . It can either trigger a or an event depending on the user's preferred scenario. /// -public class MaxLengthReachedBehavior : BaseBehavior +public partial class MaxLengthReachedBehavior : BaseBehavior { readonly WeakEventManager maxLengthReachedEventManager = new(); diff --git a/src/CommunityToolkit.Maui/Behaviors/MaxLengthReachedEventArgs.shared.cs b/src/CommunityToolkit.Maui/Behaviors/MaxLengthReachedEventArgs.shared.cs index f732d7b359..63edc98348 100644 --- a/src/CommunityToolkit.Maui/Behaviors/MaxLengthReachedEventArgs.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/MaxLengthReachedEventArgs.shared.cs @@ -3,17 +3,14 @@ /// /// Container object for the event arguments that are provided when the event is triggered. /// -public class MaxLengthReachedEventArgs : EventArgs +/// +/// Constructor to create a new instance of . +/// +/// The new text value as determined by the +public partial class MaxLengthReachedEventArgs(string text) : EventArgs { /// /// The new text value as determined by the /// - public string Text { get; } - - /// - /// Constructor to create a new instance of . - /// - /// The new text value as determined by the - public MaxLengthReachedEventArgs(string text) - => Text = text; + public string Text { get; } = text; } \ No newline at end of file diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/SelectAllText/SelectAllTextBehavior.windows.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/SelectAllText/SelectAllTextBehavior.windows.cs index cc1f46b0f9..83a1802587 100644 --- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/SelectAllText/SelectAllTextBehavior.windows.cs +++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/SelectAllText/SelectAllTextBehavior.windows.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; namespace CommunityToolkit.Maui.Behaviors; @@ -11,7 +6,7 @@ namespace CommunityToolkit.Maui.Behaviors; /// /// A behavior that selects all text when the view is focused. /// -public class SelectAllTextBehavior : PlatformBehavior +public partial class SelectAllTextBehavior : PlatformBehavior { /// protected override void OnAttachedTo(InputView bindable, TextBox platformView) diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/StatusBar/StatusBarBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/StatusBar/StatusBarBehavior.shared.cs index ab281c9be3..5df0bd539c 100644 --- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/StatusBar/StatusBarBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/StatusBar/StatusBarBehavior.shared.cs @@ -26,7 +26,7 @@ public enum StatusBarApplyOn /// that controls the Status bar color /// [UnsupportedOSPlatform("Windows"), UnsupportedOSPlatform("MacCatalyst"), UnsupportedOSPlatform("MacOS"), UnsupportedOSPlatform("Tizen")] -public class StatusBarBehavior : BasePlatformBehavior +public partial class StatusBarBehavior : BasePlatformBehavior { /// /// that manages the StatusBarColor property. diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/GestureManager.shared.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/GestureManager.shared.cs index aa939d379c..a9aca720da 100644 --- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/GestureManager.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/GestureManager.shared.cs @@ -6,7 +6,7 @@ namespace CommunityToolkit.Maui.Behaviors; -sealed class GestureManager : IDisposable, IAsyncDisposable +sealed partial class GestureManager : IDisposable, IAsyncDisposable { Color? defaultBackgroundColor; diff --git a/src/CommunityToolkit.Maui/Behaviors/ProgressBarAnimationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/ProgressBarAnimationBehavior.shared.cs index 17d5fe3b92..fcdfbc6ccc 100644 --- a/src/CommunityToolkit.Maui/Behaviors/ProgressBarAnimationBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/ProgressBarAnimationBehavior.shared.cs @@ -5,7 +5,7 @@ namespace CommunityToolkit.Maui.Behaviors; /// /// The is a behavior that behavior that animates a /// /// -public class ProgressBarAnimationBehavior : BaseBehavior +public partial class ProgressBarAnimationBehavior : BaseBehavior { readonly WeakEventManager animationCompletedEventManager = new(); diff --git a/src/CommunityToolkit.Maui/Behaviors/UserStoppedTypingBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/UserStoppedTypingBehavior.shared.cs index 0ad75e72d2..39cfc4c63f 100644 --- a/src/CommunityToolkit.Maui/Behaviors/UserStoppedTypingBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/UserStoppedTypingBehavior.shared.cs @@ -6,7 +6,7 @@ namespace CommunityToolkit.Maui.Behaviors; /// /// The is a behavior that allows the user to trigger an action when a user has stopped data input any derivate like or . Examples of its usage include triggering a search when a user has stopped entering their search query. /// -public class UserStoppedTypingBehavior : BaseBehavior, IDisposable +public partial class UserStoppedTypingBehavior : BaseBehavior, IDisposable { /// /// Backing BindableProperty for the property. diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/CharactersValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/CharactersValidationBehavior.shared.cs index b18302e59e..2006caaee5 100644 --- a/src/CommunityToolkit.Maui/Behaviors/Validators/CharactersValidationBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/Validators/CharactersValidationBehavior.shared.cs @@ -41,7 +41,7 @@ public enum CharacterType /// /// The is a behavior that allows the user to validate text input depending on specified parameters.For example, an control can be styled differently depending on whether a valid or an invalid text value is provided. This behavior includes built-in checks such as checking for a certain number of digits or alphanumeric characters. Additional properties handling validation are inherited from . /// -public class CharactersValidationBehavior : TextValidationBehavior +public partial class CharactersValidationBehavior : TextValidationBehavior { List> characterPredicates = Enumerable.Empty>().ToList(); diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs index 7c215f5636..832c5fd3ad 100644 --- a/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs @@ -8,7 +8,7 @@ namespace CommunityToolkit.Maui.Behaviors; /// The is a behavior that allows the user to combine multiple validators to validate text input depending on specified parameters. For example, an control can be styled differently depending on whether a valid or an invalid text input is provided. By allowing the user to chain multiple existing validators together, it offers a high degree of customizability when it comes to validation. Additional properties handling validation are inherited from . /// [ContentProperty(nameof(Children))] -public class MultiValidationBehavior : ValidationBehavior +public partial class MultiValidationBehavior : ValidationBehavior { /// /// Backing BindableProperty for the property. diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs index a5ec82e75c..f5b525e24c 100644 --- a/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs @@ -5,7 +5,7 @@ namespace CommunityToolkit.Maui.Behaviors; /// /// The is a behavior that allows the user to determine if text input is a valid numeric value. For example, an control can be styled differently depending on whether a valid or an invalid numeric input is provided. Additional properties handling validation are inherited from . /// -public class NumericValidationBehavior : ValidationBehavior +public partial class NumericValidationBehavior : ValidationBehavior { /// /// Backing BindableProperty for the property. diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/RequiredStringValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/RequiredStringValidationBehavior.shared.cs index 49699fb777..a218feb348 100644 --- a/src/CommunityToolkit.Maui/Behaviors/Validators/RequiredStringValidationBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/Validators/RequiredStringValidationBehavior.shared.cs @@ -3,7 +3,7 @@ /// /// The is a behavior that allows the user to determine if text input is equal to specific text. For example, an control can be styled differently depending on whether a valid or an invalid text input is provided. Additional properties handling validation are inherited from . /// -public class RequiredStringValidationBehavior : ValidationBehavior +public partial class RequiredStringValidationBehavior : ValidationBehavior { /// /// Backing BindableProperty for the property. diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs index 4deaf51671..cc26db84d3 100644 --- a/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs @@ -25,7 +25,7 @@ public enum TextDecorationFlags /// /// The is a behavior that allows the user to validate a given text depending on specified parameters. By adding this behavior to an inherited control (i.e. ) it can be styled differently depending on whether a valid or an invalid text value is provided. It offers various built-in checks such as checking for a certain length or whether or not the input value matches a specific regular expression. Additional properties handling validation are inherited from . /// -public class TextValidationBehavior : ValidationBehavior +public partial class TextValidationBehavior : ValidationBehavior { /// /// Backing BindableProperty for the property. diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/UriValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/UriValidationBehavior.shared.cs index 4769b1dfe5..efbf86303c 100644 --- a/src/CommunityToolkit.Maui/Behaviors/Validators/UriValidationBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/Validators/UriValidationBehavior.shared.cs @@ -3,7 +3,7 @@ /// /// The is a behavior that allows users to determine whether or not text input is a valid URI. For example, an control can be styled differently depending on whether a valid or an invalid URI is provided. Additional properties handling validation are inherited from . /// -public class UriValidationBehavior : TextValidationBehavior +public partial class UriValidationBehavior : TextValidationBehavior { /// /// Backing BindableProperty for the property. diff --git a/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj b/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj index d5c17eed11..8c95cd5d58 100644 --- a/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj +++ b/src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj @@ -11,6 +11,8 @@ true $(BaseIntermediateOutputPath)\GeneratedFiles + true + 15.0 15.0 21.0 diff --git a/src/CommunityToolkit.Maui/Converters/BoolToObjectConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/BoolToObjectConverter.shared.cs index 9f5f48fce4..3d170fbd8b 100644 --- a/src/CommunityToolkit.Maui/Converters/BoolToObjectConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/BoolToObjectConverter.shared.cs @@ -6,14 +6,16 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts boolean to object and vice versa. /// -public class BoolToObjectConverter : BoolToObjectConverter +[AcceptEmptyServiceProvider] +public partial class BoolToObjectConverter : BoolToObjectConverter { } /// /// Converts to object and vice versa. /// -public class BoolToObjectConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TObject> : BaseConverter +[AcceptEmptyServiceProvider] +public partial class BoolToObjectConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TObject> : BaseConverter { /// public override TObject? DefaultConvertReturnValue { get; set; } = default; diff --git a/src/CommunityToolkit.Maui/Converters/ByteArrayToImageSourceConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/ByteArrayToImageSourceConverter.shared.cs index 59add6ed7b..8f1295d738 100644 --- a/src/CommunityToolkit.Maui/Converters/ByteArrayToImageSourceConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/ByteArrayToImageSourceConverter.shared.cs @@ -6,7 +6,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts the incoming value from [] and returns the object of a type or vice versa. /// -public class ByteArrayToImageSourceConverter : BaseConverter +[AcceptEmptyServiceProvider] +public partial class ByteArrayToImageSourceConverter : BaseConverter { /// public override ImageSource? DefaultConvertReturnValue { get; set; } = null; diff --git a/src/CommunityToolkit.Maui/Converters/ColorToColorConverters.shared.cs b/src/CommunityToolkit.Maui/Converters/ColorToColorConverters.shared.cs index a04c5afbeb..a2d4c254a5 100644 --- a/src/CommunityToolkit.Maui/Converters/ColorToColorConverters.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/ColorToColorConverters.shared.cs @@ -6,7 +6,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToBlackOrWhiteConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToBlackOrWhiteConverter : BaseConverterOneWay { /// public override Color DefaultConvertReturnValue { get; set; } = Colors.Transparent; @@ -22,7 +23,8 @@ public override Color ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToColorForTextConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToColorForTextConverter : BaseConverterOneWay { /// public override Color DefaultConvertReturnValue { get; set; } = Colors.Transparent; @@ -38,7 +40,8 @@ public override Color ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToGrayScaleColorConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToGrayScaleColorConverter : BaseConverterOneWay { /// public override Color DefaultConvertReturnValue { get; set; } = Colors.Transparent; @@ -54,7 +57,8 @@ public override Color ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToInverseColorConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToInverseColorConverter : BaseConverterOneWay { /// public override Color DefaultConvertReturnValue { get; set; } = Colors.Transparent; diff --git a/src/CommunityToolkit.Maui/Converters/ColorToComponentConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/ColorToComponentConverter.shared.cs index 386dea4280..b69f66ed1c 100644 --- a/src/CommunityToolkit.Maui/Converters/ColorToComponentConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/ColorToComponentConverter.shared.cs @@ -6,7 +6,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToByteAlphaConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToByteAlphaConverter : BaseConverterOneWay { /// public override byte DefaultConvertReturnValue { get; set; } = default; @@ -23,7 +24,8 @@ public override byte ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToByteRedConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToByteRedConverter : BaseConverterOneWay { /// public override byte DefaultConvertReturnValue { get; set; } = default; @@ -40,7 +42,8 @@ public override byte ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToByteGreenConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToByteGreenConverter : BaseConverterOneWay { /// public override byte DefaultConvertReturnValue { get; set; } = default; @@ -57,7 +60,8 @@ public override byte ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToByteBlueConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToByteBlueConverter : BaseConverterOneWay { /// public override byte DefaultConvertReturnValue { get; set; } = default; @@ -74,7 +78,8 @@ public override byte ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToPercentCyanConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToPercentCyanConverter : BaseConverterOneWay { /// public override double DefaultConvertReturnValue { get; set; } = 0.0d; @@ -91,7 +96,8 @@ public override double ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToPercentMagentaConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToPercentMagentaConverter : BaseConverterOneWay { /// public override double DefaultConvertReturnValue { get; set; } = 0.0d; @@ -108,7 +114,8 @@ public override double ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToPercentYellowConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToPercentYellowConverter : BaseConverterOneWay { /// public override double DefaultConvertReturnValue { get; set; } = 0.0d; @@ -125,7 +132,8 @@ public override double ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToPercentBlackKeyConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToPercentBlackKeyConverter : BaseConverterOneWay { /// public override double DefaultConvertReturnValue { get; set; } = 0.0d; @@ -143,7 +151,8 @@ public override double ConvertFrom(Color value, CultureInfo? culture = null) /// Converts the incoming value from and returns the object of a type . /// // Hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, 240 is blue. -public class ColorToDegreeHueConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToDegreeHueConverter : BaseConverterOneWay { /// public override double DefaultConvertReturnValue { get; set; } = 0.0d; diff --git a/src/CommunityToolkit.Maui/Converters/ColorToStringConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/ColorToStringConverter.shared.cs index 9dbd88c2b1..f7a50cf1af 100644 --- a/src/CommunityToolkit.Maui/Converters/ColorToStringConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/ColorToStringConverter.shared.cs @@ -7,7 +7,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToRgbStringConverter : BaseConverter +[AcceptEmptyServiceProvider] +public partial class ColorToRgbStringConverter : BaseConverter { /// public override string DefaultConvertReturnValue { get; set; } = string.Empty; @@ -37,7 +38,8 @@ public override string ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToRgbaStringConverter : BaseConverter +[AcceptEmptyServiceProvider] +public partial class ColorToRgbaStringConverter : BaseConverter { /// public override string DefaultConvertReturnValue { get; set; } = string.Empty; @@ -67,7 +69,8 @@ public override string ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type and vice-versa. /// -public class ColorToHexRgbStringConverter : BaseConverter +[AcceptEmptyServiceProvider] +public partial class ColorToHexRgbStringConverter : BaseConverter { /// public override string DefaultConvertReturnValue { get; set; } = string.Empty; @@ -93,7 +96,8 @@ public override Color ConvertBackTo(string value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type and vice-versa. /// -public class ColorToHexRgbaStringConverter : BaseConverter +[AcceptEmptyServiceProvider] +public partial class ColorToHexRgbaStringConverter : BaseConverter { /// public override string DefaultConvertReturnValue { get; set; } = string.Empty; @@ -119,7 +123,8 @@ public override Color ConvertBackTo(string value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type and vice-versa. /// -public class ColorToHexArgbStringConverter : BaseConverter +[AcceptEmptyServiceProvider] +public partial class ColorToHexArgbStringConverter : BaseConverter { /// public override string DefaultConvertReturnValue { get; set; } = string.Empty; @@ -145,7 +150,8 @@ public override Color ConvertBackTo(string value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToCmykStringConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToCmykStringConverter : BaseConverterOneWay { /// public override string DefaultConvertReturnValue { get; set; } = string.Empty; @@ -161,7 +167,8 @@ public override string ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToCmykaStringConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToCmykaStringConverter : BaseConverterOneWay { /// public override string DefaultConvertReturnValue { get; set; } = string.Empty; @@ -177,7 +184,8 @@ public override string ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToHslStringConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToHslStringConverter : BaseConverterOneWay { /// public override string DefaultConvertReturnValue { get; set; } = string.Empty; @@ -193,7 +201,8 @@ public override string ConvertFrom(Color value, CultureInfo? culture = null) /// /// Converts the incoming value from and returns the object of a type . /// -public class ColorToHslaStringConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ColorToHslaStringConverter : BaseConverterOneWay { /// public override string DefaultConvertReturnValue { get; set; } = string.Empty; diff --git a/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs index 18f7cdcf01..28694b5e31 100644 --- a/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs @@ -7,7 +7,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts an object that implements IComparable to an object or a boolean based on a comparison. /// -public sealed class CompareConverter : CompareConverter +[AcceptEmptyServiceProvider] +public sealed partial class CompareConverter : CompareConverter { } diff --git a/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs index 79401843e9..80f4cdb341 100644 --- a/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts to and back. /// -public class DateTimeOffsetConverter : BaseConverter +[AcceptEmptyServiceProvider] +public partial class DateTimeOffsetConverter : BaseConverter { /// public override DateTime DefaultConvertReturnValue { get; set; } = DateTime.MinValue; //`DateTime.MinValue` is the same as `new DateTime()`, but it is more-efficient diff --git a/src/CommunityToolkit.Maui/Converters/DoubleToIntConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/DoubleToIntConverter.shared.cs index e70386dbcb..ecfd5957d2 100644 --- a/src/CommunityToolkit.Maui/Converters/DoubleToIntConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/DoubleToIntConverter.shared.cs @@ -5,8 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts to and vice versa. /// -[ContentProperty(nameof(Ratio))] -public class DoubleToIntConverter : BaseConverter +[ContentProperty(nameof(Ratio)), AcceptEmptyServiceProvider] +public partial class DoubleToIntConverter : BaseConverter { /// public override int DefaultConvertReturnValue { get; set; } = 0; diff --git a/src/CommunityToolkit.Maui/Converters/EnumToBoolConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/EnumToBoolConverter.shared.cs index 79a2d2d97f..a5b9919aef 100644 --- a/src/CommunityToolkit.Maui/Converters/EnumToBoolConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/EnumToBoolConverter.shared.cs @@ -6,7 +6,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Convert an to corresponding /// -public class EnumToBoolConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class EnumToBoolConverter : BaseConverterOneWay { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs index b7336dfb11..aa63657815 100644 --- a/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs @@ -6,7 +6,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts an to its underlying value. /// -public class EnumToIntConverter : BaseConverter +[AcceptEmptyServiceProvider] +public partial class EnumToIntConverter : BaseConverter { /// public override int DefaultConvertReturnValue { get; set; } = 0; diff --git a/src/CommunityToolkit.Maui/Converters/ImageResourceConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/ImageResourceConverter.shared.cs index cace6274b2..34a6baa094 100644 --- a/src/CommunityToolkit.Maui/Converters/ImageResourceConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/ImageResourceConverter.shared.cs @@ -7,7 +7,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts embedded image resource ID to it ImageSource. /// -public class ImageResourceConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ImageResourceConverter : BaseConverterOneWay { /// public override ImageSource? DefaultConvertReturnValue { get; set; } = null; diff --git a/src/CommunityToolkit.Maui/Converters/IndexToArrayItemConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IndexToArrayItemConverter.shared.cs index e8bfecc663..0e5fced476 100644 --- a/src/CommunityToolkit.Maui/Converters/IndexToArrayItemConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IndexToArrayItemConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts an index to corresponding array item and vice versa. /// -public class IndexToArrayItemConverter : BaseConverter +[AcceptEmptyServiceProvider] +public partial class IndexToArrayItemConverter : BaseConverter { /// public override object? DefaultConvertReturnValue { get; set; } = null; diff --git a/src/CommunityToolkit.Maui/Converters/IntToBoolConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IntToBoolConverter.shared.cs index fef40dffe3..5a21a1d534 100644 --- a/src/CommunityToolkit.Maui/Converters/IntToBoolConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IntToBoolConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts an to a corresponding and vice versa. /// -public class IntToBoolConverter : BaseConverter +[AcceptEmptyServiceProvider] +public partial class IntToBoolConverter : BaseConverter { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/InvertedBoolConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/InvertedBoolConverter.shared.cs index d5b7e1a3d9..ede5edb9f2 100644 --- a/src/CommunityToolkit.Maui/Converters/InvertedBoolConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/InvertedBoolConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts true to false and false to true. Simple as that! /// -public class InvertedBoolConverter : BaseConverter +[AcceptEmptyServiceProvider] +public partial class InvertedBoolConverter : BaseConverter { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/IsEqualConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsEqualConverter.shared.cs index 9126df293b..cd966b8c8a 100644 --- a/src/CommunityToolkit.Maui/Converters/IsEqualConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IsEqualConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Checks whether the incoming value equals the provided parameter. /// -public class IsEqualConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class IsEqualConverter : BaseConverterOneWay { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/IsInRangeConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsInRangeConverter.shared.cs index 2405970861..7d7ab0c30a 100644 --- a/src/CommunityToolkit.Maui/Converters/IsInRangeConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IsInRangeConverter.shared.cs @@ -4,7 +4,8 @@ namespace CommunityToolkit.Maui.Converters; /// Converts the incoming value to a indicating whether or not the value is within a range. -public sealed class IsInRangeConverter : IsInRangeConverter; +[AcceptEmptyServiceProvider] +public sealed partial class IsInRangeConverter : IsInRangeConverter; /// Converts the incoming value to a indicating whether or not the value is within a range. public abstract class IsInRangeConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TValue, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TReturnObject> : BaseConverterOneWay where TValue : IComparable diff --git a/src/CommunityToolkit.Maui/Converters/IsListNotNullOrEmptyConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsListNotNullOrEmptyConverter.shared.cs index 8433b6ad86..f7923c523f 100644 --- a/src/CommunityToolkit.Maui/Converters/IsListNotNullOrEmptyConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IsListNotNullOrEmptyConverter.shared.cs @@ -6,7 +6,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts the incoming value to a indicating whether or not the value is not null and not empty. /// -public class IsListNotNullOrEmptyConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class IsListNotNullOrEmptyConverter : BaseConverterOneWay { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/IsListNullOrEmptyConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsListNullOrEmptyConverter.shared.cs index 27838bfa6c..1400d5ba62 100644 --- a/src/CommunityToolkit.Maui/Converters/IsListNullOrEmptyConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IsListNullOrEmptyConverter.shared.cs @@ -6,7 +6,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts the incoming value to a indicating whether or not the value is null or empty. /// -public class IsListNullOrEmptyConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class IsListNullOrEmptyConverter : BaseConverterOneWay { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/IsNotEqualConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsNotEqualConverter.shared.cs index d2363c0537..ae74dee82c 100644 --- a/src/CommunityToolkit.Maui/Converters/IsNotEqualConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IsNotEqualConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Checks whether the incoming value doesn't equal the provided parameter. /// -public class IsNotEqualConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class IsNotEqualConverter : BaseConverterOneWay { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/IsNotNullConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsNotNullConverter.shared.cs index 31e6a91ddc..bee2e16280 100644 --- a/src/CommunityToolkit.Maui/Converters/IsNotNullConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IsNotNullConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts the incoming value to a indicating whether or not the value is not null. /// -public class IsNotNullConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class IsNotNullConverter : BaseConverterOneWay { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/IsNullConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsNullConverter.shared.cs index eb201fef28..fd58252a4a 100644 --- a/src/CommunityToolkit.Maui/Converters/IsNullConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IsNullConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts the incoming value to a indicating whether or not the value is null. /// -public class IsNullConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class IsNullConverter : BaseConverterOneWay { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrEmptyConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrEmptyConverter.shared.cs index 49ecedf8cf..004e05de5d 100644 --- a/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrEmptyConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrEmptyConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts the incoming value to a indicating whether or not the value is not null and not empty. /// -public class IsStringNotNullOrEmptyConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class IsStringNotNullOrEmptyConverter : BaseConverterOneWay { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrWhiteSpaceConverter.cs b/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrWhiteSpaceConverter.cs index 1f4fc495ca..e2a7b3aa9f 100644 --- a/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrWhiteSpaceConverter.cs +++ b/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrWhiteSpaceConverter.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts the incoming value to a indicating whether or not the value is not null and not white space. /// -public class IsStringNotNullOrWhiteSpaceConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class IsStringNotNullOrWhiteSpaceConverter : BaseConverterOneWay { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/IsStringNullOrEmptyConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsStringNullOrEmptyConverter.shared.cs index a1885ed94a..fa2c5d0f89 100644 --- a/src/CommunityToolkit.Maui/Converters/IsStringNullOrEmptyConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IsStringNullOrEmptyConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts the incoming value to a indicating whether or not the value is null or empty. /// -public class IsStringNullOrEmptyConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class IsStringNullOrEmptyConverter : BaseConverterOneWay { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/IsStringNullOrWhiteSpaceConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsStringNullOrWhiteSpaceConverter.shared.cs index 5081d298e2..e696d73d60 100644 --- a/src/CommunityToolkit.Maui/Converters/IsStringNullOrWhiteSpaceConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/IsStringNullOrWhiteSpaceConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts the incoming value to a indicating whether or not the value is null or white space. /// -public class IsStringNullOrWhiteSpaceConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class IsStringNullOrWhiteSpaceConverter : BaseConverterOneWay { /// public override bool DefaultConvertReturnValue { get; set; } = false; diff --git a/src/CommunityToolkit.Maui/Converters/ItemTappedEventArgsConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/ItemTappedEventArgsConverter.shared.cs index 2764143a6f..14c5c0170f 100644 --- a/src/CommunityToolkit.Maui/Converters/ItemTappedEventArgsConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/ItemTappedEventArgsConverter.shared.cs @@ -6,7 +6,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts/Extracts the incoming value from object and returns the value of property from it. /// -public class ItemTappedEventArgsConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ItemTappedEventArgsConverter : BaseConverterOneWay { /// public override object? DefaultConvertReturnValue { get; set; } = null; diff --git a/src/CommunityToolkit.Maui/Converters/ListToStringConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/ListToStringConverter.shared.cs index 08f6065a8c..305a12c75a 100644 --- a/src/CommunityToolkit.Maui/Converters/ListToStringConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/ListToStringConverter.shared.cs @@ -6,7 +6,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Concatenates the members of a collection, using the specified separator between each member. /// -public class ListToStringConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class ListToStringConverter : BaseConverterOneWay { string separator = string.Empty; diff --git a/src/CommunityToolkit.Maui/Converters/MathExpressionConverter/MathExpressionConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/MathExpressionConverter/MathExpressionConverter.shared.cs index ceaefd5c66..8d29adcadf 100644 --- a/src/CommunityToolkit.Maui/Converters/MathExpressionConverter/MathExpressionConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/MathExpressionConverter/MathExpressionConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converters for Math expressions /// -public class MathExpressionConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class MathExpressionConverter : BaseConverterOneWay { /// public override double DefaultConvertReturnValue { get; set; } = 0.0d; diff --git a/src/CommunityToolkit.Maui/Converters/MathExpressionConverter/MultiMathExpressionConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/MathExpressionConverter/MultiMathExpressionConverter.shared.cs index 11317d780b..ca0325f8af 100644 --- a/src/CommunityToolkit.Maui/Converters/MathExpressionConverter/MultiMathExpressionConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/MathExpressionConverter/MultiMathExpressionConverter.shared.cs @@ -7,6 +7,7 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converters for multiple math expressions /// +[AcceptEmptyServiceProvider] public class MultiMathExpressionConverter : MultiValueConverterExtension, ICommunityToolkitMultiValueConverter { /// diff --git a/src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs index 1c3f8e6748..26c7b5baec 100644 --- a/src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts an incoming value using all of the incoming converters in sequence. /// -public class MultiConverter : List, ICommunityToolkitValueConverter +[AcceptEmptyServiceProvider] +public partial class MultiConverter : List, ICommunityToolkitValueConverter { object? ICommunityToolkitValueConverter.DefaultConvertReturnValue => throw new NotSupportedException($"{nameof(ICommunityToolkitMultiValueConverter)} does not implement {nameof(ICommunityToolkitValueConverter.DefaultConvertReturnValue)}"); diff --git a/src/CommunityToolkit.Maui/Converters/MultiConverterParameter.shared.cs b/src/CommunityToolkit.Maui/Converters/MultiConverterParameter.shared.cs index 2404804e43..05899411d8 100644 --- a/src/CommunityToolkit.Maui/Converters/MultiConverterParameter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/MultiConverterParameter.shared.cs @@ -3,7 +3,8 @@ /// /// Represents a parameter to be used in the . /// -public class MultiConverterParameter : BindableObject +[AcceptEmptyServiceProvider] +public partial class MultiConverterParameter : BindableObject { /// /// The type of object of this parameter. diff --git a/src/CommunityToolkit.Maui/Converters/SelectedItemEventArgsConverter.cs b/src/CommunityToolkit.Maui/Converters/SelectedItemEventArgsConverter.cs index 0d44265699..1037ab6c8f 100644 --- a/src/CommunityToolkit.Maui/Converters/SelectedItemEventArgsConverter.cs +++ b/src/CommunityToolkit.Maui/Converters/SelectedItemEventArgsConverter.cs @@ -6,7 +6,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts/Extracts the incoming value from object and returns the value of property from it. /// -public class SelectedItemEventArgsConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class SelectedItemEventArgsConverter : BaseConverterOneWay { /// public override object? DefaultConvertReturnValue { get; set; } = null; diff --git a/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs index faf3c88d62..3733760503 100644 --- a/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs @@ -25,7 +25,8 @@ public enum LayoutState /// /// This converter can be used to determine if a certain state is visible. This can be useful, for instance, in scenarios where you want to show/hide certain elements based on the current state. /// -public class StateToBooleanConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class StateToBooleanConverter : BaseConverterOneWay { LayoutState stateToCompare = LayoutState.None; diff --git a/src/CommunityToolkit.Maui/Converters/StringToListConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/StringToListConverter.shared.cs index 97cda5ec30..1af4c97ec7 100644 --- a/src/CommunityToolkit.Maui/Converters/StringToListConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/StringToListConverter.shared.cs @@ -6,7 +6,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Returns a string array that contains the substrings in this string that are delimited by . /// -public class StringToListConverter : BaseConverterOneWay +[AcceptEmptyServiceProvider] +public partial class StringToListConverter : BaseConverterOneWay { string separator = " "; IList separators = Array.Empty(); diff --git a/src/CommunityToolkit.Maui/Converters/TextCaseConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/TextCaseConverter.shared.cs index 6d5724f23c..15132bdb5e 100644 --- a/src/CommunityToolkit.Maui/Converters/TextCaseConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/TextCaseConverter.shared.cs @@ -25,8 +25,8 @@ public enum TextCaseType /// /// Converts text (string, char) to certain case as specified with or the parameter of the Convert method. /// -[ContentProperty(nameof(Type))] -public class TextCaseConverter : BaseConverterOneWay +[ContentProperty(nameof(Type)), AcceptEmptyServiceProvider] +public partial class TextCaseConverter : BaseConverterOneWay { TextCaseType type = TextCaseType.None; @@ -41,7 +41,7 @@ public TextCaseType Type get => type; set { - if (!Enum.IsDefined(typeof(TextCaseType), value)) + if (!Enum.IsDefined(value)) { throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(TextCaseType)); } diff --git a/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs index 86de0124da..2b8098d2c6 100644 --- a/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs @@ -5,7 +5,8 @@ namespace CommunityToolkit.Maui.Converters; /// /// Converts a to a value expressed in seconds. /// -public class TimeSpanToSecondsConverter : BaseConverter +[AcceptEmptyServiceProvider] +public partial class TimeSpanToSecondsConverter : BaseConverter { /// public override double DefaultConvertReturnValue { get; set; } = 0.0d; diff --git a/src/CommunityToolkit.Maui/Converters/VariableMultiValueConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/VariableMultiValueConverter.shared.cs index b38f752d5f..003ee539aa 100644 --- a/src/CommunityToolkit.Maui/Converters/VariableMultiValueConverter.shared.cs +++ b/src/CommunityToolkit.Maui/Converters/VariableMultiValueConverter.shared.cs @@ -23,7 +23,8 @@ public enum MultiBindingCondition /// /// The is a converter that allows users to convert multiple value bindings to a single . It does this by enabling them to specify whether All, Any, None or a specific number of values are true as specified in . This is useful when combined with the . /// -public class VariableMultiValueConverter : MultiValueConverterExtension, ICommunityToolkitMultiValueConverter +[AcceptEmptyServiceProvider] +public partial class VariableMultiValueConverter : MultiValueConverterExtension, ICommunityToolkitMultiValueConverter { /// /// Indicates how many values should be true out of the provided boolean values in the . Supports the following values: All, None, Any, GreaterThan, LessThan. diff --git a/src/CommunityToolkit.Maui/Extensions/AppThemeResourceExtension.shared.cs b/src/CommunityToolkit.Maui/Extensions/AppThemeResourceExtension.shared.cs index e681a163fd..70466804ac 100644 --- a/src/CommunityToolkit.Maui/Extensions/AppThemeResourceExtension.shared.cs +++ b/src/CommunityToolkit.Maui/Extensions/AppThemeResourceExtension.shared.cs @@ -3,7 +3,7 @@ /// /// A XAML markup extension that enables using and from XAML. /// -[ContentProperty(nameof(Key))] +[ContentProperty(nameof(Key)), AcceptEmptyServiceProvider] public sealed class AppThemeResourceExtension : IMarkupExtension { /// diff --git a/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs b/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs index e996fbdfa3..a1b1a1410b 100644 --- a/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs +++ b/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs @@ -7,7 +7,7 @@ namespace CommunityToolkit.Maui.ImageSources; /// Gravatar image source. /// Note that is sealed and can't be used as a parent! -public class GravatarImageSource : StreamImageSource, IDisposable +public partial class GravatarImageSource : StreamImageSource, IDisposable { /// The backing store for the bindable property. public static readonly BindableProperty CacheValidityProperty = BindableProperty.Create(nameof(CacheValidity), typeof(TimeSpan), typeof(GravatarImageSource), TimeSpan.FromDays(1)); diff --git a/src/CommunityToolkit.Maui/Layouts/DockLayout.shared.cs b/src/CommunityToolkit.Maui/Layouts/DockLayout.shared.cs index a1eaa660d4..4207953a9d 100644 --- a/src/CommunityToolkit.Maui/Layouts/DockLayout.shared.cs +++ b/src/CommunityToolkit.Maui/Layouts/DockLayout.shared.cs @@ -7,7 +7,7 @@ namespace CommunityToolkit.Maui.Layouts; /// /// DockLayout positions its child elements along the edges of the layout container. /// -public class DockLayout : Layout, IDockLayout +public partial class DockLayout : Layout, IDockLayout { /// /// Docking position for a view. diff --git a/src/CommunityToolkit.Maui/Layouts/UniformItemsLayout.shared.cs b/src/CommunityToolkit.Maui/Layouts/UniformItemsLayout.shared.cs index eb07c97bf4..ff4751ff83 100644 --- a/src/CommunityToolkit.Maui/Layouts/UniformItemsLayout.shared.cs +++ b/src/CommunityToolkit.Maui/Layouts/UniformItemsLayout.shared.cs @@ -9,7 +9,7 @@ namespace CommunityToolkit.Maui.Layouts; /// All rows and columns will have the same size. /// Use this when you need the Grid behavior without the need to specify different sizes for the rows and columns. /// -public class UniformItemsLayout : Layout, IUniformItemsLayout +public partial class UniformItemsLayout : Layout, IUniformItemsLayout { /// /// Backing BindableProperty for the property. diff --git a/src/CommunityToolkit.Maui/Views/AvatarView.shared.cs b/src/CommunityToolkit.Maui/Views/AvatarView.shared.cs index c66d1b3f04..674d53350e 100644 --- a/src/CommunityToolkit.Maui/Views/AvatarView.shared.cs +++ b/src/CommunityToolkit.Maui/Views/AvatarView.shared.cs @@ -6,7 +6,7 @@ namespace CommunityToolkit.Maui.Views; /// AvatarView control. -public class AvatarView : Border, IAvatarView, IBorderElement, IFontElement, ITextElement, IImageElement, ITextAlignmentElement, ILineHeightElement, ICornerElement +public partial class AvatarView : Border, IAvatarView, IBorderElement, IFontElement, ITextElement, IImageElement, ITextAlignmentElement, ILineHeightElement, ICornerElement { /// The backing store for the bindable property. public static readonly BindableProperty BorderColorProperty = BindableProperty.Create(nameof(BorderColor), typeof(Color), typeof(IAvatarView), defaultValue: AvatarViewDefaults.DefaultBorderColor, propertyChanged: OnBorderColorPropertyChanged); diff --git a/src/CommunityToolkit.Maui/Views/DrawingView/DrawingView.shared.cs b/src/CommunityToolkit.Maui/Views/DrawingView/DrawingView.shared.cs index 5a5c8e3341..64bab80133 100644 --- a/src/CommunityToolkit.Maui/Views/DrawingView/DrawingView.shared.cs +++ b/src/CommunityToolkit.Maui/Views/DrawingView/DrawingView.shared.cs @@ -8,7 +8,7 @@ namespace CommunityToolkit.Maui.Views; /// /// The DrawingView allows you to draw one or multiple lines on a canvas. /// -public class DrawingView : View, IDrawingView +public partial class DrawingView : View, IDrawingView { readonly WeakEventManager drawingViewEventManager = new(); diff --git a/src/CommunityToolkit.Maui/Views/LazyView/LazyView.shared.cs b/src/CommunityToolkit.Maui/Views/LazyView/LazyView.shared.cs index 5bf550488d..0d81e08eb8 100644 --- a/src/CommunityToolkit.Maui/Views/LazyView/LazyView.shared.cs +++ b/src/CommunityToolkit.Maui/Views/LazyView/LazyView.shared.cs @@ -4,7 +4,7 @@ /// This a basic implementation implementing /// /// Any -public class LazyView : LazyView where TView : View, new() +public partial class LazyView : LazyView where TView : View, new() { /// /// This method initializes . diff --git a/src/CommunityToolkit.Maui/Views/SemanticOrderView/SemanticOrderView.shared.cs b/src/CommunityToolkit.Maui/Views/SemanticOrderView/SemanticOrderView.shared.cs index ad3de4cfd7..2d7a1c31f8 100644 --- a/src/CommunityToolkit.Maui/Views/SemanticOrderView/SemanticOrderView.shared.cs +++ b/src/CommunityToolkit.Maui/Views/SemanticOrderView/SemanticOrderView.shared.cs @@ -4,7 +4,7 @@ namespace CommunityToolkit.Maui.Views; /// -public class SemanticOrderView : ContentView, ISemanticOrderView +public partial class SemanticOrderView : ContentView, ISemanticOrderView { /// /// Backing BindableProperty for the property. diff --git a/src/CommunityToolkit.Maui/Views/WrapperControl.windows.cs b/src/CommunityToolkit.Maui/Views/WrapperControl.windows.cs index e88b5c7aa4..c7e56688e6 100644 --- a/src/CommunityToolkit.Maui/Views/WrapperControl.windows.cs +++ b/src/CommunityToolkit.Maui/Views/WrapperControl.windows.cs @@ -7,7 +7,7 @@ namespace CommunityToolkit.Maui.Core.Views; // We still have to keep this class, due to some random exceptions that occurs when the // .NET MAUI implementation is used. -class WrapperControl : Panel +partial class WrapperControl : Panel { readonly View view; From 059454974f2ec96a842546fc2e2934413681c897 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:27:48 -0700 Subject: [PATCH 047/171] Use `partial` for source generators --- .../BindablePropertyAttributeSourceGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CommunityToolkit.Maui.SourceGenerators.Internal/BindablePropertyAttributeSourceGenerator.cs b/src/CommunityToolkit.Maui.SourceGenerators.Internal/BindablePropertyAttributeSourceGenerator.cs index 8f706b2840..188ea02992 100644 --- a/src/CommunityToolkit.Maui.SourceGenerators.Internal/BindablePropertyAttributeSourceGenerator.cs +++ b/src/CommunityToolkit.Maui.SourceGenerators.Internal/BindablePropertyAttributeSourceGenerator.cs @@ -23,7 +23,7 @@ public class BindablePropertyAttributeSourceGenerator : IIncrementalGenerator namespace CommunityToolkit.Maui; [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] -sealed class BindablePropertyAttribute : Attribute +sealed partial class BindablePropertyAttribute : Attribute { public string PropertyName { get; } = string.Empty; public Type? DeclaringType { get; set; } From 298e12bf8a1b762db100b29c8a08ede0394cce57 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:42:35 -0700 Subject: [PATCH 048/171] Use Syntax Highlighting for code blocks --- ...CommunityToolkitMediaElementInitializationAnalyzerTests.cs | 2 +- .../BindablePropertyAttributeSourceGenerator.cs | 4 ++-- .../Generators/TextColorToGenerator.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CommunityToolkit.Maui.Analyzers.UnitTests/UseCommunityToolkitMediaElementInitializationAnalyzerTests.cs b/src/CommunityToolkit.Maui.Analyzers.UnitTests/UseCommunityToolkitMediaElementInitializationAnalyzerTests.cs index b255860ced..8e1299e44d 100644 --- a/src/CommunityToolkit.Maui.Analyzers.UnitTests/UseCommunityToolkitMediaElementInitializationAnalyzerTests.cs +++ b/src/CommunityToolkit.Maui.Analyzers.UnitTests/UseCommunityToolkitMediaElementInitializationAnalyzerTests.cs @@ -47,7 +47,7 @@ public static MauiApp CreateMauiApp() } [Fact] - public async Task VerifyNoErrorsWhenUseMauiCommunityToolkitMediaElementHasAdditonalWhitespace() + public async Task VerifyNoErrorsWhenUseMauiCommunityToolkitMediaElementHasAdditionalWhitespace() { const string source = /* language=C#-test */ """ namespace CommunityToolkit.Maui.Analyzers.UnitTests diff --git a/src/CommunityToolkit.Maui.SourceGenerators.Internal/BindablePropertyAttributeSourceGenerator.cs b/src/CommunityToolkit.Maui.SourceGenerators.Internal/BindablePropertyAttributeSourceGenerator.cs index 188ea02992..500d9dd79a 100644 --- a/src/CommunityToolkit.Maui.SourceGenerators.Internal/BindablePropertyAttributeSourceGenerator.cs +++ b/src/CommunityToolkit.Maui.SourceGenerators.Internal/BindablePropertyAttributeSourceGenerator.cs @@ -18,7 +18,7 @@ public class BindablePropertyAttributeSourceGenerator : IIncrementalGenerator const string bpFullName = "global::Microsoft.Maui.Controls.BindableProperty"; const string bindingModeFullName = "global::Microsoft.Maui.Controls."; - const string bpAttribute = """ + const string bpAttribute = /* language=C#-test */""" #nullable enable namespace CommunityToolkit.Maui; @@ -65,7 +65,7 @@ void Execute(SourceProductionContext context, SemanticValues semanticValues) static string GenerateSource(SemanticValues value) { - var sb = new StringBuilder($@" + var sb = new StringBuilder(/* language=C#-test */$@" // // Test2 : {DateTime.Now} diff --git a/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs b/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs index 7377cd4a9f..fe9cde50df 100644 --- a/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs +++ b/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs @@ -46,7 +46,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) var classSymbol = (INamedTypeSymbol?)context.SemanticModel.GetDeclaredSymbol(context.Node); - // If the ClassDlecarationSyntax doesn't implements those interfaces we just return null + // If the ClassDeclarationSyntax doesn't implements those interfaces we just return null if (classSymbol is null || !(classSymbol.AllInterfaces.Contains(iAnimatableInterfaceSymbol, SymbolEqualityComparer.Default) && classSymbol.AllInterfaces.Contains(iTextStyleInterfaceSymbol, SymbolEqualityComparer.Default))) @@ -111,7 +111,7 @@ static void Execution(SourceProductionContext context, TextStyleClassMetadata te var assemblyVersion = typeof(TextColorToGenerator).Assembly.GetName().Version.ToString(); - var textColorToBuilder = $$""" + var textColorToBuilder = /* language=C#-test */ $$""" // // See: CommunityToolkit.Maui.SourceGenerators.TextColorToGenerator From eddf68fa0fcdcbf818299bb08761f571e077d828 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:45:59 -0700 Subject: [PATCH 049/171] Removed duplicate string --- .../UseCommunityToolkitCameraInitializationAnalyzerTests.cs | 2 +- .../UseCommunityToolkitInitializationAnalyzerTests.cs | 2 +- .../Generators/TextColorToGenerator.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CommunityToolkit.Maui.Analyzers.UnitTests/UseCommunityToolkitCameraInitializationAnalyzerTests.cs b/src/CommunityToolkit.Maui.Analyzers.UnitTests/UseCommunityToolkitCameraInitializationAnalyzerTests.cs index f7dbabf3f9..56e0765527 100644 --- a/src/CommunityToolkit.Maui.Analyzers.UnitTests/UseCommunityToolkitCameraInitializationAnalyzerTests.cs +++ b/src/CommunityToolkit.Maui.Analyzers.UnitTests/UseCommunityToolkitCameraInitializationAnalyzerTests.cs @@ -46,7 +46,7 @@ public static MauiApp CreateMauiApp() } [Fact] - public async Task VerifyNoErrorsWhenUseMauiCommunityToolkitCameraHasAdditonalWhitespace() + public async Task VerifyNoErrorsWhenUseMauiCommunityToolkitCameraHasAdditionalWhitespace() { const string source = /* language=C#-test */ """ namespace CommunityToolkit.Maui.Analyzers.UnitTests diff --git a/src/CommunityToolkit.Maui.Analyzers.UnitTests/UseCommunityToolkitInitializationAnalyzerTests.cs b/src/CommunityToolkit.Maui.Analyzers.UnitTests/UseCommunityToolkitInitializationAnalyzerTests.cs index 3a0233fb5f..edb0d22602 100644 --- a/src/CommunityToolkit.Maui.Analyzers.UnitTests/UseCommunityToolkitInitializationAnalyzerTests.cs +++ b/src/CommunityToolkit.Maui.Analyzers.UnitTests/UseCommunityToolkitInitializationAnalyzerTests.cs @@ -47,7 +47,7 @@ public static MauiApp CreateMauiApp() } [Fact] - public async Task VerifyNoErrorsWhenUseMauiCommunityToolkitHasAdditonalWhitespace() + public async Task VerifyNoErrorsWhenUseMauiCommunityToolkitHasAdditionalWhitespace() { const string source = /* language=C#-test */ """ namespace CommunityToolkit.Maui.Analyzers.UnitTests diff --git a/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs b/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs index fe9cde50df..ea7734a5dc 100644 --- a/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs +++ b/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs @@ -111,7 +111,7 @@ static void Execution(SourceProductionContext context, TextStyleClassMetadata te var assemblyVersion = typeof(TextColorToGenerator).Assembly.GetName().Version.ToString(); - var textColorToBuilder = /* language=C#-test */ $$""" + var source = /* language=C#-test */$$""" // // See: CommunityToolkit.Maui.SourceGenerators.TextColorToGenerator @@ -193,7 +193,7 @@ static Animation GetAlphaTransformAnimation({{textStyleClassMetadata.Namespace}} } } """; - var source = textColorToBuilder.ToString(); + SourceStringService.FormatText(ref source); context.AddSource($"{textStyleClassMetadata.ClassName}TextColorTo.g.shared.cs", SourceText.From(source, Encoding.UTF8)); } From df98a4296a9d3f7067a20b1742beb131c4526153 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:19:03 -0700 Subject: [PATCH 050/171] Remove References to Application.Current.MainPage --- .../Pages/Alerts/SnackbarPage.xaml.cs | 12 +++--- .../Pages/Alerts/ToastPage.xaml.cs | 12 +++--- .../Pages/Views/Expander/ExpanderPageCS.cs | 2 +- .../ItemTappedEventArgsConverterViewModel.cs | 2 +- .../Essentials/FileSaverViewModel.cs | 2 +- .../Views/Popup/PopupAnchorViewModel.cs | 4 +- .../Views/Popup/PopupPositionViewModel.cs | 2 +- .../ViewModels/Views/ViewsGalleryViewModel.cs | 38 +++++++++---------- .../Extensions/PageExtensions.cs | 2 +- .../Views/MauiMediaElement.windows.cs | 2 +- .../Essentials/AppThemeTests.cs | 2 +- .../Alerts/Snackbar/Snackbar.android.cs | 5 +-- src/CommunityToolkit.Maui/PopupService.cs | 2 +- 13 files changed, 43 insertions(+), 44 deletions(-) diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml.cs index 07d655f0f1..8e4e107745 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml.cs @@ -95,9 +95,9 @@ void Snackbar_Shown(object? sender, EventArgs e) async void DisplaySnackbarInModalButtonClicked(object? sender, EventArgs e) { - if (Application.Current?.MainPage is not null) + if (Application.Current?.Windows[0].Page is Page mainPage) { - await Application.Current.MainPage.Navigation.PushModalAsync(new ContentPage + await mainPage.Navigation.PushModalAsync(new ContentPage { Content = new VerticalStackLayout { @@ -105,17 +105,17 @@ await Application.Current.MainPage.Navigation.PushModalAsync(new ContentPage Children = { - new Button { Command = new AsyncRelayCommand(static token => Snackbar.Make("Snackbar in a Modal Page").Show(token)) } + new Button { Command = new AsyncRelayCommand(static token => Snackbar.Make("Snackbar in a Modal MainPage").Show(token)) } .Top().CenterHorizontal() .Text("Display Snackbar"), new Label() .Center().TextCenter() - .Text("This is a Modal Page"), + .Text("This is a Modal MainPage"), - new Button { Command = new AsyncRelayCommand(Application.Current.MainPage.Navigation.PopModalAsync) } + new Button { Command = new AsyncRelayCommand(Application.Current.W.Navigation.PopModalAsync) } .Bottom().CenterHorizontal() - .Text("Back to Snackbar Page") + .Text("Back to Snackbar MainPage") } }.Center() }.Padding(12)); diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/ToastPage.xaml.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/ToastPage.xaml.cs index 4ee35c83af..d6ce3d76a2 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/ToastPage.xaml.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/ToastPage.xaml.cs @@ -31,9 +31,9 @@ async void ShowCustomToastButtonClicked(object? sender, EventArgs args) async void DisplayToastInModalButtonClicked(object? sender, EventArgs e) { - if (Application.Current?.MainPage is not null) + if (Application.Current?.Windows[0].Page is Page mainPage) { - await Application.Current.MainPage.Navigation.PushModalAsync(new ContentPage + await mainPage.Navigation.PushModalAsync(new ContentPage { Content = new VerticalStackLayout { @@ -41,17 +41,17 @@ await Application.Current.MainPage.Navigation.PushModalAsync(new ContentPage Children = { - new Button { Command = new AsyncRelayCommand(token => Toast.Make("Toast in a Modal Page").Show(token)) } + new Button { Command = new AsyncRelayCommand(token => Toast.Make("Toast in a Modal MainPage").Show(token)) } .Top().CenterHorizontal() .Text("Display Toast"), new Label() .Center().TextCenter() - .Text("This is a Modal Page"), + .Text("This is a Modal MainPage"), - new Button { Command = new AsyncRelayCommand(Application.Current.MainPage.Navigation.PopModalAsync) } + new Button { Command = new AsyncRelayCommand(mainPage.Navigation.PopModalAsync) } .Bottom().CenterHorizontal() - .Text("Back to Toast Page") + .Text("Back to Toast MainPage") } }.Center() }.Padding(12)); diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs index 6003f2fec6..fd9d78792d 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs @@ -12,7 +12,7 @@ public ExpanderPageCS() const string dotnetBotUrl = "https://avatars.githubusercontent.com/u/9011267?v=4"; const string dotnetMauiUrl = "https://dot.net/maui"; - Title = "Expander Page, C# UI"; + Title = "Expander MainPage, C# UI"; Content = new VerticalStackLayout() { diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ItemTappedEventArgsConverterViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ItemTappedEventArgsConverterViewModel.cs index 8b3b98dbc6..ce16db7d13 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ItemTappedEventArgsConverterViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/ItemTappedEventArgsConverterViewModel.cs @@ -23,7 +23,7 @@ Task ItemTapped(Person? person, CancellationToken token) ItemSelected = null; - return Application.Current?.MainPage?.DisplayAlert("Item Tapped", person.Name, "Ok").WaitAsync(token) ?? Task.CompletedTask; + return Application.Current?.Windows[0].Page?.DisplayAlert("Item Tapped", person.Name, "Ok").WaitAsync(token) ?? Task.CompletedTask; } } diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FileSaverViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FileSaverViewModel.cs index e3d701bac3..c594648672 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FileSaverViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Essentials/FileSaverViewModel.cs @@ -17,7 +17,7 @@ async Task SaveFile(CancellationToken cancellationToken) using var stream = new MemoryStream(Encoding.Default.GetBytes("Hello from the Community Toolkit!")); try { - var fileName = Application.Current?.MainPage?.DisplayPromptAsync("FileSaver", "Choose filename") ?? Task.FromResult("test.txt"); + var fileName = Application.Current?.Windows[0].Page?.DisplayPromptAsync("FileSaver", "Choose filename") ?? Task.FromResult("test.txt"); var fileLocationResult = await fileSaver.SaveAsync(await fileName, stream, cancellationToken); fileLocationResult.EnsureSuccess(); diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupAnchorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupAnchorViewModel.cs index 076e578c9b..fcebff5c3e 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupAnchorViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupAnchorViewModel.cs @@ -6,7 +6,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views; public sealed partial class PopupAnchorViewModel : BaseViewModel { - static Page Page => Application.Current?.MainPage ?? throw new NullReferenceException(); + static Page MainPage => Application.Current?.Windows[0].Page ?? throw new InvalidOperationException("MainPage cannot be null"); [RelayCommand] static void ShowPopup(View anchor) @@ -15,6 +15,6 @@ static void ShowPopup(View anchor) { Anchor = anchor }; - Page.ShowPopup(popup); + MainPage.ShowPopup(popup); } } \ No newline at end of file diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupPositionViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupPositionViewModel.cs index 5c215f5fb1..88620a1477 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupPositionViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/Popup/PopupPositionViewModel.cs @@ -7,7 +7,7 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views; public partial class PopupPositionViewModel : BaseViewModel { - static Page Page => Application.Current?.MainPage ?? throw new NullReferenceException(); + static Page Page => Application.Current?.Windows[0].Page ?? throw new InvalidOperationException("MainPage cannot be null"); [RelayCommand] static void DisplayPopup(PopupPosition position) diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/ViewsGalleryViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/ViewsGalleryViewModel.cs index 3cff5ce945..796f5ef327 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/ViewsGalleryViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/ViewsGalleryViewModel.cs @@ -5,34 +5,34 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views; public sealed partial class ViewsGalleryViewModel() : BaseGalleryViewModel( [ - SectionModel.Create("AvatarView Bindable Properties Page", Colors.Red, "A page demonstrating how to bind to various AvatarView properties."), - SectionModel.Create("AvatarView Borders Page", Colors.Red, "A page demonstrating AvatarView borders."), - SectionModel.Create("AvatarView Colors Page", Colors.Red, "A page demonstrating AvatarViews with different color options."), - SectionModel.Create("AvatarView Day of Week Page", Colors.Red, "A page demonstrating AvatarViews as a Day of the Week."), - SectionModel.Create("AvatarView Gestures Page", Colors.Red, "A page demonstrating AvatarViews with different gesture options."), - SectionModel.Create("AvatarView Images Page", Colors.Red, "A page demonstrating AvatarViews with different image options."), - SectionModel.Create("AvatarView Keyboard Page", Colors.Red, "A page demonstrating AvatarViews aligned as a Keyboard."), - SectionModel.Create("AvatarView Rating Page", Colors.Red, "A page demonstrating AvatarViews as a star rating."), - SectionModel.Create("AvatarView Shadows Page", Colors.Red, "A page demonstrating AvatarViews with various shadow options."), - SectionModel.Create("AvatarView Shapes Page", Colors.Red, "A page demonstrating AvatarViews with various shape options."), - SectionModel.Create("AvatarView Sizes Page", Colors.Red, "A page demonstrating AvatarViews with various size options."), - SectionModel.Create("CameraView Page", Colors.Red, "CameraView is a view for displaying camera output."), + SectionModel.Create("AvatarView Bindable Properties MainPage", Colors.Red, "A page demonstrating how to bind to various AvatarView properties."), + SectionModel.Create("AvatarView Borders MainPage", Colors.Red, "A page demonstrating AvatarView borders."), + SectionModel.Create("AvatarView Colors MainPage", Colors.Red, "A page demonstrating AvatarViews with different color options."), + SectionModel.Create("AvatarView Day of Week MainPage", Colors.Red, "A page demonstrating AvatarViews as a Day of the Week."), + SectionModel.Create("AvatarView Gestures MainPage", Colors.Red, "A page demonstrating AvatarViews with different gesture options."), + SectionModel.Create("AvatarView Images MainPage", Colors.Red, "A page demonstrating AvatarViews with different image options."), + SectionModel.Create("AvatarView Keyboard MainPage", Colors.Red, "A page demonstrating AvatarViews aligned as a Keyboard."), + SectionModel.Create("AvatarView Rating MainPage", Colors.Red, "A page demonstrating AvatarViews as a star rating."), + SectionModel.Create("AvatarView Shadows MainPage", Colors.Red, "A page demonstrating AvatarViews with various shadow options."), + SectionModel.Create("AvatarView Shapes MainPage", Colors.Red, "A page demonstrating AvatarViews with various shape options."), + SectionModel.Create("AvatarView Sizes MainPage", Colors.Red, "A page demonstrating AvatarViews with various size options."), + SectionModel.Create("CameraView MainPage", Colors.Red, "CameraView is a view for displaying camera output."), SectionModel.Create("Custom Size and Positioning Popup", Colors.Red, "Displays a basic popup anywhere on the screen with a custom size using VerticalOptions and HorizontalOptions."), SectionModel.Create("DrawingView", Colors.Red, "DrawingView provides a canvas for users to \"paint\" on the screen. The drawing can also be captured and displayed as an Image."), - SectionModel.Create("Expander Page", Colors.Red, "Expander allows collapse and expand content."), - SectionModel.Create("Windows Maps Basic Page", Colors.Red, "A page demonstrating a basic example of .NET MAUI Maps for Windows."), + SectionModel.Create("Expander MainPage", Colors.Red, "Expander allows collapse and expand content."), + SectionModel.Create("Windows Maps Basic MainPage", Colors.Red, "A page demonstrating a basic example of .NET MAUI Maps for Windows."), SectionModel.Create("LazyView", Colors.Red, "LazyView is a view that allows you to load its children in a delayed manner."), - SectionModel.Create("Windows Maps Pins Page", Colors.Red, "A page demonstrating .NET MAUI Maps for Windows with Pins."), + SectionModel.Create("Windows Maps Pins MainPage", Colors.Red, "A page demonstrating .NET MAUI Maps for Windows with Pins."), SectionModel.Create("MediaElement", Colors.Red, "MediaElement is a view for playing video and audio"), SectionModel.Create("MediaElement in CarouselView", Colors.Red, "MediaElement can be used inside a DataTemplate in a CarouselView"), SectionModel.Create("MediaElement in CollectionView", Colors.Red, "MediaElement can be used inside a DataTemplate in a CollectionView"), SectionModel.Create("MediaElement in a Multi-Window Application", Colors.Red, "Demonstrates that MediaElement can be used inside a DataTemplate simultaneously on multiple windows"), - SectionModel.Create("Multiple Popups Page", Colors.Red, "A page demonstrating multiple different Popups"), + SectionModel.Create("Multiple Popups MainPage", Colors.Red, "A page demonstrating multiple different Popups"), SectionModel.Create("Custom Positioning Popup", Colors.Red, "Displays a basic popup anywhere on the screen using VerticalOptions and HorizontalOptions"), SectionModel.Create("Anchor Popup", Colors.Red, "Popups can be anchored to other view's on the screen"), - SectionModel.Create("Popup Layout Page", Colors.Red, "Popup.Content demonstrated using different layouts"), - SectionModel.Create("Popup Sizing Issues Page", Colors.Red, "A page demonstrating how Popups can be styled in a .NET MAUI application."), + SectionModel.Create("Popup Layout MainPage", Colors.Red, "Popup.Content demonstrated using different layouts"), + SectionModel.Create("Popup Sizing Issues MainPage", Colors.Red, "A page demonstrating how Popups can be styled in a .NET MAUI application."), SectionModel.Create("Show Popup in OnAppearing", Colors.Red, "Proves that we now support showing a popup before the platform is even ready."), SectionModel.Create("Semantic Order View", Colors.Red, "SemanticOrderView allows developers to indicate the focus order of visible controls when a user is navigating via TalkBack (Android), VoiceOver (iOS) or Narrator (Windows)."), - SectionModel.Create("Popup Style Page", Colors.Red, "A page demonstrating how Popups can be styled in a .NET MAUI application.") + SectionModel.Create("Popup Style MainPage", Colors.Red, "A page demonstrating how Popups can be styled in a .NET MAUI application.") ]); \ No newline at end of file diff --git a/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs b/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs index c0ce337910..78d1905594 100644 --- a/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs +++ b/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs @@ -31,7 +31,7 @@ internal static Page GetCurrentPage(this Page currentPage) internal record struct ParentWindow { - static Page CurrentPage => GetCurrentPage(Application.Current?.MainPage ?? throw new InvalidOperationException($"{nameof(Application.Current.MainPage)} cannot be null.")); + static Page CurrentPage => GetCurrentPage(Application.Current?.Windows[0].Page ?? throw new InvalidOperationException($"{nameof(Page)} cannot be null.")); /// /// Checks if the parent window is null. /// diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs index 737688fa58..0c0462f3a4 100644 --- a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs +++ b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.windows.cs @@ -88,7 +88,7 @@ public void Dispose() /// Gets the presented page. /// protected static Page CurrentPage => - PageExtensions.GetCurrentPage(Application.Current?.MainPage ?? throw new InvalidOperationException($"{nameof(Application.Current.MainPage)} cannot be null.")); + PageExtensions.GetCurrentPage(Application.Current?.Windows[0].Page ?? throw new InvalidOperationException($"{nameof(Page)} cannot be null.")); /// /// Releases the managed and unmanaged resources used by the . diff --git a/src/CommunityToolkit.Maui.UnitTests/Essentials/AppThemeTests.cs b/src/CommunityToolkit.Maui.UnitTests/Essentials/AppThemeTests.cs index fc68b11415..e707ce64b0 100644 --- a/src/CommunityToolkit.Maui.UnitTests/Essentials/AppThemeTests.cs +++ b/src/CommunityToolkit.Maui.UnitTests/Essentials/AppThemeTests.cs @@ -36,7 +36,7 @@ public void AppThemeColorUsesCorrectColorForTheme() }; label.SetAppThemeColor(Label.TextColorProperty, color); - app.MainPage = new ContentPage + app.Windows[0].Page = new ContentPage { Content = label }; diff --git a/src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.android.cs b/src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.android.cs index 32302179db..793d0ddfa7 100644 --- a/src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.android.cs +++ b/src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.android.cs @@ -35,12 +35,11 @@ protected virtual void Dispose(bool isDisposing) isDisposed = true; } - static bool IsModalPageActive() => Application.Current?.MainPage is not null && - Application.Current.MainPage.Navigation.ModalStack.Count > 0; + static bool IsModalPageActive() => Application.Current?.Windows[0].Page is Page mainPage && mainPage.Navigation.ModalStack.Count > 0; static View GetParentView() { - var parentView = Microsoft.Maui.ApplicationModel.Platform.CurrentActivity?.Window?.DecorView.FindViewById(Android.Resource.Id.Content); + var parentView = Platform.CurrentActivity?.Window?.DecorView.FindViewById(Android.Resource.Id.Content); if (IsModalPageActive()) { diff --git a/src/CommunityToolkit.Maui/PopupService.cs b/src/CommunityToolkit.Maui/PopupService.cs index 1f83b7fa0f..632a98d535 100644 --- a/src/CommunityToolkit.Maui/PopupService.cs +++ b/src/CommunityToolkit.Maui/PopupService.cs @@ -21,7 +21,7 @@ public class PopupService : IPopupService static Page CurrentPage => PageExtensions.GetCurrentPage( - Application.Current?.MainPage ?? throw new InvalidOperationException("Application.Current.MainPage cannot be null.")); + Application.Current?.Windows[0].Page ?? throw new InvalidOperationException("Application.Current?.Windows[0].Page cannot be null.")); /// /// Creates a new instance of . From 0251dcf526f5847c68d4aa9b706fdc679c7361f4 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:26:55 -0700 Subject: [PATCH 051/171] Fix typos --- .../Pages/Alerts/SnackbarPage.xaml.cs | 2 +- .../UseMauiCommunityToolkitAnalyzerBenchmarks.cs | 4 ++-- .../UseMauiCommunityToolkitCameraAnalyzerBenchmarks.cs | 4 ++-- ...nityToolkitMediaElementInitializationAnalyzerBenchmarks.cs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml.cs index 8e4e107745..47afee30fa 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Alerts/SnackbarPage.xaml.cs @@ -113,7 +113,7 @@ await mainPage.Navigation.PushModalAsync(new ContentPage .Center().TextCenter() .Text("This is a Modal MainPage"), - new Button { Command = new AsyncRelayCommand(Application.Current.W.Navigation.PopModalAsync) } + new Button { Command = new AsyncRelayCommand(mainPage.Navigation.PopModalAsync) } .Bottom().CenterHorizontal() .Text("Back to Snackbar MainPage") } diff --git a/src/CommunityToolkit.Maui.Analyzers.Benchmarks/UseMauiCommunityToolkitAnalyzerBenchmarks.cs b/src/CommunityToolkit.Maui.Analyzers.Benchmarks/UseMauiCommunityToolkitAnalyzerBenchmarks.cs index 7400cd3e71..c3661ecb9f 100644 --- a/src/CommunityToolkit.Maui.Analyzers.Benchmarks/UseMauiCommunityToolkitAnalyzerBenchmarks.cs +++ b/src/CommunityToolkit.Maui.Analyzers.Benchmarks/UseMauiCommunityToolkitAnalyzerBenchmarks.cs @@ -15,9 +15,9 @@ public Task VerifyNoErrorsWhenUseMauiCommunityToolkit() } [Benchmark] - public Task VerifyNoErrorsWhenUseMauiCommunityToolkitHasAdditonalWhitespace() + public Task VerifyNoErrorsWhenUseMauiCommunityToolkitHasAdditionalWhitespace() { - return useCommunityToolkitInitializationAnalyzerTests.VerifyNoErrorsWhenUseMauiCommunityToolkitHasAdditonalWhitespace(); + return useCommunityToolkitInitializationAnalyzerTests.VerifyNoErrorsWhenUseMauiCommunityToolkitHasAdditionalWhitespace(); } [Benchmark] diff --git a/src/CommunityToolkit.Maui.Analyzers.Benchmarks/UseMauiCommunityToolkitCameraAnalyzerBenchmarks.cs b/src/CommunityToolkit.Maui.Analyzers.Benchmarks/UseMauiCommunityToolkitCameraAnalyzerBenchmarks.cs index 61483a40ef..1c68e81bd1 100644 --- a/src/CommunityToolkit.Maui.Analyzers.Benchmarks/UseMauiCommunityToolkitCameraAnalyzerBenchmarks.cs +++ b/src/CommunityToolkit.Maui.Analyzers.Benchmarks/UseMauiCommunityToolkitCameraAnalyzerBenchmarks.cs @@ -15,9 +15,9 @@ public Task VerifyNoErrorsWhenUseMauiCommunityToolkitCamera() } [Benchmark] - public Task VerifyNoErrorsWhenUseMauiCommunityToolkitCameraHasAdditonalWhitespace() + public Task VerifyNoErrorsWhenUseMauiCommunityToolkitCameraHasAdditionalWhitespace() { - return useCommunityToolkitCameraInitializationAnalyzerTests.VerifyNoErrorsWhenUseMauiCommunityToolkitCameraHasAdditonalWhitespace(); + return useCommunityToolkitCameraInitializationAnalyzerTests.VerifyNoErrorsWhenUseMauiCommunityToolkitCameraHasAdditionalWhitespace(); } [Benchmark] diff --git a/src/CommunityToolkit.Maui.Analyzers.Benchmarks/UseMauiCommunityToolkitMediaElementInitializationAnalyzerBenchmarks.cs b/src/CommunityToolkit.Maui.Analyzers.Benchmarks/UseMauiCommunityToolkitMediaElementInitializationAnalyzerBenchmarks.cs index 7a2b2b563d..b1df90df35 100644 --- a/src/CommunityToolkit.Maui.Analyzers.Benchmarks/UseMauiCommunityToolkitMediaElementInitializationAnalyzerBenchmarks.cs +++ b/src/CommunityToolkit.Maui.Analyzers.Benchmarks/UseMauiCommunityToolkitMediaElementInitializationAnalyzerBenchmarks.cs @@ -15,9 +15,9 @@ public Task VerifyNoErrorsWhenUseMauiCommunityToolkitMediaElement() } [Benchmark] - public Task VerifyNoErrorsWhenUseMauiCommunityToolkitMediaElementHasAdditonalWhitespace() + public Task VerifyNoErrorsWhenUseMauiCommunityToolkitMediaElementHasAdditionalWhitespace() { - return useCommunityToolkitMediaElementInitializationAnalyzerTests.VerifyNoErrorsWhenUseMauiCommunityToolkitMediaElementHasAdditonalWhitespace(); + return useCommunityToolkitMediaElementInitializationAnalyzerTests.VerifyNoErrorsWhenUseMauiCommunityToolkitMediaElementHasAdditionalWhitespace(); } [Benchmark] From 47fcdd8b38af1e8c3b7917d9b6d915b6b1382f65 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:35:14 -0700 Subject: [PATCH 052/171] Update samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj --- .../CommunityToolkit.Maui.Sample.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj index 86c0a7ece6..38e92f758b 100644 --- a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj +++ b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj @@ -35,7 +35,7 @@ 10.0.19041.53 true - + CsWinRT1028 From f6cddbd06b355c6b8193828eed7a5952b421c335 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:36:30 -0700 Subject: [PATCH 053/171] Update samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs --- .../Pages/Views/Expander/ExpanderPageCS.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs index fd9d78792d..6003f2fec6 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs @@ -12,7 +12,7 @@ public ExpanderPageCS() const string dotnetBotUrl = "https://avatars.githubusercontent.com/u/9011267?v=4"; const string dotnetMauiUrl = "https://dot.net/maui"; - Title = "Expander MainPage, C# UI"; + Title = "Expander Page, C# UI"; Content = new VerticalStackLayout() { From 7d0d18206ab18f9ad48c730903b557c3f5cf5aa7 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:47:30 -0700 Subject: [PATCH 054/171] Fix Find + Replace typo --- .../ViewModels/Views/ViewsGalleryViewModel.cs | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/ViewsGalleryViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/ViewsGalleryViewModel.cs index 796f5ef327..3cff5ce945 100644 --- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/ViewsGalleryViewModel.cs +++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/ViewsGalleryViewModel.cs @@ -5,34 +5,34 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.Views; public sealed partial class ViewsGalleryViewModel() : BaseGalleryViewModel( [ - SectionModel.Create("AvatarView Bindable Properties MainPage", Colors.Red, "A page demonstrating how to bind to various AvatarView properties."), - SectionModel.Create("AvatarView Borders MainPage", Colors.Red, "A page demonstrating AvatarView borders."), - SectionModel.Create("AvatarView Colors MainPage", Colors.Red, "A page demonstrating AvatarViews with different color options."), - SectionModel.Create("AvatarView Day of Week MainPage", Colors.Red, "A page demonstrating AvatarViews as a Day of the Week."), - SectionModel.Create("AvatarView Gestures MainPage", Colors.Red, "A page demonstrating AvatarViews with different gesture options."), - SectionModel.Create("AvatarView Images MainPage", Colors.Red, "A page demonstrating AvatarViews with different image options."), - SectionModel.Create("AvatarView Keyboard MainPage", Colors.Red, "A page demonstrating AvatarViews aligned as a Keyboard."), - SectionModel.Create("AvatarView Rating MainPage", Colors.Red, "A page demonstrating AvatarViews as a star rating."), - SectionModel.Create("AvatarView Shadows MainPage", Colors.Red, "A page demonstrating AvatarViews with various shadow options."), - SectionModel.Create("AvatarView Shapes MainPage", Colors.Red, "A page demonstrating AvatarViews with various shape options."), - SectionModel.Create("AvatarView Sizes MainPage", Colors.Red, "A page demonstrating AvatarViews with various size options."), - SectionModel.Create("CameraView MainPage", Colors.Red, "CameraView is a view for displaying camera output."), + SectionModel.Create("AvatarView Bindable Properties Page", Colors.Red, "A page demonstrating how to bind to various AvatarView properties."), + SectionModel.Create("AvatarView Borders Page", Colors.Red, "A page demonstrating AvatarView borders."), + SectionModel.Create("AvatarView Colors Page", Colors.Red, "A page demonstrating AvatarViews with different color options."), + SectionModel.Create("AvatarView Day of Week Page", Colors.Red, "A page demonstrating AvatarViews as a Day of the Week."), + SectionModel.Create("AvatarView Gestures Page", Colors.Red, "A page demonstrating AvatarViews with different gesture options."), + SectionModel.Create("AvatarView Images Page", Colors.Red, "A page demonstrating AvatarViews with different image options."), + SectionModel.Create("AvatarView Keyboard Page", Colors.Red, "A page demonstrating AvatarViews aligned as a Keyboard."), + SectionModel.Create("AvatarView Rating Page", Colors.Red, "A page demonstrating AvatarViews as a star rating."), + SectionModel.Create("AvatarView Shadows Page", Colors.Red, "A page demonstrating AvatarViews with various shadow options."), + SectionModel.Create("AvatarView Shapes Page", Colors.Red, "A page demonstrating AvatarViews with various shape options."), + SectionModel.Create("AvatarView Sizes Page", Colors.Red, "A page demonstrating AvatarViews with various size options."), + SectionModel.Create("CameraView Page", Colors.Red, "CameraView is a view for displaying camera output."), SectionModel.Create("Custom Size and Positioning Popup", Colors.Red, "Displays a basic popup anywhere on the screen with a custom size using VerticalOptions and HorizontalOptions."), SectionModel.Create("DrawingView", Colors.Red, "DrawingView provides a canvas for users to \"paint\" on the screen. The drawing can also be captured and displayed as an Image."), - SectionModel.Create("Expander MainPage", Colors.Red, "Expander allows collapse and expand content."), - SectionModel.Create("Windows Maps Basic MainPage", Colors.Red, "A page demonstrating a basic example of .NET MAUI Maps for Windows."), + SectionModel.Create("Expander Page", Colors.Red, "Expander allows collapse and expand content."), + SectionModel.Create("Windows Maps Basic Page", Colors.Red, "A page demonstrating a basic example of .NET MAUI Maps for Windows."), SectionModel.Create("LazyView", Colors.Red, "LazyView is a view that allows you to load its children in a delayed manner."), - SectionModel.Create("Windows Maps Pins MainPage", Colors.Red, "A page demonstrating .NET MAUI Maps for Windows with Pins."), + SectionModel.Create("Windows Maps Pins Page", Colors.Red, "A page demonstrating .NET MAUI Maps for Windows with Pins."), SectionModel.Create("MediaElement", Colors.Red, "MediaElement is a view for playing video and audio"), SectionModel.Create("MediaElement in CarouselView", Colors.Red, "MediaElement can be used inside a DataTemplate in a CarouselView"), SectionModel.Create("MediaElement in CollectionView", Colors.Red, "MediaElement can be used inside a DataTemplate in a CollectionView"), SectionModel.Create("MediaElement in a Multi-Window Application", Colors.Red, "Demonstrates that MediaElement can be used inside a DataTemplate simultaneously on multiple windows"), - SectionModel.Create("Multiple Popups MainPage", Colors.Red, "A page demonstrating multiple different Popups"), + SectionModel.Create("Multiple Popups Page", Colors.Red, "A page demonstrating multiple different Popups"), SectionModel.Create("Custom Positioning Popup", Colors.Red, "Displays a basic popup anywhere on the screen using VerticalOptions and HorizontalOptions"), SectionModel.Create("Anchor Popup", Colors.Red, "Popups can be anchored to other view's on the screen"), - SectionModel.Create("Popup Layout MainPage", Colors.Red, "Popup.Content demonstrated using different layouts"), - SectionModel.Create("Popup Sizing Issues MainPage", Colors.Red, "A page demonstrating how Popups can be styled in a .NET MAUI application."), + SectionModel.Create("Popup Layout Page", Colors.Red, "Popup.Content demonstrated using different layouts"), + SectionModel.Create("Popup Sizing Issues Page", Colors.Red, "A page demonstrating how Popups can be styled in a .NET MAUI application."), SectionModel.Create("Show Popup in OnAppearing", Colors.Red, "Proves that we now support showing a popup before the platform is even ready."), SectionModel.Create("Semantic Order View", Colors.Red, "SemanticOrderView allows developers to indicate the focus order of visible controls when a user is navigating via TalkBack (Android), VoiceOver (iOS) or Narrator (Windows)."), - SectionModel.Create("Popup Style MainPage", Colors.Red, "A page demonstrating how Popups can be styled in a .NET MAUI application.") + SectionModel.Create("Popup Style Page", Colors.Red, "A page demonstrating how Popups can be styled in a .NET MAUI application.") ]); \ No newline at end of file From cdfba47ce7d89be14cd734f47da6b4ae7ae0c31a Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:47:37 -0700 Subject: [PATCH 055/171] Remove unused namespace --- .../Behaviors/ICommunityToolkitBehavior.shared.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CommunityToolkit.Maui/Behaviors/ICommunityToolkitBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/ICommunityToolkitBehavior.shared.cs index 0f461d4048..24c3d503ca 100644 --- a/src/CommunityToolkit.Maui/Behaviors/ICommunityToolkitBehavior.shared.cs +++ b/src/CommunityToolkit.Maui/Behaviors/ICommunityToolkitBehavior.shared.cs @@ -1,7 +1,6 @@ using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -using Microsoft.Maui.Controls.Internals; namespace CommunityToolkit.Maui.Behaviors; From 05dd7ec219e057138905bfe5922a341283f490b1 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:33:27 -0700 Subject: [PATCH 056/171] Remove `MainPage` --- .../Essentials/AppThemeTests.cs | 76 +++++++------------ .../Mocks/MockShell.cs | 12 +++ 2 files changed, 41 insertions(+), 47 deletions(-) create mode 100644 src/CommunityToolkit.Maui.UnitTests/Mocks/MockShell.cs diff --git a/src/CommunityToolkit.Maui.UnitTests/Essentials/AppThemeTests.cs b/src/CommunityToolkit.Maui.UnitTests/Essentials/AppThemeTests.cs index e707ce64b0..5396cbb2c8 100644 --- a/src/CommunityToolkit.Maui.UnitTests/Essentials/AppThemeTests.cs +++ b/src/CommunityToolkit.Maui.UnitTests/Essentials/AppThemeTests.cs @@ -7,43 +7,46 @@ namespace CommunityToolkit.Maui.UnitTests.Essentials; public class AppThemeTests : BaseHandlerTest { readonly MockAppInfo mockAppInfo; - readonly Application app; + readonly Label label = new(); public AppThemeTests() { const AppTheme initialAppTheme = AppTheme.Light; - AppInfo.SetCurrent(mockAppInfo = new() { RequestedTheme = initialAppTheme }); + AppInfo.SetCurrent(mockAppInfo = new() + { + RequestedTheme = initialAppTheme + }); + + ArgumentNullException.ThrowIfNull(Application.Current); - Application.Current = app = new Application(); + Application.Current.ActivateWindow(new Window(new MockShell([ + new ContentPage + { + Content = label + } + ]))); - SetAppTheme(initialAppTheme); + SetAppTheme(initialAppTheme, Application.Current); - Assert.Equal(initialAppTheme, app.PlatformAppTheme); + Assert.Equal(initialAppTheme, Application.Current.PlatformAppTheme); } [Fact] public void AppThemeColorUsesCorrectColorForTheme() { + ArgumentNullException.ThrowIfNull(Application.Current); + AppThemeColor color = new() { Light = Colors.Green, Dark = Colors.Red }; - Label label = new() - { - Text = "Green on Light, Red on Dark" - }; label.SetAppThemeColor(Label.TextColorProperty, color); - app.Windows[0].Page = new ContentPage - { - Content = label - }; - Assert.Equal(Colors.Green, label.TextColor); - SetAppTheme(AppTheme.Dark); + SetAppTheme(AppTheme.Dark, Application.Current); Assert.Equal(Colors.Red, label.TextColor); } @@ -51,27 +54,19 @@ public void AppThemeColorUsesCorrectColorForTheme() [Fact] public void AppThemeColorUsesDefaultColorWhenDarkColorNotSet() { + ArgumentNullException.ThrowIfNull(Application.Current); + AppThemeColor color = new() { Light = Colors.Green, Default = Colors.Blue }; - - Label label = new() - { - Text = "Green on Light, Red on Dark" - }; - + label.SetAppThemeColor(Label.TextColorProperty, color); - app.MainPage = new ContentPage - { - Content = label - }; - Assert.Equal(Colors.Green, label.TextColor); - SetAppTheme(AppTheme.Dark); + SetAppTheme(AppTheme.Dark, Application.Current); Assert.Equal(Colors.Blue, label.TextColor); } @@ -79,27 +74,19 @@ public void AppThemeColorUsesDefaultColorWhenDarkColorNotSet() [Fact] public void AppThemeColorUsesDefaultColorWhenLightColorNotSet() { + ArgumentNullException.ThrowIfNull(Application.Current); + AppThemeColor color = new() { Default = Colors.Blue, Dark = Colors.Red }; - Label label = new() - { - Text = "Green on Light, Red on Dark" - }; - label.SetAppThemeColor(Label.TextColorProperty, color); - app.MainPage = new ContentPage - { - Content = label - }; - Assert.Equal(Colors.Blue, label.TextColor); - SetAppTheme(AppTheme.Dark); + SetAppTheme(AppTheme.Dark, Application.Current); Assert.Equal(Colors.Red, label.TextColor); } @@ -107,7 +94,7 @@ public void AppThemeColorUsesDefaultColorWhenLightColorNotSet() [Fact] public void AppThemeResourceUpdatesLabelText() { - Label label = new(); + ArgumentNullException.ThrowIfNull(Application.Current); AppThemeObject resource = new() { @@ -117,21 +104,16 @@ public void AppThemeResourceUpdatesLabelText() label.SetAppTheme(Label.TextProperty, resource); - app.MainPage = new ContentPage - { - Content = label - }; - Assert.Equal("Light Theme", label.Text); - SetAppTheme(AppTheme.Dark); + SetAppTheme(AppTheme.Dark, Application.Current); Assert.Equal("Dark Theme", label.Text); } - void SetAppTheme(in AppTheme theme) + void SetAppTheme(in AppTheme theme, in IApplication app) { mockAppInfo.RequestedTheme = theme; - ((IApplication)app).ThemeChanged(); + app.ThemeChanged(); } } \ No newline at end of file diff --git a/src/CommunityToolkit.Maui.UnitTests/Mocks/MockShell.cs b/src/CommunityToolkit.Maui.UnitTests/Mocks/MockShell.cs new file mode 100644 index 0000000000..f509ecf539 --- /dev/null +++ b/src/CommunityToolkit.Maui.UnitTests/Mocks/MockShell.cs @@ -0,0 +1,12 @@ +namespace CommunityToolkit.Maui.UnitTests.Mocks; + +public class MockShell : Shell +{ + public MockShell(List shellPages) + { + foreach (var page in shellPages) + { + Items.Add(page); + } + } +} \ No newline at end of file From c917bd0952baea9cb38f39a27758bcca38c61b52 Mon Sep 17 00:00:00 2001 From: Brandon Minnick <13558917+brminnick@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:50:12 -0700 Subject: [PATCH 057/171] Add BindingContext to Behaviors in Sample App --- .../Pages/Behaviors/AnimationBehaviorPage.xaml | 12 +++++++----- .../Pages/Behaviors/BehaviorsGalleryPage.cs | 3 +++ .../CharactersValidationBehaviorPage.xaml | 15 +++++++++------ .../Behaviors/EventToCommandBehaviorPage.xaml | 8 ++++++-- .../Behaviors/IconTintColorBehaviorPage.xaml | 14 ++++++++++---- .../MaxLengthReachedBehaviorPage.xaml | 8 ++++++-- .../Behaviors/MultiValidationBehaviorPage.xaml | 2 +- .../ProgressBarAnimationBehaviorPage.xaml | 3 ++- .../Pages/Behaviors/StatusBarBehaviorPage.xaml | 4 +++- .../UserStoppedTypingBehaviorPage.xaml | 18 +++++++++++------- 10 files changed, 58 insertions(+), 29 deletions(-) diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/AnimationBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/AnimationBehaviorPage.xaml index db7ee9f13b..59afacd700 100644 --- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/AnimationBehaviorPage.xaml +++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/AnimationBehaviorPage.xaml @@ -78,16 +78,18 @@ - - - + + + - +