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
- 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 @@
-
-
-
+
+
+
-
+
-
+
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/BehaviorsGalleryPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/BehaviorsGalleryPage.cs
index e7478ad4e8..ceb91de147 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/BehaviorsGalleryPage.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/BehaviorsGalleryPage.cs
@@ -1,4 +1,5 @@
using CommunityToolkit.Maui.Behaviors;
+using CommunityToolkit.Maui.Markup;
using CommunityToolkit.Maui.Sample.ViewModels.Behaviors;
namespace CommunityToolkit.Maui.Sample.Pages.Behaviors;
@@ -11,6 +12,8 @@ public BehaviorsGalleryPage(IDeviceInfo deviceInfo, BehaviorsGalleryViewModel be
#if ANDROID || IOS
AddStatusBarBehavior();
#endif
+
+ new Image().Source("");
}
void AddStatusBarBehavior()
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/CharactersValidationBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/CharactersValidationBehaviorPage.xaml
index 58919aa6be..f3454c3898 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/CharactersValidationBehaviorPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/CharactersValidationBehaviorPage.xaml
@@ -67,9 +67,10 @@
-
+
-
+
-
+
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/EventToCommandBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/EventToCommandBehaviorPage.xaml
index ed25c00875..fab0edfa94 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/EventToCommandBehaviorPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/EventToCommandBehaviorPage.xaml
@@ -19,10 +19,12 @@
@@ -30,11 +32,13 @@
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/IconTintColorBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/IconTintColorBehaviorPage.xaml
index 47914bbaba..3202a4214f 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/IconTintColorBehaviorPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/IconTintColorBehaviorPage.xaml
@@ -75,9 +75,12 @@
Grid.Row="4"
Grid.Column="1"
Command="{Binding ToggleImageButtonCommand, Mode=OneTime}"
- Source="{Binding ToggleableImageSource}">
+ Source="{Binding ToggleableImageSource}"
+ x:Name="ToggleImageSourceButton">
-
+
@@ -85,9 +88,12 @@
Grid.Row="4"
Grid.Column="2"
Command="{Binding ChangeColorCommand}"
- Source="shield.png">
+ Source="shield.png"
+ x:Name="ShieldButton">
-
+
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml
index 7509a58804..fb98ef1beb 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml
@@ -51,10 +51,12 @@
+ Margin="{StaticResource ContentPadding}"
+ x:Name="MaxLengthEntry">
@@ -70,9 +72,11 @@
+ Margin="{StaticResource ContentPadding}"
+ x:Name="MaxLegnthCommandEntry">
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MultiValidationBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MultiValidationBehaviorPage.xaml
index b6e48a6a38..e8f2e4d44b 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MultiValidationBehaviorPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MultiValidationBehaviorPage.xaml
@@ -48,7 +48,7 @@
+ Text="{Binding Errors[0], Source={x:Reference MultiValidation}, FallbackValue=''}"/>
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/ProgressBarAnimationBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/ProgressBarAnimationBehaviorPage.xaml
index 3c6e88db9e..417c7a850c 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/ProgressBarAnimationBehaviorPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/ProgressBarAnimationBehaviorPage.xaml
@@ -14,10 +14,11 @@
-
+
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/StatusBarBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/StatusBarBehaviorPage.xaml
index 2c08158c8b..cf22e710f2 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/StatusBarBehaviorPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/StatusBarBehaviorPage.xaml
@@ -8,7 +8,8 @@
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Behaviors"
Title="StatusBarBehavior"
x:DataType="vm:StatusBarBehaviorViewModel"
- x:TypeArguments="vm:StatusBarBehaviorViewModel">
+ x:TypeArguments="vm:StatusBarBehaviorViewModel"
+ x:Name="Page">
@@ -73,6 +74,7 @@
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/UserStoppedTypingBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/UserStoppedTypingBehaviorPage.xaml
index ab6e3b4ee3..3736122620 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/UserStoppedTypingBehaviorPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/UserStoppedTypingBehaviorPage.xaml
@@ -19,7 +19,7 @@
-
-
+
-
+
-
+
From ce8deb8c29b7b1717789eda45ee03526fe11528a Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Thu, 17 Oct 2024 16:05:39 -0700
Subject: [PATCH 058/171] Increase Android SupportedOSPlatformVersion to 26
---
.../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 38e92f758b..0f4e6451c8 100644
--- a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj
+++ b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj
@@ -77,7 +77,7 @@
15.0
15.0
- 21.0
+ 26.0
10.0.17763.0
6.5
10.0.17763.0
From 1f9c06dc94502ceaea82db3442611380da096676 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Thu, 17 Oct 2024 16:07:28 -0700
Subject: [PATCH 059/171] Fix XAML Warnings
---
.../Behaviors/MaxLengthReachedBehaviorPage.xaml | 7 ++++---
.../Pages/Behaviors/StatusBarBehaviorPage.xaml.cs | 2 +-
.../Behaviors/UserStoppedTypingBehaviorPage.xaml | 5 +++--
.../Pages/Converters/ColorsConverterPage.xaml | 2 ++
.../Extensions/ColorAnimationExtensionsPage.xaml | 9 ++++-----
.../Extensions/ColorAnimationExtensionsPage.xaml.cs | 2 +-
.../Pages/Views/CameraView/CameraViewPage.xaml | 2 +-
.../Pages/Views/LazyView/LazyViewPage.xaml | 4 ++--
.../Pages/Views/LazyView/LazyViewPage.xaml.cs | 2 +-
.../Pages/Views/MediaElement/MediaElementPage.xaml | 2 --
.../Pages/Views/Popup/PopupSizingIssuesPage.xaml | 3 +--
.../Views/Popups/TransparentPopupCSharp.cs | 13 ++++++++++---
12 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml
index fb98ef1beb..bd4dcc6dc4 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml
@@ -20,8 +20,9 @@
Margin="{StaticResource ContentPadding}" />
-
+
-
+
-
+
+
+
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Extensions/ColorAnimationExtensionsPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Extensions/ColorAnimationExtensionsPage.xaml
index b4ef3716cb..bd73f3e060 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Extensions/ColorAnimationExtensionsPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Extensions/ColorAnimationExtensionsPage.xaml
@@ -35,16 +35,15 @@
-
-
-
+
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Extensions/ColorAnimationExtensionsPage.xaml.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Extensions/ColorAnimationExtensionsPage.xaml.cs
index 71db7eddad..70b752ebb4 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Extensions/ColorAnimationExtensionsPage.xaml.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Extensions/ColorAnimationExtensionsPage.xaml.cs
@@ -49,7 +49,7 @@ async void Button_Clicked(object sender, EventArgs e)
var easing = easings.ElementAtOrDefault(EasingPicker.SelectedIndex).Value;
- await Task.WhenAll(ColorFrame.BackgroundColorTo(color, rate, duration, easing),
+ await Task.WhenAll(ColorBorder.BackgroundColorTo(color, rate, duration, easing),
TextColorToDescriptionLabel.TextColorTo(color, rate, duration, easing));
SetPickersRandomValue();
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/CameraView/CameraViewPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Views/CameraView/CameraViewPage.xaml
index 75a39ad28b..0224085143 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/CameraView/CameraViewPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/CameraView/CameraViewPage.xaml
@@ -29,7 +29,7 @@
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/LazyViewPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/LazyViewPage.xaml
index 4a1060b548..1948953458 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/LazyViewPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/LazyViewPage.xaml
@@ -46,8 +46,8 @@
-
-
+
+
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/LazyViewPage.xaml.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/LazyViewPage.xaml.cs
index 5c65fe055d..2b9309f969 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/LazyViewPage.xaml.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/LazyView/LazyViewPage.xaml.cs
@@ -14,7 +14,7 @@ protected override async void OnAppearing()
base.OnAppearing();
var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
- await LazyActiviation.LoadViewAsync(cts.Token);
+ await LazyActivation.LoadViewAsync(cts.Token);
}
async void LoadLazyView_Clicked(object sender, EventArgs e)
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementPage.xaml
index 585270778f..d8d7bbfdae 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementPage.xaml
@@ -2,7 +2,6 @@
-
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/Popup/PopupSizingIssuesPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Views/Popup/PopupSizingIssuesPage.xaml
index 0d3aafbc1e..8d07c02fe0 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/Popup/PopupSizingIssuesPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/Popup/PopupSizingIssuesPage.xaml
@@ -14,8 +14,7 @@
+ SelectedItem="{Binding SelectedContainer}"/>
diff --git a/samples/CommunityToolkit.Maui.Sample/Views/Popups/TransparentPopupCSharp.cs b/samples/CommunityToolkit.Maui.Sample/Views/Popups/TransparentPopupCSharp.cs
index 31003e057c..545fd88a37 100644
--- a/samples/CommunityToolkit.Maui.Sample/Views/Popups/TransparentPopupCSharp.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Views/Popups/TransparentPopupCSharp.cs
@@ -1,5 +1,6 @@
using CommunityToolkit.Maui.Markup;
using CommunityToolkit.Maui.Views;
+using Microsoft.Maui.Controls.Shapes;
namespace CommunityToolkit.Maui.Sample.Views.Popups;
@@ -13,8 +14,14 @@ public TransparentPopupCSharp(Size popupSize) : this()
public TransparentPopupCSharp()
{
- Content = new Frame { CornerRadius = 25 }
- .Size(50, 50)
- .Margin(10);
+ Content = new Border
+ {
+ StrokeShape = new RoundRectangle
+ {
+ CornerRadius = 25
+ }
+ }
+ .Size(50, 50)
+ .Margin(10);
}
}
\ No newline at end of file
From 02723507158fc118c7e6df82af6599289c47f377 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Sun, 27 Oct 2024 14:24:02 -0700
Subject: [PATCH 060/171] Use `macos-15-arm64`
---
azure-pipelines.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 4d8ddf401f..7c42610862 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -61,7 +61,7 @@ jobs:
'Windows':
image: 'windows-latest'
'macOS':
- image: 'macos-14'
+ image: 'macos-15-arm64'
pool:
vmImage: $(image)
steps:
@@ -139,7 +139,7 @@ jobs:
'Windows':
image: 'windows-latest'
'macOS':
- image: 'macos-14'
+ image: 'macos-15-arm64'
pool:
vmImage: $(image)
steps:
@@ -451,7 +451,7 @@ jobs:
'Windows':
image: 'windows-latest'
'macOS':
- image: 'macos-14'
+ image: 'macos-15-arm64'
pool:
vmImage: $(image)
steps:
From 32ecaabde473b3b921193a69abaa73d2e545c356 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Sun, 27 Oct 2024 14:29:42 -0700
Subject: [PATCH 061/171] Update azure-pipelines.yml
---
azure-pipelines.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 7c42610862..231d878ba3 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -61,7 +61,7 @@ jobs:
'Windows':
image: 'windows-latest'
'macOS':
- image: 'macos-15-arm64'
+ image: 'macos-15'
pool:
vmImage: $(image)
steps:
@@ -139,7 +139,7 @@ jobs:
'Windows':
image: 'windows-latest'
'macOS':
- image: 'macos-15-arm64'
+ image: 'macos-15'
pool:
vmImage: $(image)
steps:
@@ -451,7 +451,7 @@ jobs:
'Windows':
image: 'windows-latest'
'macOS':
- image: 'macos-15-arm64'
+ image: 'macos-15'
pool:
vmImage: $(image)
steps:
From 26d43e18e8959e251e1fab136b72ed32f17529d6 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Sun, 27 Oct 2024 14:39:11 -0700
Subject: [PATCH 062/171] Use Xcode version `16`
---
azure-pipelines.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 231d878ba3..432ec9d712 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -28,8 +28,8 @@ variables:
PathToCommunityToolkitAnalyzersUnitTestCsproj: 'src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj'
PathToCommunityToolkitAnalyzersBenchmarkCsproj: 'src/CommunityToolkit.Maui.Analyzers.Benchmarks/CommunityToolkit.Maui.Analyzers.Benchmarks.csproj'
DotNetMauiRollbackFile: 'https://maui.blob.core.windows.net/metadata/rollbacks/8.0.6.json'
- CommunityToolkitSampleApp_Xcode_Version: '16.0'
- CommunityToolkitLibrary_Xcode_Version: '16.0'
+ CommunityToolkitSampleApp_Xcode_Version: '16'
+ CommunityToolkitLibrary_Xcode_Version: '16'
trigger:
branches:
From 72857bacbc876e023bd60dd2746700dd0629fe31 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Sun, 27 Oct 2024 14:51:14 -0700
Subject: [PATCH 063/171] Revert back to macOS14
---
azure-pipelines.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 432ec9d712..3e049ef4c8 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -61,7 +61,7 @@ jobs:
'Windows':
image: 'windows-latest'
'macOS':
- image: 'macos-15'
+ image: 'macos-14'
pool:
vmImage: $(image)
steps:
@@ -139,7 +139,7 @@ jobs:
'Windows':
image: 'windows-latest'
'macOS':
- image: 'macos-15'
+ image: 'macos-14'
pool:
vmImage: $(image)
steps:
@@ -451,7 +451,7 @@ jobs:
'Windows':
image: 'windows-latest'
'macOS':
- image: 'macos-15'
+ image: 'macos-14'
pool:
vmImage: $(image)
steps:
From 810b69cfd9a4d1a6c3d951ba264a9e021e2c24e3 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Thu, 31 Oct 2024 10:49:35 -0700
Subject: [PATCH 064/171] Use BindingMode.OneWay
---
.../ImageSources/GravatarImageSource.shared.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs b/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs
index a1b1a1410b..6c63879ac8 100644
--- a/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs
+++ b/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs
@@ -146,8 +146,8 @@ protected override void OnParentSet()
return;
}
- SetBinding(ParentWidthProperty, BindingBase.Create(static p => p.Width, source: parentElement));
- SetBinding(ParentHeightProperty, BindingBase.Create(static p => p.Height, source: parentElement));
+ SetBinding(ParentWidthProperty, BindingBase.Create(static p => p.Width, source: parentElement, mode: BindingMode.OneWay));
+ SetBinding(ParentHeightProperty, BindingBase.Create(static p => p.Height, source: parentElement, mode: BindingMode.OneWay));
}
static string DefaultGravatarName(DefaultImage defaultGravatar) => defaultGravatar switch
From 7b52c4aa29a0f165df1e65dfa3a001e1cb09bc39 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Thu, 31 Oct 2024 11:56:57 -0700
Subject: [PATCH 065/171] Fix PopupService Tests
---
.../BaseHandlerTest.cs | 35 ++-
.../ProgressBarAnimationBehaviorTests.cs | 2 +-
.../PopupServiceTests.cs | 205 +++---------------
src/CommunityToolkit.Maui/PopupService.cs | 54 +++--
4 files changed, 96 insertions(+), 200 deletions(-)
diff --git a/src/CommunityToolkit.Maui.UnitTests/BaseHandlerTest.cs b/src/CommunityToolkit.Maui.UnitTests/BaseHandlerTest.cs
index ff71a25567..b52ac266ae 100644
--- a/src/CommunityToolkit.Maui.UnitTests/BaseHandlerTest.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/BaseHandlerTest.cs
@@ -5,9 +5,9 @@ namespace CommunityToolkit.Maui.UnitTests;
public abstract class BaseHandlerTest : BaseTest
{
- protected BaseHandlerTest()
+ protected BaseHandlerTest(IReadOnlyList? servicesToRegister = null)
{
- CreateAndSetMockApplication(out var serviceProvider);
+ InitializeServicesAndSetMockApplication(servicesToRegister ?? [], out var serviceProvider);
ServiceProvider = serviceProvider;
}
@@ -41,22 +41,43 @@ protected static TViewHandler CreateViewHandler(IView view, bool d
return mockViewHandler;
}
- static void CreateAndSetMockApplication(out IServiceProvider serviceProvider)
+ static void InitializeServicesAndSetMockApplication(in IReadOnlyList transientServicesToRegister, out IServiceProvider serviceProvider)
{
var appBuilder = MauiApp.CreateBuilder()
- .UseMauiCommunityToolkit()
- .UseMauiApp();
+ .UseMauiCommunityToolkit()
+ .UseMauiApp();
+
+ #region Register Services for CameraTests
appBuilder.Services.AddSingleton();
+ #endregion
+
+ #region Register Services for PopupServiceTests
+
+ var mockPageViewModel = new MockPageViewModel();
+ var mockPopup = new MockSelfClosingPopup(mockPageViewModel, new());
+
+ PopupService.ClearViewModelToViewMappings();
+ PopupService.AddTransientPopup(mockPopup, mockPageViewModel, appBuilder.Services);
+ #endregion
+
+ foreach (var service in transientServicesToRegister)
+ {
+ appBuilder.Services.AddTransient(service);
+ }
+
var mauiApp = appBuilder.Build();
- var application = mauiApp.Services.GetRequiredService();
+ var application = (MockApplication)mauiApp.Services.GetRequiredService();
+ application.AddWindow(new Window());
serviceProvider = mauiApp.Services;
- IPlatformApplication.Current = (IPlatformApplication)application;
+ IPlatformApplication.Current = application;
application.Handler = new ApplicationHandlerStub();
application.Handler.SetMauiContext(new HandlersContextStub(mauiApp.Services));
+
+ CreateElementHandler(mockPopup);
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/ProgressBarAnimationBehaviorTests.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/ProgressBarAnimationBehaviorTests.cs
index 6d52a552de..574f65d713 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/ProgressBarAnimationBehaviorTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/ProgressBarAnimationBehaviorTests.cs
@@ -76,7 +76,7 @@ public void AttachedToInvalidElementTest()
IReadOnlyList invalidVisualElements =
[
new Button(),
- new Frame(),
+ new Border(),
new Label(),
new VisualElement(),
new View(),
diff --git a/src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs b/src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs
index 2c865ecd60..5d9b629d28 100644
--- a/src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs
@@ -1,4 +1,5 @@
using System.ComponentModel;
+using System.Runtime.CompilerServices;
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.UnitTests.Mocks;
using CommunityToolkit.Maui.Views;
@@ -10,26 +11,18 @@ public class PopupServiceTests : BaseHandlerTest
{
public PopupServiceTests()
{
- var appBuilder = MauiApp.CreateBuilder()
- .UseMauiCommunityToolkit()
- .UseMauiApp();
-
- var mauiApp = appBuilder.Build();
- var application = mauiApp.Services.GetRequiredService();
- application.Handler = new ApplicationHandlerStub();
- application.Handler.SetMauiContext(new HandlersContextStub(mauiApp.Services));
- }
+ var page = new ContentPage();
- static PopupServiceTests()
- {
- var serviceCollection = new ServiceCollection();
- PopupService.AddTransientPopup(serviceCollection);
+ CreateViewHandler(page);
+
+ Assert.NotNull(Application.Current);
+ Application.Current.Windows[0].Page = page;
}
[Fact]
public async Task ShowPopupAsyncWithNullOnPresentingShouldThrowArgumentNullException()
{
- var popupService = new PopupService(new MockServiceProvider(), new MockDispatcher());
+ var popupService = ServiceProvider.GetRequiredService();
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
await Assert.ThrowsAsync(() =>
@@ -40,13 +33,7 @@ await Assert.ThrowsAsync(() =>
[Fact(Timeout = (int)TestDuration.Short)]
public async Task ShowPopupAsync_CancellationTokenExpired()
{
- var popupViewModel = new MockPageViewModel();
- var popupInstance = new MockSelfClosingPopup(string.Empty)
- {
- BindingContext = popupViewModel
- };
-
- SetupTest(popupInstance, () => popupViewModel, out var popupService);
+ var popupService = ServiceProvider.GetRequiredService();
var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(1));
@@ -59,13 +46,7 @@ public async Task ShowPopupAsync_CancellationTokenExpired()
[Fact(Timeout = (int)TestDuration.Short)]
public async Task ShowPopupAsync_CancellationTokenCanceled()
{
- var popupViewModel = new MockPageViewModel();
- var popupInstance = new MockSelfClosingPopup(string.Empty)
- {
- BindingContext = popupViewModel
- };
-
- SetupTest(popupInstance, () => popupViewModel, out var popupService);
+ var popupService = ServiceProvider.GetRequiredService();
var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(1));
@@ -75,27 +56,12 @@ public async Task ShowPopupAsync_CancellationTokenCanceled()
await Assert.ThrowsAsync(() => popupService.ShowPopupAsync(cts.Token));
}
- [Fact(Timeout = (int)TestDuration.Short)]
- public async Task ShowPopupAsyncShouldThrowInvalidOperationExceptionWhenNoViewModelIsRegistered()
- {
- var popupInstance = new MockMismatchedPopup();
- var popupViewModel = new MockPageViewModel();
-
- SetupTest(popupInstance, () => popupViewModel, out var popupService);
-
- await Assert.ThrowsAsync(() => popupService.ShowPopupAsync(CancellationToken.None));
- }
-
[Fact(Timeout = (int)TestDuration.Medium)]
public async Task ShowPopupAsyncShouldValidateProperBindingContext()
{
- var popupViewModel = new MockPageViewModel();
- var popupInstance = new MockSelfClosingPopup(string.Empty)
- {
- BindingContext = popupViewModel
- };
-
- SetupTest(popupInstance, () => popupViewModel, out var popupService);
+ var popupService = ServiceProvider.GetRequiredService();
+ var popupInstance = ServiceProvider.GetRequiredService();
+ var popupViewModel = ServiceProvider.GetRequiredService();
await popupService.ShowPopupAsync(CancellationToken.None);
@@ -106,12 +72,12 @@ public async Task ShowPopupAsyncShouldValidateProperBindingContext()
public async Task ShowPopupAsyncWithOnPresenting_CancellationTokenExpired()
{
var popupViewModel = new MockPageViewModel();
- var popupInstance = new MockSelfClosingPopup(string.Empty)
+ var popupInstance = new MockSelfClosingPopup(popupViewModel)
{
BindingContext = popupViewModel
};
- SetupTest(popupInstance, () => popupViewModel, out var popupService);
+ var popupService = ServiceProvider.GetRequiredService();
var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(1));
@@ -124,13 +90,7 @@ public async Task ShowPopupAsyncWithOnPresenting_CancellationTokenExpired()
[Fact(Timeout = (int)TestDuration.Short)]
public async Task ShowPopupAsyncWithOnPresenting_CancellationTokenCanceled()
{
- var popupViewModel = new MockPageViewModel();
- var popupInstance = new MockSelfClosingPopup(string.Empty)
- {
- BindingContext = popupViewModel
- };
-
- SetupTest(popupInstance, () => popupViewModel, out var popupService);
+ var popupService = ServiceProvider.GetRequiredService();
var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(1));
@@ -143,13 +103,8 @@ public async Task ShowPopupAsyncWithOnPresenting_CancellationTokenCanceled()
[Fact(Timeout = (int)TestDuration.Medium)]
public async Task ShowPopupAsyncWithOnPresentingShouldBeInvoked()
{
- var popupViewModel = new MockPageViewModel();
- var popupInstance = new MockSelfClosingPopup(string.Empty)
- {
- BindingContext = popupViewModel
- };
-
- SetupTest(popupInstance, () => popupViewModel, out var popupService);
+ var popupService = ServiceProvider.GetRequiredService();
+ var popupViewModel = ServiceProvider.GetRequiredService();
await popupService.ShowPopupAsync(onPresenting: viewModel => viewModel.HasLoaded = true, CancellationToken.None);
@@ -159,145 +114,57 @@ public async Task ShowPopupAsyncWithOnPresentingShouldBeInvoked()
[Fact(Timeout = (int)TestDuration.Medium)]
public async Task ShowPopupAsyncShouldReturnResultOnceClosed()
{
- var expectedResult = new object();
-
- var popupViewModel = new MockPageViewModel();
- var popupInstance = new MockSelfClosingPopup(expectedResult)
- {
- BindingContext = popupViewModel
- };
-
- SetupTest(popupInstance, () => popupViewModel, out var popupService);
+ var mockPopup = ServiceProvider.GetRequiredService();
+ var popupService = ServiceProvider.GetRequiredService();
var result = await popupService.ShowPopupAsync(CancellationToken.None);
- Assert.Same(expectedResult, result);
+ Assert.Same(mockPopup.Result, result);
}
[Fact]
public void ShowPopupWithNullOnPresentingShouldThrowArgumentNullException()
{
- var popupService = new PopupService(new MockServiceProvider(), new MockDispatcher());
+ var popupService = new PopupService(ServiceProvider, new MockDispatcher());
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
Assert.Throws(() => popupService.ShowPopup(onPresenting: null));
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
}
- [Fact]
- public void ShowPopupShouldThrowInvalidOperationExceptionWhenNoViewModelIsRegistered()
- {
- var popupInstance = new MockMismatchedPopup();
- var popupViewModel = new MockPageViewModel();
-
- SetupTest(popupInstance, () => popupViewModel, out var popupService);
-
- Assert.Throws(popupService.ShowPopup);
- }
-
[Fact]
public void ShowPopupWithOnPresentingShouldBeInvoked()
{
- var popupViewModel = new MockPageViewModel();
- var popupInstance = new MockPopup
- {
- BindingContext = popupViewModel
- };
-
- SetupTest(popupInstance, () => popupViewModel, out var popupService);
+ var popupService = ServiceProvider.GetRequiredService();
+ var popupViewModel = ServiceProvider.GetRequiredService();
popupService.ShowPopup(onPresenting: viewModel => viewModel.HasLoaded = true);
Assert.True(popupViewModel.HasLoaded);
}
- static void SetupTest(
- Popup popup,
- Func createViewModelInstance,
- out IPopupService popupService)
+ sealed class UnregisteredViewModel : INotifyPropertyChanged
{
- popupService = new PopupService(
- MockServiceProvider.ThatProvides(
- (implementation: popup, forType: typeof(MockPopup)),
- (implementation: createViewModelInstance.Invoke(), forType: typeof(MockPageViewModel))),
- new MockDispatcher());
-
- var app = Application.Current ?? throw new NullReferenceException();
-
- var page = new ContentPage
- {
- Content = new Label
- {
- Text = "Hello there"
- }
- };
-
- // Make sure that our page will have a Handler
- CreateViewHandler(page);
-
- app.MainPage = page;
-
- CreateElementHandler(popup);
-
- Assert.NotNull(popup.Handler);
- Assert.NotNull(page.Handler);
+ public event PropertyChangedEventHandler? PropertyChanged;
}
+}
- class MockServiceProvider : IServiceProvider
+sealed class MockSelfClosingPopup : Popup
+{
+ public MockSelfClosingPopup(MockPageViewModel viewModel, object? result = null)
{
- readonly IDictionary registrations = new Dictionary();
-
- public MockServiceProvider()
- {
- }
-
- MockServiceProvider(params (object implementation, Type forType)[] registrations) : this()
- {
- foreach (var (implementation, forType) in registrations)
- {
- this.registrations.Add(forType, implementation);
- }
- }
-
- public static MockServiceProvider ThatProvides(params (object implementation, Type forType)[] registrations)
- {
- return new MockServiceProvider(registrations);
- }
-
- public object? GetService(Type serviceType)
- {
- if (registrations.TryGetValue(serviceType, out var registeredImplementation))
- {
- return registeredImplementation;
- }
-
- return null;
- }
+ BindingContext = viewModel;
+ Result = result;
}
- sealed class MockPopup : Popup
- {
- }
+ public new object? Result { get; }
- sealed class MockSelfClosingPopup(object result) : Popup
+ internal override async void OnOpened()
{
- readonly object result = result;
-
- internal override async void OnOpened()
- {
- base.OnOpened();
-
- await Task.Delay(TimeSpan.FromMilliseconds(500));
+ base.OnOpened();
- Close(result);
- }
- }
+ await Task.Delay(TimeSpan.FromMilliseconds(500));
- sealed class MockMismatchedPopup : Popup
- {
- public MockMismatchedPopup()
- {
- BindingContext = new object();
- }
+ Close(Result);
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/PopupService.cs b/src/CommunityToolkit.Maui/PopupService.cs
index 632a98d535..00c9ad7f02 100644
--- a/src/CommunityToolkit.Maui/PopupService.cs
+++ b/src/CommunityToolkit.Maui/PopupService.cs
@@ -10,18 +10,10 @@ namespace CommunityToolkit.Maui;
///
public class PopupService : IPopupService
{
- readonly IServiceProvider serviceProvider;
- readonly IDispatcher dispatcher;
static readonly Dictionary viewModelToViewMappings = [];
- ///
- /// Gets or sets the implementation.
- ///
- public IPopupLifecycleController PopupLifecycleController { get; set; } = new PopupLifecycleController();
-
- static Page CurrentPage =>
- PageExtensions.GetCurrentPage(
- Application.Current?.Windows[0].Page ?? throw new InvalidOperationException("Application.Current?.Windows[0].Page cannot be null."));
+ readonly IServiceProvider serviceProvider;
+ readonly IDispatcher dispatcher;
///
/// Creates a new instance of .
@@ -41,12 +33,23 @@ public PopupService(IServiceProvider serviceProvider, IDispatcher dispatcher)
public PopupService()
{
serviceProvider = Application.Current?.Handler?.MauiContext?.Services
- ?? throw new InvalidOperationException("Could not locate IServiceProvider");
+ ?? throw new InvalidOperationException("Could not locate IServiceProvider");
- dispatcher = Application.Current?.Dispatcher
- ?? throw new InvalidOperationException("Could not locate IDispatcher");
+ dispatcher = Application.Current.Dispatcher
+ ?? throw new InvalidOperationException("Could not locate IDispatcher");
}
+ ///
+ /// Gets or sets the implementation.
+ ///
+ public IPopupLifecycleController PopupLifecycleController { get; set; } = new PopupLifecycleController();
+
+ static Page CurrentPage =>
+ PageExtensions.GetCurrentPage(
+ Application.Current?.Windows[0].Page ?? throw new InvalidOperationException("Application.Current?.Windows[0].Page cannot be null."));
+
+ internal static void ClearViewModelToViewMappings() => viewModelToViewMappings.Clear();
+
internal static void AddTransientPopup<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TPopupView, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TPopupViewModel>(IServiceCollection services)
where TPopupView : IPopup
where TPopupViewModel : INotifyPropertyChanged
@@ -57,12 +60,22 @@ public PopupService()
services.AddTransient(typeof(TPopupViewModel));
}
+ internal static void AddTransientPopup<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TPopupView, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TPopupViewModel>(TPopupView popup, TPopupViewModel popupViewModel, IServiceCollection services)
+ where TPopupView : class, IPopup
+ where TPopupViewModel : class, INotifyPropertyChanged
+ {
+ viewModelToViewMappings.Add(typeof(TPopupViewModel), typeof(TPopupView));
+
+ services.AddTransient(_ => popup);
+ services.AddTransient(_ => popupViewModel);
+ }
+
///
public void ClosePopup(object? result = null)
{
EnsureMainThreadIsUsed();
- this.PopupLifecycleController.GetCurrentPopup()?.Close(result);
+ PopupLifecycleController.GetCurrentPopup()?.Close(result);
}
///
@@ -70,14 +83,9 @@ public Task ClosePopupAsync(object? result = null)
{
EnsureMainThreadIsUsed();
- var popup = this.PopupLifecycleController.GetCurrentPopup();
-
- if (popup is not null)
- {
- return popup.CloseAsync(result);
- }
+ var popup = PopupLifecycleController.GetCurrentPopup();
- return Task.CompletedTask;
+ return popup?.CloseAsync(result) ?? Task.CompletedTask;
}
///
@@ -202,7 +210,7 @@ static void ShowPopup(Popup popup)
void EnsureMainThreadIsUsed([CallerMemberName] string? callerName = default)
{
- if (this.dispatcher.IsDispatchRequired)
+ if (dispatcher.IsDispatchRequired)
{
throw new InvalidOperationException($"{callerName} must be called from the main thread.");
}
@@ -217,6 +225,6 @@ Popup GetPopup(Type viewModelType)
void InitializePopup(Popup popup)
{
- this.PopupLifecycleController.OnShowPopup(popup);
+ PopupLifecycleController.OnShowPopup(popup);
}
}
\ No newline at end of file
From 8bfc3139f9ba367f3612a5bb30e915613bb1681e Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Thu, 31 Oct 2024 12:16:43 -0700
Subject: [PATCH 066/171] Fix AvatarView Tests
---
.../Mocks/MockViewHandler.cs | 30 +++++++++++++++++++
.../Views/AvatarView/AvatarViewTests.cs | 2 ++
2 files changed, 32 insertions(+)
create mode 100644 src/CommunityToolkit.Maui.UnitTests/Mocks/MockViewHandler.cs
diff --git a/src/CommunityToolkit.Maui.UnitTests/Mocks/MockViewHandler.cs b/src/CommunityToolkit.Maui.UnitTests/Mocks/MockViewHandler.cs
new file mode 100644
index 0000000000..5feef4b765
--- /dev/null
+++ b/src/CommunityToolkit.Maui.UnitTests/Mocks/MockViewHandler.cs
@@ -0,0 +1,30 @@
+using CommunityToolkit.Maui.Core;
+using CommunityToolkit.Maui.Views;
+using Microsoft.Maui.Handlers;
+namespace CommunityToolkit.Maui.UnitTests.Mocks;
+
+public class MockAvatarViewHandler(IPropertyMapper mapper) : ViewHandler(mapper), IBorderHandler
+{
+ readonly AvatarView avatarView = new();
+
+ public MockAvatarViewHandler() : this(new PropertyMapper())
+ {
+
+ }
+
+ protected override AvatarView CreatePlatformView() => avatarView;
+
+ public new AvatarView PlatformView => avatarView;
+ public new AvatarView VirtualView => (AvatarView)base.VirtualView;
+
+ public override Size GetDesiredSize(double widthConstraint, double heightConstraint)
+ {
+ var width = VirtualView.WidthRequest <= widthConstraint ? VirtualView.WidthRequest : widthConstraint;
+ var height = VirtualView.HeightRequest <= heightConstraint ? VirtualView.HeightRequest : heightConstraint;
+
+ return new Size(width, height);
+ }
+
+ object IBorderHandler.PlatformView => PlatformView;
+ IBorderView IBorderHandler.VirtualView => base.VirtualView;
+}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs
index 81ec646cf7..959e6bfb35 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs
@@ -102,6 +102,8 @@ public void ConstructorTest()
HeightRequest = 20,
};
+ CreateViewHandler(avatarView);
+
avatarView.BorderColor.Should().Be(Colors.Beige);
avatarView.BorderWidth.Should().Be(2);
avatarView.CornerRadius.Should().Be(new CornerRadius(4, 8, 12, 16));
From 813c143cb15c77826335f6101bacca02ac3f8731 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Thu, 31 Oct 2024 12:24:50 -0700
Subject: [PATCH 067/171] Fix AvatarView Tests
---
.../Mocks/FontElementHandlerStub.cs | 29 -------------------
.../AvatarView/AvatarViewInterfaceTests.cs | 15 ----------
.../Views/AvatarView/AvatarViewTests.cs | 22 +++-----------
3 files changed, 4 insertions(+), 62 deletions(-)
delete mode 100644 src/CommunityToolkit.Maui.UnitTests/Mocks/FontElementHandlerStub.cs
diff --git a/src/CommunityToolkit.Maui.UnitTests/Mocks/FontElementHandlerStub.cs b/src/CommunityToolkit.Maui.UnitTests/Mocks/FontElementHandlerStub.cs
deleted file mode 100644
index f69909c276..0000000000
--- a/src/CommunityToolkit.Maui.UnitTests/Mocks/FontElementHandlerStub.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace CommunityToolkit.Maui.UnitTests.Mocks;
-
-using System.Collections.Generic;
-using Microsoft.Maui.Controls.Internals;
-using Microsoft.Maui.Handlers;
-
-public class FontElementHandlerStub : ViewHandler
-{
- public static readonly IPropertyMapper Mapper =
- new PropertyMapper
- {
- [nameof(IFontElement.FontAttributes)] = (h, v) => h.MapProperty(nameof(IFontElement.FontAttributes)),
- [nameof(IFontElement.FontAutoScalingEnabled)] = (h, v) => h.MapProperty(nameof(IFontElement.FontAutoScalingEnabled)),
- [nameof(IFontElement.FontFamily)] = (h, v) => h.MapProperty(nameof(IFontElement.FontFamily)),
- [nameof(IFontElement.FontSize)] = (h, v) => h.MapProperty(nameof(IFontElement.FontSize)),
- [nameof(ITextStyle.Font)] = (h, v) => h.MapProperty(nameof(ITextStyle.Font)),
- };
-
- public FontElementHandlerStub()
- : base(Mapper)
- {
- }
-
- public List Updates { get; set; } = [];
-
- protected override object CreatePlatformView() => new object();
-
- void MapProperty(string propertyName) => Updates.Add(propertyName);
-}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewInterfaceTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewInterfaceTests.cs
index f6faecaddf..cdf97fd512 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewInterfaceTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewInterfaceTests.cs
@@ -292,21 +292,6 @@ public void ITextElementUpdateFormsText()
avatarView.Text.Should().Be("?");
}
- [Fact]
- public void IImageSourcePartUpdateIsLoading()
- {
- // For code coverage
- var handler = new FontElementHandlerStub();
- var avatarView = new Maui.Views.AvatarView()
- {
- Handler = handler
- };
- handler.Updates.Clear();
- ((IImageSourcePart)avatarView).UpdateIsLoading(true);
- ((IImageSourcePart)avatarView).UpdateIsLoading(false);
- avatarView.Text.Should().Be("?");
- }
-
[Fact]
public void ILineHeightElementOnLineHeightChanged()
{
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs
index 959e6bfb35..6067c1b6ac 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs
@@ -193,6 +193,8 @@ public void DefaultFontSize()
public void DefaultHeightRequest()
{
var avatarView = new Maui.Views.AvatarView();
+ CreateViewHandler(avatarView);
+
Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity);
request.Height.Should().Be(AvatarViewDefaults.DefaultHeightRequest);
}
@@ -230,6 +232,8 @@ public void DefaultProperties()
public void DefaultWidthRequest()
{
var avatarView = new Maui.Views.AvatarView();
+ CreateViewHandler(avatarView);
+
Size request = avatarView.Measure(double.PositiveInfinity, double.PositiveInfinity);
request.Width.Should().Be(AvatarViewDefaults.DefaultWidthRequest);
}
@@ -261,24 +265,6 @@ public void FontFamilyPropertyChanged()
avatarView.FontFamily.Should().Be("Arial");
}
- [Theory]
- [InlineData(nameof(IFontElement.FontAttributes), FontAttributes.Bold)]
- [InlineData(nameof(IFontElement.FontAutoScalingEnabled), false)]
- [InlineData(nameof(IFontElement.FontFamily), "Arial")]
- [InlineData(nameof(IFontElement.FontSize), 10)]
- public void FontPropertyTriggersFontProperty(string propertyName, object value)
- {
- var handler = new FontElementHandlerStub();
- var avatarView = new Maui.Views.AvatarView()
- {
- Handler = handler
- };
- handler.Updates.Clear();
- avatarView.GetType().GetProperty(propertyName)?.SetValue(avatarView, value, null);
- handler.Updates.Should().HaveCount(2);
- Assert.Equal(new[] { propertyName, nameof(ITextStyle.Font) }, handler.Updates);
- }
-
[Fact]
public void TextColorToYellow()
{
From 43ffcdb3cc2c34bdcd9bd8a217ae79a732d5d68a Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Thu, 31 Oct 2024 12:25:20 -0700
Subject: [PATCH 068/171] Fix ParentWindowTests
---
.../Views/MediaElement/ParentWindowTests.cs | 38 +++++++------------
1 file changed, 14 insertions(+), 24 deletions(-)
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/MediaElement/ParentWindowTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/MediaElement/ParentWindowTests.cs
index 4d222c0589..7770c2261a 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/MediaElement/ParentWindowTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/MediaElement/ParentWindowTests.cs
@@ -7,26 +7,12 @@ namespace CommunityToolkit.Maui.UnitTests.Views;
public class ParentWindowTests : BaseHandlerTest
{
- Application application { get; }
- public ParentWindowTests()
- {
- var appBuilder = MauiApp.CreateBuilder()
- .UseMauiCommunityToolkit()
- .UseMauiApp();
-
- var mauiApp = appBuilder.Build();
-
- var Application = mauiApp.Services.GetRequiredService();
- application = (Application)Application;
- IPlatformApplication.Current = (IPlatformApplication)application;
-
- application.Handler = new ApplicationHandlerStub();
- application.Handler.SetMauiContext(new HandlersContextStub(mauiApp.Services));
- }
[Fact]
public void Exists_WhenParentWindowIsNull_ReturnsFalse()
{
- application.MainPage = new ContentPage();
+ Assert.NotNull(Application.Current);
+
+ Application.Current.Windows[0].Page = new ContentPage();
Assert.False(ParentWindow.Exists);
}
@@ -34,10 +20,12 @@ public void Exists_WhenParentWindowIsNull_ReturnsFalse()
[Fact]
public void Exists_WhenParentWindowHandlerIsNull_ReturnsFalse()
{
+ Assert.NotNull(Application.Current);
+
var mockWindow = new Window();
var mockPage = new ContentPage();
mockWindow.Page = mockPage;
- application.MainPage = mockPage;
+ Application.Current.Windows[0].Page = mockPage;
Assert.False(ParentWindow.Exists);
}
@@ -45,10 +33,12 @@ public void Exists_WhenParentWindowHandlerIsNull_ReturnsFalse()
[Fact]
public void Exists_WhenParentWindowHandlerPlatformViewIsNull_ReturnsFalse()
{
+ Assert.NotNull(Application.Current);
+
var mockWindow = new Window();
var mockPage = new ContentPage();
mockWindow.Page = mockPage;
- application.MainPage = mockPage;
+ Application.Current.Windows[0].Page = mockPage;
// Simulate a scenario where the handler is set but the platform view is null
mockWindow.Handler = new MockWindowHandler();
@@ -59,13 +49,13 @@ public void Exists_WhenParentWindowHandlerPlatformViewIsNull_ReturnsFalse()
[Fact]
public void Exists_WhenAllConditionsAreMet_ReturnsTrue()
{
- var mockWindow = new Window();
- var mockPage = new ContentPage();
- mockWindow.Page = mockPage;
- application.MainPage = mockPage;
+ Assert.NotNull(Application.Current);
+
+ var window = Application.Current.Windows[0];
+ Application.Current.Windows[0].Page = new ContentPage();
// Simulate a scenario where all conditions are met
- mockWindow.Handler = new MockWindowHandler { PlatformView = new object() };
+ window.Handler = new MockWindowHandler { PlatformView = new object() };
Assert.True(ParentWindow.Exists);
}
From 3c1acca71f8c21b6d913e7c464dc43e4a9185b62 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Thu, 31 Oct 2024 12:37:14 -0700
Subject: [PATCH 069/171] Resolve AppTheme Tests
---
.../Essentials/AppThemeTests.cs | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/CommunityToolkit.Maui.UnitTests/Essentials/AppThemeTests.cs b/src/CommunityToolkit.Maui.UnitTests/Essentials/AppThemeTests.cs
index 5396cbb2c8..8f9a31aba8 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Essentials/AppThemeTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Essentials/AppThemeTests.cs
@@ -19,12 +19,10 @@ public AppThemeTests()
ArgumentNullException.ThrowIfNull(Application.Current);
- Application.Current.ActivateWindow(new Window(new MockShell([
- new ContentPage
- {
- Content = label
- }
- ])));
+ Application.Current.Windows[0].Page = new ContentPage
+ {
+ Content = label
+ };
SetAppTheme(initialAppTheme, Application.Current);
@@ -61,7 +59,7 @@ public void AppThemeColorUsesDefaultColorWhenDarkColorNotSet()
Light = Colors.Green,
Default = Colors.Blue
};
-
+
label.SetAppThemeColor(Label.TextColorProperty, color);
Assert.Equal(Colors.Green, label.TextColor);
From d2b9d8b9e151e71317cadfd56de17424d78c69a1 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Fri, 1 Nov 2024 11:46:30 -0700
Subject: [PATCH 070/171] Add `[RequiresUnreferencedCode]` attribute to
`ValidationBehavior`
---
.../CharactersValidationBehavior.shared.cs | 4 ++-
.../EmailValidationBehavior.shared.cs | 4 ++-
.../MultiValidationBehavior.shared.cs | 2 ++
.../NumericValidationBehavior.shared.cs | 11 ++++----
...RequiredStringValidationBehavior.shared.cs | 4 ++-
.../TextValidationBehavior.shared.cs | 1 +
.../UriValidationBehavior.shared.cs | 4 ++-
.../Validators/ValidationBehavior.shared.cs | 26 ++++++++++---------
8 files changed, 35 insertions(+), 21 deletions(-)
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/CharactersValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/CharactersValidationBehavior.shared.cs
index 2006caaee5..8d4f60cd31 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/CharactersValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/CharactersValidationBehavior.shared.cs
@@ -1,4 +1,5 @@
-namespace CommunityToolkit.Maui.Behaviors;
+using System.Diagnostics.CodeAnalysis;
+namespace CommunityToolkit.Maui.Behaviors;
/// The allowed character types used to determine if a value is valid in the . Since this is a flag, multiple flags cane be combined.
[Flags]
@@ -41,6 +42,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 .
///
+[RequiresUnreferencedCode($"{nameof(CharactersValidationBehavior)} is not trim safe because it uses bindings with string paths.")]
public partial class CharactersValidationBehavior : TextValidationBehavior
{
List> characterPredicates = Enumerable.Empty>().ToList();
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/EmailValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/EmailValidationBehavior.shared.cs
index 43054e4b7d..aa3d738d39 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/EmailValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/EmailValidationBehavior.shared.cs
@@ -1,4 +1,5 @@
-using System.Globalization;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
using System.Net;
using System.Net.Mail;
using System.Text.RegularExpressions;
@@ -11,6 +12,7 @@ namespace CommunityToolkit.Maui.Behaviors;
/// The validation is achieved through a regular expression that is used to verify whether or not the text input is a valid e-mail address.
/// It can be overridden to customize the validation through the properties it inherits from .
///
+[RequiresUnreferencedCode($"{nameof(EmailValidationBehavior)} is not trim safe because it uses bindings with string paths.")]
public partial class EmailValidationBehavior : TextValidationBehavior
{
///
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs
index 832c5fd3ad..0cf3e03815 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs
@@ -1,12 +1,14 @@
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
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 .
///
+[RequiresUnreferencedCode($"{nameof(MultiValidationBehavior)} is not trim safe because it uses bindings with string paths.")]
[ContentProperty(nameof(Children))]
public partial class MultiValidationBehavior : ValidationBehavior
{
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs
index f5b525e24c..1e1fcd035f 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs
@@ -1,10 +1,11 @@
-using System.Globalization;
-
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
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 .
///
+[RequiresUnreferencedCode($"{nameof(NumericValidationBehavior)} is not trim safe because it uses bindings with string paths.")]
public partial class NumericValidationBehavior : ValidationBehavior
{
///
@@ -77,13 +78,13 @@ protected override ValueTask ValidateAsync(string? value, CancellationToke
ArgumentNullException.ThrowIfNull(value);
if (!(double.TryParse(value, out var numeric)
- && numeric >= MinimumValue
- && numeric <= MaximumValue))
+ && numeric >= MinimumValue
+ && numeric <= MaximumValue))
{
return new ValueTask(false);
}
- var decimalDelimiterIndex = value.IndexOf(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);
+ var decimalDelimiterIndex = value.IndexOf(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator, StringComparison.Ordinal);
var hasDecimalDelimiter = decimalDelimiterIndex >= 0;
// If MaximumDecimalPlaces equals zero, ".5" or "14." should be considered as invalid inputs.
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/RequiredStringValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/RequiredStringValidationBehavior.shared.cs
index a218feb348..307decbf3b 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/RequiredStringValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/RequiredStringValidationBehavior.shared.cs
@@ -1,8 +1,10 @@
-namespace CommunityToolkit.Maui.Behaviors;
+using System.Diagnostics.CodeAnalysis;
+namespace CommunityToolkit.Maui.Behaviors;
///
/// 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 .
///
+[RequiresUnreferencedCode($"{nameof(RequiredStringValidationBehavior)} is not trim safe because it uses bindings with string paths.")]
public partial class RequiredStringValidationBehavior : ValidationBehavior
{
///
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs
index cc26db84d3..0ec6a9f874 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs
@@ -25,6 +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 .
///
+[RequiresUnreferencedCode($"{nameof(TextValidationBehavior)} is not trim safe because it uses bindings with string paths.")]
public partial class TextValidationBehavior : ValidationBehavior
{
///
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/UriValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/UriValidationBehavior.shared.cs
index efbf86303c..409ff43f01 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/UriValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/UriValidationBehavior.shared.cs
@@ -1,8 +1,10 @@
-namespace CommunityToolkit.Maui.Behaviors;
+using System.Diagnostics.CodeAnalysis;
+namespace CommunityToolkit.Maui.Behaviors;
///
/// 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 .
///
+[RequiresUnreferencedCode($"{nameof(UriValidationBehavior)} is not trim safe because it uses bindings with string paths.")]
public partial class UriValidationBehavior : TextValidationBehavior
{
///
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs
index b5d353c24c..47eeacdd4d 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs
@@ -1,5 +1,6 @@
using System.ComponentModel;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Windows.Input;
namespace CommunityToolkit.Maui.Behaviors;
@@ -13,9 +14,9 @@ public enum ValidationFlags
/// Validate on attaching
ValidateOnAttaching = 1,
/// Validate on focusing
- ValidateOnFocusing = 2,
- /// Validate on unfocusing
- ValidateOnUnfocusing = 4,
+ ValidateOnFocus = 2,
+ /// Validate on unfocus
+ ValidateOnUnfocus = 4,
/// Validate upon value changed
ValidateOnValueChanged = 8,
/// Force make valid when focused
@@ -23,8 +24,9 @@ public enum ValidationFlags
}
///
-/// The allows users to create custom validation behaviors. All of the validation behaviors in the Xamarin Community Toolkit inherit from this behavior, to expose a number of shared properties. Users can inherit from this class to create a custom validation behavior currently not supported through the Xamarin Community Toolkit. This behavios cannot be used directly as it's abstract.
+/// The allows users to create custom validation behaviors. All the validation behaviors in the Xamarin Community Toolkit inherit from this behavior, to expose a number of shared properties. Users can inherit from this class to create a custom validation behavior currently not supported through the Xamarin Community Toolkit. This behavios cannot be used directly as it's abstract.
///
+[RequiresUnreferencedCode($"{nameof(ValidationBehavior)} is not trim safe because it uses bindings with string paths.")]
public abstract class ValidationBehavior : BaseBehavior, IDisposable
{
///
@@ -71,7 +73,7 @@ public abstract class ValidationBehavior : BaseBehavior, IDisposa
/// Backing BindableProperty for the property.
///
public static readonly BindableProperty FlagsProperty =
- BindableProperty.Create(nameof(Flags), typeof(ValidationFlags), typeof(ValidationBehavior), ValidationFlags.ValidateOnUnfocusing | ValidationFlags.ForceMakeValidWhenFocused, propertyChanged: OnValidationPropertyChanged);
+ BindableProperty.Create(nameof(Flags), typeof(ValidationFlags), typeof(ValidationBehavior), ValidationFlags.ValidateOnUnfocus | ValidationFlags.ForceMakeValidWhenFocused, propertyChanged: OnValidationPropertyChanged);
///
/// Backing BindableProperty for the property.
@@ -116,7 +118,7 @@ protected ValidationBehavior()
}
///
- /// Indicates whether or not the current value is considered valid. This is a bindable property.
+ /// Indicates whether the current value is considered valid. This is a bindable property.
///
public bool IsValid
{
@@ -125,7 +127,7 @@ public bool IsValid
}
///
- /// Indicates whether or not the validation is in progress now (waiting for an asynchronous call is finished).
+ /// Indicates whether the validation is in progress now (waiting for an asynchronous call is finished).
///
public bool IsRunning
{
@@ -134,7 +136,7 @@ public bool IsRunning
}
///
- /// Indicates whether or not the current value is considered not valid. This is a bindable property.
+ /// Indicates whether the current value is considered not valid. This is a bindable property.
///
public bool IsNotValid
{
@@ -290,8 +292,8 @@ protected override async void OnViewPropertyChanged(VisualElement sender, Proper
{
currentStatus = sender.IsFocused switch
{
- true => ValidationFlags.ValidateOnFocusing,
- false => ValidationFlags.ValidateOnUnfocusing
+ true => ValidationFlags.ValidateOnFocus,
+ false => ValidationFlags.ValidateOnUnfocus
};
await UpdateStateAsync(View, Flags, false).ConfigureAwait(false);
@@ -319,6 +321,7 @@ static async void OnValuePropertyChanged(BindableObject bindable, object oldValu
OnValidationPropertyChanged(bindable, oldValue, newValue);
}
+ [RequiresUnreferencedCode($"{nameof(ValidationBehavior)} is not trim safe because it uses bindings with string paths.")]
static void OnValuePropertyNamePropertyChanged(BindableObject bindable, object oldValue, object newValue)
=> ((ValidationBehavior)bindable).OnValuePropertyNamePropertyChanged();
@@ -346,13 +349,11 @@ 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)
@@ -424,6 +425,7 @@ void ResetValidationTokenSource(CancellationTokenSource? newTokenSource)
}
///
+[RequiresUnreferencedCode($"{nameof(ValidationBehavior)} is not trim safe because it uses bindings with string paths.")]
public abstract class ValidationBehavior : ValidationBehavior
{
///
From bb3617236440536c01209f762ad388d9157b7c12 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Fri, 1 Nov 2024 13:52:49 -0700
Subject: [PATCH 071/171] Update BehaviorsGalleryPage.cs
---
.../Pages/Behaviors/BehaviorsGalleryPage.cs | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/BehaviorsGalleryPage.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/BehaviorsGalleryPage.cs
index ceb91de147..7201b6b077 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/BehaviorsGalleryPage.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/BehaviorsGalleryPage.cs
@@ -1,6 +1,4 @@
-using CommunityToolkit.Maui.Behaviors;
-using CommunityToolkit.Maui.Markup;
-using CommunityToolkit.Maui.Sample.ViewModels.Behaviors;
+using CommunityToolkit.Maui.Sample.ViewModels.Behaviors;
namespace CommunityToolkit.Maui.Sample.Pages.Behaviors;
@@ -12,17 +10,17 @@ public BehaviorsGalleryPage(IDeviceInfo deviceInfo, BehaviorsGalleryViewModel be
#if ANDROID || IOS
AddStatusBarBehavior();
#endif
-
- new Image().Source("");
}
+#if ANDROID || IOS
void AddStatusBarBehavior()
{
- Behaviors.Add(new StatusBarBehavior
+ Behaviors.Add(new CommunityToolkit.Maui.Behaviors.StatusBarBehavior
{
StatusBarColor = Color.FromRgb(25, 118, 210),
StatusBarStyle = Core.StatusBarStyle.LightContent,
- ApplyOn = StatusBarApplyOn.OnPageNavigatedTo,
+ ApplyOn = CommunityToolkit.Maui.Behaviors.StatusBarApplyOn.OnPageNavigatedTo,
});
}
+#endif
}
\ No newline at end of file
From c762fb23b81bb16c4c21f16caeef100c8d32fd21 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Fri, 1 Nov 2024 13:53:56 -0700
Subject: [PATCH 072/171] `dotnet format`
---
.../Views/Popups/TransparentPopupCSharp.cs | 8 ++--
.../Extensions/PageExtensions.cs | 2 +-
.../Services/MediaControlsService.android.cs | 4 ++
.../Views/MauiMediaElement.android.cs | 4 ++
.../Views/MediaManager.android.cs | 47 +++++++++++++++++++
.../Views/MediaManager.shared.cs | 1 +
.../Behaviors/BaseBehaviorTest.cs | 4 +-
.../Behaviors/MaskedBehaviorTests.cs | 1 +
.../MaxLengthReachedBehaviorTests.cs | 1 +
.../SetFocusOnEntryCompletedTests.cs | 1 +
.../UserStoppedTypingBehaviorTests.cs | 1 +
.../Views/Popup/PopupTests.cs | 9 ++++
.../Validators/ValidationBehavior.shared.cs | 2 +-
.../Converters/BaseConverter.shared.cs | 8 ++--
.../Converters/CompareConverter.shared.cs | 1 -
.../DateTimeOffsetConverter.shared.cs | 2 -
.../Converters/EnumToIntConverter.shared.cs | 1 -
.../StateToBooleanConverter.shared.cs | 1 -
.../TimeSpanToSecondsConverter.shared.cs | 2 -
.../GravatarImageSource.shared.cs | 6 +--
src/CommunityToolkit.Maui/PopupService.cs | 8 ++--
.../Views/Popup/PopupExtensions.windows.cs | 2 +-
22 files changed, 89 insertions(+), 27 deletions(-)
diff --git a/samples/CommunityToolkit.Maui.Sample/Views/Popups/TransparentPopupCSharp.cs b/samples/CommunityToolkit.Maui.Sample/Views/Popups/TransparentPopupCSharp.cs
index 545fd88a37..4fca5d6474 100644
--- a/samples/CommunityToolkit.Maui.Sample/Views/Popups/TransparentPopupCSharp.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Views/Popups/TransparentPopupCSharp.cs
@@ -15,12 +15,12 @@ public TransparentPopupCSharp(Size popupSize) : this()
public TransparentPopupCSharp()
{
Content = new Border
+ {
+ StrokeShape = new RoundRectangle
{
- StrokeShape = new RoundRectangle
- {
- CornerRadius = 25
- }
+ CornerRadius = 25
}
+ }
.Size(50, 50)
.Margin(10);
}
diff --git a/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs b/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs
index 78d1905594..62db610fc3 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Extensions/PageExtensions.cs
@@ -47,7 +47,7 @@ public static bool Exists
{
return false;
}
-
+
return CurrentPage.GetParentWindow().Handler?.PlatformView is not null;
}
}
diff --git a/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs b/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
index 2097ea7db6..8ee65dfbbf 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
@@ -75,6 +75,7 @@ static void CreateNotificationChannel(NotificationManager notificationMnaManager
[MemberNotNull(nameof(mediaSession))]
[MemberNotNull(nameof(token))]
[MemberNotNull(nameof(receiveUpdates))]
+ [Obsolete]
ValueTask StartForegroundService(Intent mediaManagerIntent, CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(mediaManagerIntent);
@@ -222,6 +223,8 @@ public override void OnDestroy()
Platform.CurrentActivity?.StopService(new Intent(Platform.AppContext, typeof(MediaControlsService)));
base.OnDestroy();
}
+
+ [Obsolete]
static void BroadcastUpdate(string receiver, string action)
{
if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu)
@@ -233,6 +236,7 @@ static void BroadcastUpdate(string receiver, string action)
LocalBroadcastManager.GetInstance(Platform.AppContext).SendBroadcast(intent);
}
+ [Obsolete]
protected override void Dispose(bool disposing)
{
if (!isDisposed)
diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
index 011d1d9827..686af10d90 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
@@ -15,6 +15,7 @@ namespace CommunityToolkit.Maui.Core.Views;
///
public class MauiMediaElement : CoordinatorLayout
{
+ [Obsolete]
readonly StyledPlayerView playerView;
int defaultSystemUiVisibility;
bool isSystemBarVisible;
@@ -35,6 +36,7 @@ public MauiMediaElement(nint ptr, JniHandleOwnership jni) : base(Platform.AppCon
///
/// The application's .
/// The that acts as the platform media player.
+ [Obsolete]
public MauiMediaElement(Context context, StyledPlayerView playerView) : base(context)
{
this.playerView = playerView;
@@ -55,6 +57,7 @@ public MauiMediaElement(Context context, StyledPlayerView playerView) : base(con
AddView(relativeLayout);
}
+ [Obsolete]
public override void OnDetachedFromWindow()
{
if (isFullScreen)
@@ -102,6 +105,7 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}
+ [Obsolete]
void OnFullscreenButtonClick(object? sender, StyledPlayerView.FullscreenButtonClickEventArgs e)
{
// Ensure there is a player view
diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs
index 39be2d58ee..196beada9b 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs
@@ -24,6 +24,7 @@
namespace CommunityToolkit.Maui.Core.Views;
+[Obsolete]
public partial class MediaManager : Java.Lang.Object, IPlayer.IListener
{
static readonly HttpClient client = new();
@@ -37,6 +38,7 @@ public partial class MediaManager : Java.Lang.Object, IPlayer.IListener
float volumeBeforeMute = 1;
MediaControllerCompat? mediaControllerCompat;
TaskCompletionSource? seekToTaskCompletionSource;
+ [Obsolete]
MediaSessionConnector? mediaSessionConnector;
MediaSessionCompat? mediaSession;
UIUpdateReceiver? uiUpdateReceiver;
@@ -45,6 +47,7 @@ public partial class MediaManager : Java.Lang.Object, IPlayer.IListener
///
/// The platform native counterpart of .
///
+ [Obsolete]
protected StyledPlayerView? PlayerView { get; set; }
///
@@ -89,6 +92,7 @@ public partial class MediaManager : Java.Lang.Object, IPlayer.IListener
/// This is part of the implementation.
/// While this method does not seem to have any references, it's invoked at runtime.
///
+ [Obsolete]
public void OnPlaybackParametersChanged(PlaybackParameters? playbackParameters)
{
if (playbackParameters is null || AreFloatingPointNumbersEqual(playbackParameters.Speed, MediaElement.Speed))
@@ -108,6 +112,7 @@ public void OnPlaybackParametersChanged(PlaybackParameters? playbackParameters)
/// This is part of the implementation.
/// While this method does not seem to have any references, it's invoked at runtime.
///
+ [Obsolete]
public async void OnPlayerStateChanged(bool playWhenReady, int playbackState)
{
if (Player is null || MediaElement.Source is null)
@@ -185,6 +190,7 @@ or PlaybackStateCompat.StateSkippingToQueueItem
[MemberNotNull(nameof(checkPermissionsTask))]
[MemberNotNull(nameof(mediaSessionConnector))]
[MemberNotNull(nameof(mediaControllerCompat))]
+ [Obsolete]
public (PlatformMediaElement platformView, StyledPlayerView PlayerView) CreatePlatformView()
{
ArgumentNullException.ThrowIfNull(MauiContext.Context);
@@ -212,6 +218,7 @@ or PlaybackStateCompat.StateSkippingToQueueItem
/// This is part of the implementation.
/// While this method does not seem to have any references, it's invoked at runtime.
///
+ [Obsolete]
public void OnPlaybackStateChanged(int playbackState)
{
if (MediaElement.Source is null)
@@ -246,6 +253,7 @@ public void OnPlaybackStateChanged(int playbackState)
/// This is part of the implementation.
/// While this method does not seem to have any references, it's invoked at runtime.
///
+ [Obsolete]
public void OnPlayerError(PlaybackException? error)
{
var errorMessage = string.Empty;
@@ -339,6 +347,7 @@ protected virtual partial void PlatformPause()
BroadcastUpdate(MediaControlsService.ACTION_PAUSE);
}
+ [Obsolete]
protected virtual async partial Task PlatformSeek(TimeSpan position, CancellationToken token)
{
if (Player is null)
@@ -379,6 +388,7 @@ protected virtual partial void PlatformStop()
MediaElement.Position = TimeSpan.Zero;
}
+ [Obsolete]
protected virtual partial void PlatformUpdateSource()
{
var hasSetSource = false;
@@ -448,6 +458,7 @@ protected virtual partial void PlatformUpdateSource()
}
}
+ [Obsolete]
protected virtual partial void PlatformUpdateAspect()
{
if (PlayerView is null)
@@ -564,6 +575,7 @@ protected virtual partial void PlatformUpdateShouldMute()
Player.Volume = MediaElement.ShouldMute ? 0 : volumeBeforeMute;
}
+ [Obsolete]
protected virtual partial void PlatformUpdateShouldLoopPlayback()
{
if (Player is null)
@@ -574,6 +586,7 @@ protected virtual partial void PlatformUpdateShouldLoopPlayback()
Player.RepeatMode = MediaElement.ShouldLoopPlayback ? IPlayer.RepeatModeOne : IPlayer.RepeatModeOff;
}
+ [Obsolete]
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
@@ -625,6 +638,7 @@ static async Task CheckAndRequestForegroundPermission(CancellationToken cancella
[MemberNotNull(nameof(uiUpdateReceiver))]
[MemberNotNull(nameof(mediaSessionConnector))]
[MemberNotNull(nameof(mediaControllerCompat))]
+ [Obsolete]
void InitializeMediaSession()
{
ArgumentNullException.ThrowIfNull(Player);
@@ -653,6 +667,7 @@ void InitializeMediaSession()
mediaSession.SetFlags(MediaSessionCompat.FlagHandlesMediaButtons | MediaSessionCompat.FlagHandlesTransportControls);
}
+ [Obsolete]
async Task StartService(CancellationToken cancellationToken = default)
{
if (checkPermissionsTask is not null)
@@ -699,6 +714,7 @@ async Task StartService(CancellationToken cancellationToken = default)
}
}
+ [Obsolete]
void BroadcastUpdate(string action)
{
if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu)
@@ -710,6 +726,7 @@ void BroadcastUpdate(string action)
LocalBroadcastManager.GetInstance(Platform.AppContext).SendBroadcast(intent);
}
+ [Obsolete]
public void OnVideoSizeChanged(VideoSize? videoSize)
{
MediaElement.MediaWidth = videoSize?.Width ?? 0;
@@ -718,26 +735,49 @@ public void OnVideoSizeChanged(VideoSize? videoSize)
#region IPlayer.IListener implementation method stubs
+ [Obsolete]
public void OnAudioAttributesChanged(AudioAttributes? audioAttributes) { }
public void OnAudioSessionIdChanged(int audioSessionId) { }
+
+ [Obsolete]
public void OnAvailableCommandsChanged(IPlayer.Commands? availableCommands) { }
+
+ [Obsolete]
public void OnCues(CueGroup? cueGroup) { }
+
+ [Obsolete]
public void OnCues(List cues) { }
+
+ [Obsolete]
public void OnDeviceInfoChanged(Com.Google.Android.Exoplayer2.DeviceInfo? deviceInfo) { }
public void OnDeviceVolumeChanged(int volume, bool muted) { }
+
+ [Obsolete]
public void OnEvents(IPlayer? player, IPlayer.Events? events) { }
public void OnIsLoadingChanged(bool isLoading) { }
public void OnIsPlayingChanged(bool isPlaying) { }
public void OnLoadingChanged(bool isLoading) { }
public void OnMaxSeekToPreviousPositionChanged(long maxSeekToPreviousPositionMs) { }
+
+ [Obsolete]
public void OnMediaItemTransition(MediaItem? mediaItem, int transition) { }
+
+ [Obsolete]
public void OnMediaMetadataChanged(MediaMetadata? mediaMetadata) { }
+
+ [Obsolete]
public void OnMetadata(Metadata? metadata) { }
public void OnPlaybackSuppressionReasonChanged(int playbackSuppressionReason) { }
+
+ [Obsolete]
public void OnPlayerErrorChanged(PlaybackException? error) { }
+
+ [Obsolete]
public void OnPlaylistMetadataChanged(MediaMetadata? mediaMetadata) { }
public void OnPlayWhenReadyChanged(bool playWhenReady, int reason) { }
public void OnPositionDiscontinuity(int reason) { }
+
+ [Obsolete]
public void OnPositionDiscontinuity(IPlayer.PositionInfo oldPosition, IPlayer.PositionInfo newPosition, int reason) { }
public void OnRenderedFirstFrame() { }
public void OnRepeatModeChanged(int repeatMode) { }
@@ -746,8 +786,14 @@ public void OnSeekForwardIncrementChanged(long seekForwardIncrementMs) { }
public void OnShuffleModeEnabledChanged(bool shuffleModeEnabled) { }
public void OnSkipSilenceEnabledChanged(bool skipSilenceEnabled) { }
public void OnSurfaceSizeChanged(int width, int height) { }
+
+ [Obsolete]
public void OnTimelineChanged(Timeline? timeline, int reason) { }
+
+ [Obsolete]
public void OnTracksChanged(Tracks? tracks) { }
+
+ [Obsolete]
public void OnTrackSelectionParametersChanged(TrackSelectionParameters? trackSelectionParameters) { }
#endregion
@@ -755,6 +801,7 @@ public void OnTrackSelectionParametersChanged(TrackSelectionParameters? trackSel
///
/// A that listens for updates from the .
///
+ [Obsolete]
sealed class UIUpdateReceiver(IExoPlayer player) : BroadcastReceiver
{
public override void OnReceive(Context? context, Intent? intent)
diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.shared.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.shared.cs
index 5072c2c9b8..7aac7b2138 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.shared.cs
@@ -63,6 +63,7 @@ public MediaManager(IMauiContext context, IMediaElement mediaElement, IDispatche
///
/// The platform-specific media player.
///
+ [Obsolete]
protected PlatformMediaElement? Player { get; set; }
#endif
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/BaseBehaviorTest.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/BaseBehaviorTest.cs
index 47d89a3609..425cc93fd7 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/BaseBehaviorTest.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/BaseBehaviorTest.cs
@@ -55,10 +55,10 @@ public void EnsureTryRemoveBindingContextUnchangedWhenViewAttached()
Assert.Empty(view.Behaviors);
var attachedBehavior = (Behavior)behavior;
-
+
view.Behaviors.Add(attachedBehavior);
view.Behaviors[0].BindingContext = view.BindingContext;
-
+
Assert.Equal(view.BindingContext, attachedBehavior.BindingContext);
var wasSuccessful = view.Behaviors.TryRemove(attachedBehavior);
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaskedBehaviorTests.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaskedBehaviorTests.cs
index 2bbb594f59..d8faa8683e 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaskedBehaviorTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaskedBehaviorTests.cs
@@ -58,6 +58,7 @@ public void ValidMaskWithUniqueUnmaskedCharacterTests(string? mask, char unmaske
}
[Fact]
+ [Obsolete]
public void AttachedToInvalidElementTest()
{
IReadOnlyList invalidVisualElements =
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaxLengthReachedBehaviorTests.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaxLengthReachedBehaviorTests.cs
index 1ec0d31085..cb83357e34 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaxLengthReachedBehaviorTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaxLengthReachedBehaviorTests.cs
@@ -140,6 +140,7 @@ public void ShouldNotDismissKeyboardWhenOptionSetToFalse()
Assert.True(entry.IsFocused);
}
+ [Obsolete]
static Entry CreateEntry(int? maxLength = 2,
bool shouldDismissKeyboardAutomatically = false,
ICommand? command = null,
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/SetFocusOnEntryCompletedTests.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/SetFocusOnEntryCompletedTests.cs
index 53633fb758..e881a9aa19 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/SetFocusOnEntryCompletedTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/SetFocusOnEntryCompletedTests.cs
@@ -35,6 +35,7 @@ public void SetsFocusWhenCompleted()
Assert.True(entry2.IsFocused);
}
+ [Obsolete]
static Entry CreateEntry(VisualElement? nextElement = null)
{
var entry = new Entry();
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/UserStoppedTypingBehaviorTests.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/UserStoppedTypingBehaviorTests.cs
index 2e5655a18f..b7962eada5 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/UserStoppedTypingBehaviorTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/UserStoppedTypingBehaviorTests.cs
@@ -239,6 +239,7 @@ public async Task ShouldExecuteCommandImmediatelyWhenMinimumLengthThresholdHasNo
Assert.True(commandHasBeenExecuted);
}
+ [Obsolete]
static Entry CreateEntryWithBehavior(int stoppedTypingTimeThreshold = 500,
int minimumLengthThreshold = 0,
bool shouldDismissKeyboardAutomatically = false,
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs
index 6b12c452e3..1c84d8854d 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs
@@ -30,6 +30,7 @@ public void GetRequiredServiceThrowsOnNoContext()
}
[Fact(Timeout = (int)TestDuration.Short)]
+ [Obsolete]
public async Task ShowPopupAsync_CancellationTokenExpired()
{
var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(1));
@@ -61,6 +62,7 @@ public async Task ShowPopupAsync_CancellationTokenExpired()
}
[Fact(Timeout = (int)TestDuration.Short)]
+ [Obsolete]
public async Task ShowPopupAsync_CancellationTokenCancelled()
{
var cts = new CancellationTokenSource();
@@ -92,6 +94,7 @@ public async Task ShowPopupAsync_CancellationTokenCancelled()
}
[Fact(Timeout = (int)TestDuration.Short)]
+ [Obsolete]
public async Task CloseAsync_CancellationTokenExpired()
{
var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(1));
@@ -123,6 +126,7 @@ public async Task CloseAsync_CancellationTokenExpired()
}
[Fact(Timeout = (int)TestDuration.Short)]
+ [Obsolete]
public async Task CloseAsync_CancellationTokenCancelled()
{
var cts = new CancellationTokenSource();
@@ -154,6 +158,7 @@ public async Task CloseAsync_CancellationTokenCancelled()
}
[Fact(Timeout = (int)TestDuration.Short)]
+ [Obsolete]
public async Task OnOpenedMapperIsCalled()
{
var app = Application.Current ?? throw new NullReferenceException();
@@ -189,6 +194,7 @@ public async Task OnOpenedMapperIsCalled()
}
[Fact(Timeout = (int)TestDuration.Medium)]
+ [Obsolete]
public async Task PopupDismissedByTappingOutsideOfPopup()
{
var popupClosedTCS = new TaskCompletionSource<(string? Result, bool WasDismissedByTappingOutsideOfPopup)>();
@@ -227,6 +233,7 @@ public async Task PopupDismissedByTappingOutsideOfPopup()
}
[Fact(Timeout = (int)TestDuration.Short)]
+ [Obsolete]
public async Task OnDismissedWithResult()
{
object? result = null;
@@ -269,6 +276,7 @@ public async Task OnDismissedWithResult()
[Fact(Timeout = (int)TestDuration.Short)]
+ [Obsolete]
public async Task OnDismissedWithoutResult()
{
object? result = null;
@@ -324,6 +332,7 @@ public void NullColorThrowsArgumentNullException()
}
[Fact(Timeout = (int)TestDuration.Short)]
+ [Obsolete]
public async Task ShowPopup_IsLogicalChild()
{
var app = Application.Current ?? throw new NullReferenceException();
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs
index 47eeacdd4d..a1c776425a 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs
@@ -413,7 +413,7 @@ async ValueTask UpdateStateAsync(VisualElement? view, ValidationFlags flags, boo
void UpdateStyle(in VisualElement view, bool isValid)
{
VisualStateManager.GoToState(view, isValid ? ValidVisualState : InvalidVisualState);
-
+
view.Style = (isValid ? ValidStyle : InvalidStyle) ?? view.Style;
}
diff --git a/src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs
index 0b2e9cd8a1..223dcbe2af 100644
--- a/src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs
@@ -15,9 +15,9 @@ public abstract class BaseConverter<[DynamicallyAccessedMembers(DynamicallyAcces
{
private protected BaseConverter()
{
-
+
}
-
+
///
/// Default value to return when throws an .
/// This value is used when is set to .
@@ -112,9 +112,9 @@ public abstract class BaseConverter<[DynamicallyAccessedMembers(DynamicallyAcces
{
private protected BaseConverter()
{
-
+
}
-
+
///
/// Default value to return when throws an .
/// This value is used when is set to .
diff --git a/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs
index 28694b5e31..c4f201e4c8 100644
--- a/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs
@@ -88,7 +88,6 @@ public override object ConvertFrom(TValue value, CultureInfo? culture = null)
{
ArgumentNullException.ThrowIfNull(value);
ArgumentNullException.ThrowIfNull(ComparingValue);
- ArgumentNullException.ThrowIfNull(ComparisonOperator);
if (!Enum.IsDefined(typeof(OperatorType), ComparisonOperator))
{
diff --git a/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs
index 80f4cdb341..b0d6d5be74 100644
--- a/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs
@@ -22,7 +22,6 @@ public partial class DateTimeOffsetConverter : BaseConverterThe value.
public override DateTime ConvertFrom(DateTimeOffset value, CultureInfo? culture = null)
{
- ArgumentNullException.ThrowIfNull(value);
return value.DateTime;
}
@@ -34,7 +33,6 @@ public override DateTime ConvertFrom(DateTimeOffset value, CultureInfo? culture
/// The value.
public override DateTimeOffset ConvertBackTo(DateTime value, CultureInfo? culture = null)
{
- ArgumentNullException.ThrowIfNull(value);
var offset = value.Kind switch
{
diff --git a/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs
index aa63657815..7e33e03405 100644
--- a/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs
@@ -42,7 +42,6 @@ public override int ConvertFrom(Enum value, Type? parameter = null, CultureInfo?
/// If value is not a valid value in the targetType enum
public override Enum ConvertBackTo(int value, Type parameter, CultureInfo? culture = null)
{
- ArgumentNullException.ThrowIfNull(value);
ArgumentNullException.ThrowIfNull(parameter);
if (!Enum.IsDefined(parameter, value))
diff --git a/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs
index 3733760503..a2d539f779 100644
--- a/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs
@@ -60,7 +60,6 @@ public LayoutState StateToCompare
/// True if the provided s match, otherwise False if they don't match.
public override bool ConvertFrom(LayoutState value, LayoutState? parameter = null, CultureInfo? culture = null)
{
- ArgumentNullException.ThrowIfNull(value);
if (parameter is not null)
{
diff --git a/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs
index 2b8098d2c6..c68e46eb6b 100644
--- a/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs
@@ -22,7 +22,6 @@ public partial class TimeSpanToSecondsConverter : BaseConverterA value expressed in seconds.
public override double ConvertFrom(TimeSpan value, CultureInfo? culture = null)
{
- ArgumentNullException.ThrowIfNull(value);
return value.TotalSeconds;
}
@@ -34,7 +33,6 @@ public override double ConvertFrom(TimeSpan value, CultureInfo? culture = null)
/// The value representing the converted value.
public override TimeSpan ConvertBackTo(double value, CultureInfo? culture = null)
{
- ArgumentNullException.ThrowIfNull(value);
return TimeSpan.FromSeconds(value);
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs b/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs
index 6c63879ac8..996238c430 100644
--- a/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs
+++ b/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs
@@ -26,12 +26,12 @@ public partial 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 string defaultGravatarImageAddress = "https://www.gravatar.com/avatar/";
const int defaultSize = 80;
-
+
static readonly Lazy singletonHttpClientHolder = new();
-
+
readonly TimeSpan cancellationTokenSourceTimeout = TimeSpan.FromMilliseconds(737);
int? gravatarSize;
diff --git a/src/CommunityToolkit.Maui/PopupService.cs b/src/CommunityToolkit.Maui/PopupService.cs
index 00c9ad7f02..1d2f934ed4 100644
--- a/src/CommunityToolkit.Maui/PopupService.cs
+++ b/src/CommunityToolkit.Maui/PopupService.cs
@@ -133,7 +133,7 @@ public void ShowPopup(Action onPresenting) where TViewMo
return ShowPopupAsync(popup, token);
}
-
+
///
public Task ShowPopupAsync(Action onPresenting, CancellationToken token = default) where TViewModel : INotifyPropertyChanged
{
@@ -187,7 +187,7 @@ static void ValidateBindingContext(Popup popup, out TViewModel bindi
bindingContext = viewModel;
}
-
+
static void ShowPopup(Popup popup)
{
#if WINDOWS
@@ -218,9 +218,9 @@ void EnsureMainThreadIsUsed([CallerMemberName] string? callerName = default)
Popup GetPopup(Type viewModelType)
{
- var popup = (Popup)(serviceProvider.GetService(viewModelToViewMappings[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;
+ return popup;
}
void InitializePopup(Popup popup)
diff --git a/src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.windows.cs b/src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.windows.cs
index 756a98f18b..34582f944e 100644
--- a/src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.windows.cs
+++ b/src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.windows.cs
@@ -10,7 +10,7 @@ public static partial class PopupExtensions
{
static void PlatformShowPopup(Popup popup, IMauiContext mauiContext)
{
- if(mauiContext.GetPlatformWindow().GetWindow()?.Content is not Page parent)
+ if (mauiContext.GetPlatformWindow().GetWindow()?.Content is not Page parent)
{
throw new InvalidOperationException("Window Content cannot be null");
}
From 6aedd2e4057896ed506f92cd9689bd7dca3aee41 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Fri, 1 Nov 2024 13:57:26 -0700
Subject: [PATCH 073/171] Remove `Obsolete` attributes from `dotnet format`
This reverts commit c762fb23b81bb16c4c21f16caeef100c8d32fd21.
---
.../Services/MediaControlsService.android.cs | 4 --
.../Views/MauiMediaElement.android.cs | 4 --
.../Views/MediaManager.android.cs | 47 -------------------
.../Views/MediaManager.shared.cs | 1 -
.../Behaviors/MaskedBehaviorTests.cs | 1 -
.../MaxLengthReachedBehaviorTests.cs | 1 -
.../SetFocusOnEntryCompletedTests.cs | 1 -
.../UserStoppedTypingBehaviorTests.cs | 1 -
.../Views/Popup/PopupTests.cs | 9 ----
.../Converters/CompareConverter.shared.cs | 1 +
.../DateTimeOffsetConverter.shared.cs | 2 +
.../Converters/EnumToIntConverter.shared.cs | 1 +
.../StateToBooleanConverter.shared.cs | 1 +
.../TimeSpanToSecondsConverter.shared.cs | 2 +
14 files changed, 7 insertions(+), 69 deletions(-)
diff --git a/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs b/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
index 8ee65dfbbf..2097ea7db6 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
@@ -75,7 +75,6 @@ static void CreateNotificationChannel(NotificationManager notificationMnaManager
[MemberNotNull(nameof(mediaSession))]
[MemberNotNull(nameof(token))]
[MemberNotNull(nameof(receiveUpdates))]
- [Obsolete]
ValueTask StartForegroundService(Intent mediaManagerIntent, CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(mediaManagerIntent);
@@ -223,8 +222,6 @@ public override void OnDestroy()
Platform.CurrentActivity?.StopService(new Intent(Platform.AppContext, typeof(MediaControlsService)));
base.OnDestroy();
}
-
- [Obsolete]
static void BroadcastUpdate(string receiver, string action)
{
if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu)
@@ -236,7 +233,6 @@ static void BroadcastUpdate(string receiver, string action)
LocalBroadcastManager.GetInstance(Platform.AppContext).SendBroadcast(intent);
}
- [Obsolete]
protected override void Dispose(bool disposing)
{
if (!isDisposed)
diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
index 686af10d90..011d1d9827 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
@@ -15,7 +15,6 @@ namespace CommunityToolkit.Maui.Core.Views;
///
public class MauiMediaElement : CoordinatorLayout
{
- [Obsolete]
readonly StyledPlayerView playerView;
int defaultSystemUiVisibility;
bool isSystemBarVisible;
@@ -36,7 +35,6 @@ public MauiMediaElement(nint ptr, JniHandleOwnership jni) : base(Platform.AppCon
///
/// The application's .
/// The that acts as the platform media player.
- [Obsolete]
public MauiMediaElement(Context context, StyledPlayerView playerView) : base(context)
{
this.playerView = playerView;
@@ -57,7 +55,6 @@ public MauiMediaElement(Context context, StyledPlayerView playerView) : base(con
AddView(relativeLayout);
}
- [Obsolete]
public override void OnDetachedFromWindow()
{
if (isFullScreen)
@@ -105,7 +102,6 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}
- [Obsolete]
void OnFullscreenButtonClick(object? sender, StyledPlayerView.FullscreenButtonClickEventArgs e)
{
// Ensure there is a player view
diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs
index 196beada9b..39be2d58ee 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs
@@ -24,7 +24,6 @@
namespace CommunityToolkit.Maui.Core.Views;
-[Obsolete]
public partial class MediaManager : Java.Lang.Object, IPlayer.IListener
{
static readonly HttpClient client = new();
@@ -38,7 +37,6 @@ public partial class MediaManager : Java.Lang.Object, IPlayer.IListener
float volumeBeforeMute = 1;
MediaControllerCompat? mediaControllerCompat;
TaskCompletionSource? seekToTaskCompletionSource;
- [Obsolete]
MediaSessionConnector? mediaSessionConnector;
MediaSessionCompat? mediaSession;
UIUpdateReceiver? uiUpdateReceiver;
@@ -47,7 +45,6 @@ public partial class MediaManager : Java.Lang.Object, IPlayer.IListener
///
/// The platform native counterpart of .
///
- [Obsolete]
protected StyledPlayerView? PlayerView { get; set; }
///
@@ -92,7 +89,6 @@ public partial class MediaManager : Java.Lang.Object, IPlayer.IListener
/// This is part of the implementation.
/// While this method does not seem to have any references, it's invoked at runtime.
///
- [Obsolete]
public void OnPlaybackParametersChanged(PlaybackParameters? playbackParameters)
{
if (playbackParameters is null || AreFloatingPointNumbersEqual(playbackParameters.Speed, MediaElement.Speed))
@@ -112,7 +108,6 @@ public void OnPlaybackParametersChanged(PlaybackParameters? playbackParameters)
/// This is part of the implementation.
/// While this method does not seem to have any references, it's invoked at runtime.
///
- [Obsolete]
public async void OnPlayerStateChanged(bool playWhenReady, int playbackState)
{
if (Player is null || MediaElement.Source is null)
@@ -190,7 +185,6 @@ or PlaybackStateCompat.StateSkippingToQueueItem
[MemberNotNull(nameof(checkPermissionsTask))]
[MemberNotNull(nameof(mediaSessionConnector))]
[MemberNotNull(nameof(mediaControllerCompat))]
- [Obsolete]
public (PlatformMediaElement platformView, StyledPlayerView PlayerView) CreatePlatformView()
{
ArgumentNullException.ThrowIfNull(MauiContext.Context);
@@ -218,7 +212,6 @@ or PlaybackStateCompat.StateSkippingToQueueItem
/// This is part of the implementation.
/// While this method does not seem to have any references, it's invoked at runtime.
///
- [Obsolete]
public void OnPlaybackStateChanged(int playbackState)
{
if (MediaElement.Source is null)
@@ -253,7 +246,6 @@ public void OnPlaybackStateChanged(int playbackState)
/// This is part of the implementation.
/// While this method does not seem to have any references, it's invoked at runtime.
///
- [Obsolete]
public void OnPlayerError(PlaybackException? error)
{
var errorMessage = string.Empty;
@@ -347,7 +339,6 @@ protected virtual partial void PlatformPause()
BroadcastUpdate(MediaControlsService.ACTION_PAUSE);
}
- [Obsolete]
protected virtual async partial Task PlatformSeek(TimeSpan position, CancellationToken token)
{
if (Player is null)
@@ -388,7 +379,6 @@ protected virtual partial void PlatformStop()
MediaElement.Position = TimeSpan.Zero;
}
- [Obsolete]
protected virtual partial void PlatformUpdateSource()
{
var hasSetSource = false;
@@ -458,7 +448,6 @@ protected virtual partial void PlatformUpdateSource()
}
}
- [Obsolete]
protected virtual partial void PlatformUpdateAspect()
{
if (PlayerView is null)
@@ -575,7 +564,6 @@ protected virtual partial void PlatformUpdateShouldMute()
Player.Volume = MediaElement.ShouldMute ? 0 : volumeBeforeMute;
}
- [Obsolete]
protected virtual partial void PlatformUpdateShouldLoopPlayback()
{
if (Player is null)
@@ -586,7 +574,6 @@ protected virtual partial void PlatformUpdateShouldLoopPlayback()
Player.RepeatMode = MediaElement.ShouldLoopPlayback ? IPlayer.RepeatModeOne : IPlayer.RepeatModeOff;
}
- [Obsolete]
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
@@ -638,7 +625,6 @@ static async Task CheckAndRequestForegroundPermission(CancellationToken cancella
[MemberNotNull(nameof(uiUpdateReceiver))]
[MemberNotNull(nameof(mediaSessionConnector))]
[MemberNotNull(nameof(mediaControllerCompat))]
- [Obsolete]
void InitializeMediaSession()
{
ArgumentNullException.ThrowIfNull(Player);
@@ -667,7 +653,6 @@ void InitializeMediaSession()
mediaSession.SetFlags(MediaSessionCompat.FlagHandlesMediaButtons | MediaSessionCompat.FlagHandlesTransportControls);
}
- [Obsolete]
async Task StartService(CancellationToken cancellationToken = default)
{
if (checkPermissionsTask is not null)
@@ -714,7 +699,6 @@ async Task StartService(CancellationToken cancellationToken = default)
}
}
- [Obsolete]
void BroadcastUpdate(string action)
{
if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu)
@@ -726,7 +710,6 @@ void BroadcastUpdate(string action)
LocalBroadcastManager.GetInstance(Platform.AppContext).SendBroadcast(intent);
}
- [Obsolete]
public void OnVideoSizeChanged(VideoSize? videoSize)
{
MediaElement.MediaWidth = videoSize?.Width ?? 0;
@@ -735,49 +718,26 @@ public void OnVideoSizeChanged(VideoSize? videoSize)
#region IPlayer.IListener implementation method stubs
- [Obsolete]
public void OnAudioAttributesChanged(AudioAttributes? audioAttributes) { }
public void OnAudioSessionIdChanged(int audioSessionId) { }
-
- [Obsolete]
public void OnAvailableCommandsChanged(IPlayer.Commands? availableCommands) { }
-
- [Obsolete]
public void OnCues(CueGroup? cueGroup) { }
-
- [Obsolete]
public void OnCues(List cues) { }
-
- [Obsolete]
public void OnDeviceInfoChanged(Com.Google.Android.Exoplayer2.DeviceInfo? deviceInfo) { }
public void OnDeviceVolumeChanged(int volume, bool muted) { }
-
- [Obsolete]
public void OnEvents(IPlayer? player, IPlayer.Events? events) { }
public void OnIsLoadingChanged(bool isLoading) { }
public void OnIsPlayingChanged(bool isPlaying) { }
public void OnLoadingChanged(bool isLoading) { }
public void OnMaxSeekToPreviousPositionChanged(long maxSeekToPreviousPositionMs) { }
-
- [Obsolete]
public void OnMediaItemTransition(MediaItem? mediaItem, int transition) { }
-
- [Obsolete]
public void OnMediaMetadataChanged(MediaMetadata? mediaMetadata) { }
-
- [Obsolete]
public void OnMetadata(Metadata? metadata) { }
public void OnPlaybackSuppressionReasonChanged(int playbackSuppressionReason) { }
-
- [Obsolete]
public void OnPlayerErrorChanged(PlaybackException? error) { }
-
- [Obsolete]
public void OnPlaylistMetadataChanged(MediaMetadata? mediaMetadata) { }
public void OnPlayWhenReadyChanged(bool playWhenReady, int reason) { }
public void OnPositionDiscontinuity(int reason) { }
-
- [Obsolete]
public void OnPositionDiscontinuity(IPlayer.PositionInfo oldPosition, IPlayer.PositionInfo newPosition, int reason) { }
public void OnRenderedFirstFrame() { }
public void OnRepeatModeChanged(int repeatMode) { }
@@ -786,14 +746,8 @@ public void OnSeekForwardIncrementChanged(long seekForwardIncrementMs) { }
public void OnShuffleModeEnabledChanged(bool shuffleModeEnabled) { }
public void OnSkipSilenceEnabledChanged(bool skipSilenceEnabled) { }
public void OnSurfaceSizeChanged(int width, int height) { }
-
- [Obsolete]
public void OnTimelineChanged(Timeline? timeline, int reason) { }
-
- [Obsolete]
public void OnTracksChanged(Tracks? tracks) { }
-
- [Obsolete]
public void OnTrackSelectionParametersChanged(TrackSelectionParameters? trackSelectionParameters) { }
#endregion
@@ -801,7 +755,6 @@ public void OnTrackSelectionParametersChanged(TrackSelectionParameters? trackSel
///
/// A that listens for updates from the .
///
- [Obsolete]
sealed class UIUpdateReceiver(IExoPlayer player) : BroadcastReceiver
{
public override void OnReceive(Context? context, Intent? intent)
diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.shared.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.shared.cs
index 7aac7b2138..5072c2c9b8 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.shared.cs
@@ -63,7 +63,6 @@ public MediaManager(IMauiContext context, IMediaElement mediaElement, IDispatche
///
/// The platform-specific media player.
///
- [Obsolete]
protected PlatformMediaElement? Player { get; set; }
#endif
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaskedBehaviorTests.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaskedBehaviorTests.cs
index d8faa8683e..2bbb594f59 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaskedBehaviorTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaskedBehaviorTests.cs
@@ -58,7 +58,6 @@ public void ValidMaskWithUniqueUnmaskedCharacterTests(string? mask, char unmaske
}
[Fact]
- [Obsolete]
public void AttachedToInvalidElementTest()
{
IReadOnlyList invalidVisualElements =
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaxLengthReachedBehaviorTests.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaxLengthReachedBehaviorTests.cs
index cb83357e34..1ec0d31085 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaxLengthReachedBehaviorTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/MaxLengthReachedBehaviorTests.cs
@@ -140,7 +140,6 @@ public void ShouldNotDismissKeyboardWhenOptionSetToFalse()
Assert.True(entry.IsFocused);
}
- [Obsolete]
static Entry CreateEntry(int? maxLength = 2,
bool shouldDismissKeyboardAutomatically = false,
ICommand? command = null,
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/SetFocusOnEntryCompletedTests.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/SetFocusOnEntryCompletedTests.cs
index e881a9aa19..53633fb758 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/SetFocusOnEntryCompletedTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/SetFocusOnEntryCompletedTests.cs
@@ -35,7 +35,6 @@ public void SetsFocusWhenCompleted()
Assert.True(entry2.IsFocused);
}
- [Obsolete]
static Entry CreateEntry(VisualElement? nextElement = null)
{
var entry = new Entry();
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/UserStoppedTypingBehaviorTests.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/UserStoppedTypingBehaviorTests.cs
index b7962eada5..2e5655a18f 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/UserStoppedTypingBehaviorTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/UserStoppedTypingBehaviorTests.cs
@@ -239,7 +239,6 @@ public async Task ShouldExecuteCommandImmediatelyWhenMinimumLengthThresholdHasNo
Assert.True(commandHasBeenExecuted);
}
- [Obsolete]
static Entry CreateEntryWithBehavior(int stoppedTypingTimeThreshold = 500,
int minimumLengthThreshold = 0,
bool shouldDismissKeyboardAutomatically = false,
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs
index 1c84d8854d..6b12c452e3 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs
@@ -30,7 +30,6 @@ public void GetRequiredServiceThrowsOnNoContext()
}
[Fact(Timeout = (int)TestDuration.Short)]
- [Obsolete]
public async Task ShowPopupAsync_CancellationTokenExpired()
{
var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(1));
@@ -62,7 +61,6 @@ public async Task ShowPopupAsync_CancellationTokenExpired()
}
[Fact(Timeout = (int)TestDuration.Short)]
- [Obsolete]
public async Task ShowPopupAsync_CancellationTokenCancelled()
{
var cts = new CancellationTokenSource();
@@ -94,7 +92,6 @@ public async Task ShowPopupAsync_CancellationTokenCancelled()
}
[Fact(Timeout = (int)TestDuration.Short)]
- [Obsolete]
public async Task CloseAsync_CancellationTokenExpired()
{
var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(1));
@@ -126,7 +123,6 @@ public async Task CloseAsync_CancellationTokenExpired()
}
[Fact(Timeout = (int)TestDuration.Short)]
- [Obsolete]
public async Task CloseAsync_CancellationTokenCancelled()
{
var cts = new CancellationTokenSource();
@@ -158,7 +154,6 @@ public async Task CloseAsync_CancellationTokenCancelled()
}
[Fact(Timeout = (int)TestDuration.Short)]
- [Obsolete]
public async Task OnOpenedMapperIsCalled()
{
var app = Application.Current ?? throw new NullReferenceException();
@@ -194,7 +189,6 @@ public async Task OnOpenedMapperIsCalled()
}
[Fact(Timeout = (int)TestDuration.Medium)]
- [Obsolete]
public async Task PopupDismissedByTappingOutsideOfPopup()
{
var popupClosedTCS = new TaskCompletionSource<(string? Result, bool WasDismissedByTappingOutsideOfPopup)>();
@@ -233,7 +227,6 @@ public async Task PopupDismissedByTappingOutsideOfPopup()
}
[Fact(Timeout = (int)TestDuration.Short)]
- [Obsolete]
public async Task OnDismissedWithResult()
{
object? result = null;
@@ -276,7 +269,6 @@ public async Task OnDismissedWithResult()
[Fact(Timeout = (int)TestDuration.Short)]
- [Obsolete]
public async Task OnDismissedWithoutResult()
{
object? result = null;
@@ -332,7 +324,6 @@ public void NullColorThrowsArgumentNullException()
}
[Fact(Timeout = (int)TestDuration.Short)]
- [Obsolete]
public async Task ShowPopup_IsLogicalChild()
{
var app = Application.Current ?? throw new NullReferenceException();
diff --git a/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs
index c4f201e4c8..28694b5e31 100644
--- a/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs
@@ -88,6 +88,7 @@ public override object ConvertFrom(TValue value, CultureInfo? culture = null)
{
ArgumentNullException.ThrowIfNull(value);
ArgumentNullException.ThrowIfNull(ComparingValue);
+ ArgumentNullException.ThrowIfNull(ComparisonOperator);
if (!Enum.IsDefined(typeof(OperatorType), ComparisonOperator))
{
diff --git a/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs
index b0d6d5be74..80f4cdb341 100644
--- a/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs
@@ -22,6 +22,7 @@ public partial class DateTimeOffsetConverter : BaseConverterThe value.
public override DateTime ConvertFrom(DateTimeOffset value, CultureInfo? culture = null)
{
+ ArgumentNullException.ThrowIfNull(value);
return value.DateTime;
}
@@ -33,6 +34,7 @@ public override DateTime ConvertFrom(DateTimeOffset value, CultureInfo? culture
/// The value.
public override DateTimeOffset ConvertBackTo(DateTime value, CultureInfo? culture = null)
{
+ ArgumentNullException.ThrowIfNull(value);
var offset = value.Kind switch
{
diff --git a/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs
index 7e33e03405..aa63657815 100644
--- a/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs
@@ -42,6 +42,7 @@ public override int ConvertFrom(Enum value, Type? parameter = null, CultureInfo?
/// If value is not a valid value in the targetType enum
public override Enum ConvertBackTo(int value, Type parameter, CultureInfo? culture = null)
{
+ ArgumentNullException.ThrowIfNull(value);
ArgumentNullException.ThrowIfNull(parameter);
if (!Enum.IsDefined(parameter, value))
diff --git a/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs
index a2d539f779..3733760503 100644
--- a/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs
@@ -60,6 +60,7 @@ public LayoutState StateToCompare
/// True if the provided s match, otherwise False if they don't match.
public override bool ConvertFrom(LayoutState value, LayoutState? parameter = null, CultureInfo? culture = null)
{
+ ArgumentNullException.ThrowIfNull(value);
if (parameter is not null)
{
diff --git a/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs
index c68e46eb6b..2b8098d2c6 100644
--- a/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs
@@ -22,6 +22,7 @@ public partial class TimeSpanToSecondsConverter : BaseConverterA value expressed in seconds.
public override double ConvertFrom(TimeSpan value, CultureInfo? culture = null)
{
+ ArgumentNullException.ThrowIfNull(value);
return value.TotalSeconds;
}
@@ -33,6 +34,7 @@ public override double ConvertFrom(TimeSpan value, CultureInfo? culture = null)
/// The value representing the converted value.
public override TimeSpan ConvertBackTo(double value, CultureInfo? culture = null)
{
+ ArgumentNullException.ThrowIfNull(value);
return TimeSpan.FromSeconds(value);
}
}
\ No newline at end of file
From 2cd0c7a3b47a8edb9f76eba54f0b583c1a6208b9 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Mon, 4 Nov 2024 09:27:21 -0800
Subject: [PATCH 074/171] Update `Microsoft.CodeAnalysis.CSharp.Workspaces`
---
.../CommunityToolkit.Maui.Analyzers.CodeFixes.csproj | 2 +-
.../CommunityToolkit.Maui.Analyzers.UnitTests.csproj | 4 ++--
.../CommunityToolkit.Maui.Analyzers.csproj | 4 ++--
.../CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj | 2 +-
.../CommunityToolkit.Maui.Camera.Analyzers.csproj | 4 ++--
...munityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj | 2 +-
.../CommunityToolkit.Maui.MediaElement.Analyzers.csproj | 4 ++--
.../CommunityToolkit.Maui.SourceGenerators.Internal.csproj | 4 ++--
.../CommunityToolkit.Maui.SourceGenerators.csproj | 4 ++--
9 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/CommunityToolkit.Maui.Analyzers.CodeFixes/CommunityToolkit.Maui.Analyzers.CodeFixes.csproj b/src/CommunityToolkit.Maui.Analyzers.CodeFixes/CommunityToolkit.Maui.Analyzers.CodeFixes.csproj
index e2c830eac6..b4c780bbda 100644
--- a/src/CommunityToolkit.Maui.Analyzers.CodeFixes/CommunityToolkit.Maui.Analyzers.CodeFixes.csproj
+++ b/src/CommunityToolkit.Maui.Analyzers.CodeFixes/CommunityToolkit.Maui.Analyzers.CodeFixes.csproj
@@ -8,7 +8,7 @@
-
+
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 0350e09073..ea5c393054 100644
--- a/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj
+++ b/src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj
@@ -17,13 +17,13 @@
-
+
-
+
diff --git a/src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj b/src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj
index 2aa45b70d7..a1db32befe 100644
--- a/src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj
+++ b/src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj
@@ -13,8 +13,8 @@
-
-
+
+
diff --git a/src/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj b/src/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj
index d683a1d1cd..e055600fa7 100644
--- a/src/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj
+++ b/src/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj b/src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj
index 7920397691..ad6e4e2d60 100644
--- a/src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj
+++ b/src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj
@@ -13,8 +13,8 @@
-
-
+
+
diff --git a/src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj b/src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj
index 565940710f..7782f54fb3 100644
--- a/src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj
+++ b/src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj b/src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj
index 746a0a3177..6be1559caf 100644
--- a/src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj
+++ b/src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj
@@ -13,8 +13,8 @@
-
-
+
+
diff --git a/src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj b/src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj
index bde995f86e..bfcef6ccdc 100644
--- a/src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj
+++ b/src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj
@@ -15,8 +15,8 @@
-
-
+
+
diff --git a/src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj b/src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj
index 8e51fcd457..89351ffff3 100644
--- a/src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj
+++ b/src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj
@@ -10,8 +10,8 @@
-
-
+
+
From ac437a6dfcaa4213e43e7f48ee44ce67ff25682f Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Mon, 4 Nov 2024 09:28:58 -0800
Subject: [PATCH 075/171] Update Sample App NuGet Packages to .NET 9
---
.../CommunityToolkit.Maui.Sample.csproj | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj
index 0f4e6451c8..52b0141ac0 100644
--- a/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj
+++ b/samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj
@@ -70,8 +70,8 @@
-
-
+
+
From e3e62111fc673becde82ff509e287cb55a48649c Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Mon, 4 Nov 2024 09:32:52 -0800
Subject: [PATCH 076/171] Remove Duplicate NuGet Packages
---
.../CommunityToolkit.Maui.Analyzers.csproj | 1 -
.../CommunityToolkit.Maui.Camera.Analyzers.csproj | 1 -
.../CommunityToolkit.Maui.MediaElement.Analyzers.csproj | 1 -
.../CommunityToolkit.Maui.SourceGenerators.Internal.csproj | 1 -
.../CommunityToolkit.Maui.SourceGenerators.csproj | 1 -
5 files changed, 5 deletions(-)
diff --git a/src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj b/src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj
index a1db32befe..88e0d15e2a 100644
--- a/src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj
+++ b/src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj
@@ -14,7 +14,6 @@
-
diff --git a/src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj b/src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj
index ad6e4e2d60..5c7ba3c917 100644
--- a/src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj
+++ b/src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj
@@ -14,7 +14,6 @@
-
diff --git a/src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj b/src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj
index 6be1559caf..1bd5eeff3d 100644
--- a/src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj
+++ b/src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj
@@ -14,7 +14,6 @@
-
diff --git a/src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj b/src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj
index bfcef6ccdc..835a6973e8 100644
--- a/src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj
+++ b/src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj
@@ -16,7 +16,6 @@
-
diff --git a/src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj b/src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj
index 89351ffff3..b43713280a 100644
--- a/src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj
+++ b/src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj
@@ -11,7 +11,6 @@
-
From c19b3d6dcdfd21da6b788443816ea1622b672478 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Tue, 5 Nov 2024 10:32:36 -0800
Subject: [PATCH 077/171] Fix
https://github.com/CommunityToolkit/Maui/issues/2109
---
.../CommunityToolkit.Maui.Camera.csproj | 3 +++
.../CommunityToolkit.Maui.Camera.nuspec | 3 +++
src/CommunityToolkit.Maui.Camera/linker.xml | 8 ++++++++
3 files changed, 14 insertions(+)
create mode 100644 src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.nuspec
create mode 100644 src/CommunityToolkit.Maui.Camera/linker.xml
diff --git a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj
index 2a975c23c7..6e240e6f26 100644
--- a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj
+++ b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj
@@ -55,6 +55,9 @@
+
+
+
diff --git a/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.nuspec b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.nuspec
new file mode 100644
index 0000000000..60067ace53
--- /dev/null
+++ b/src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.nuspec
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Camera/linker.xml b/src/CommunityToolkit.Maui.Camera/linker.xml
new file mode 100644
index 0000000000..f1c8619a9b
--- /dev/null
+++ b/src/CommunityToolkit.Maui.Camera/linker.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
From b4869b7bd654e4cea95493d21e810b0a3118f65b Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Tue, 5 Nov 2024 10:42:40 -0800
Subject: [PATCH 078/171] Fix CameraView warnings
---
.../CameraManager.shared.cs | 10 +++++-----
.../Providers/CameraProvider.android.cs | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/CommunityToolkit.Maui.Camera/CameraManager.shared.cs b/src/CommunityToolkit.Maui.Camera/CameraManager.shared.cs
index 638294254b..7155705950 100644
--- a/src/CommunityToolkit.Maui.Camera/CameraManager.shared.cs
+++ b/src/CommunityToolkit.Maui.Camera/CameraManager.shared.cs
@@ -104,33 +104,33 @@ public async ValueTask UpdateCurrentCamera(CameraInfo? cameraInfo, CancellationT
public partial ValueTask UpdateCaptureResolution(Size resolution, CancellationToken token);
///
- /// Performs the capturing of a picture at the platform specific level.
+ /// Performs the capturing of a picture at the platform-specific level.
///
/// A that can be used to cancel the work.
/// A that can be awaited.
protected virtual partial ValueTask PlatformTakePicture(CancellationToken token);
///
- /// Starts the preview from the camera, at the platform specific level.
+ /// Starts the preview from the camera, at the platform-specific level.
///
/// A that can be used to cancel the work.
/// A that can be awaited.
protected virtual partial Task PlatformStartCameraPreview(CancellationToken token);
///
- /// Connects to the camera, at the platform specific level.
+ /// Connects to the camera, at the platform-specific level.
///
/// A that can be used to cancel the work.
/// A that can be awaited.
protected virtual partial Task PlatformConnectCamera(CancellationToken token);
///
- /// Disconnects from the camera, at the platform specific level.
+ /// Disconnects from the camera, at the platform-specific level.
///
protected virtual partial void PlatformDisconnect();
///
- /// Stops the preview from the camera, at the platform specific level.
+ /// Stops the preview from the camera, at the platform-specific level.
///
protected virtual partial void PlatformStopCameraPreview();
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Camera/Providers/CameraProvider.android.cs b/src/CommunityToolkit.Maui.Camera/Providers/CameraProvider.android.cs
index eaefae30ce..e1c9eeda79 100644
--- a/src/CommunityToolkit.Maui.Camera/Providers/CameraProvider.android.cs
+++ b/src/CommunityToolkit.Maui.Camera/Providers/CameraProvider.android.cs
@@ -46,7 +46,7 @@ public async partial ValueTask RefreshAvailableCameras(CancellationToken token)
{
var streamConfigMap = camera2Info.GetCameraCharacteristic(CameraCharacteristics.ScalerStreamConfigurationMap) as StreamConfigurationMap;
- if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.M)
+ if (OperatingSystem.IsAndroidVersionAtLeast(23))
{
var highResolutions = streamConfigMap?.GetHighResolutionOutputSizes((int)ImageFormatType.Jpeg);
if (highResolutions is not null)
From 2dd57b500090c213df6a1e7303328ea562d4e104 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Tue, 5 Nov 2024 14:41:52 -0800
Subject: [PATCH 079/171] Refactor ShowKeyboardAsync
---
.../KeyboardExtensions.shared.cs | 35 ++++++-------------
1 file changed, 10 insertions(+), 25 deletions(-)
diff --git a/src/CommunityToolkit.Maui.Core/Platform/KeyboardExtensions/KeyboardExtensions.shared.cs b/src/CommunityToolkit.Maui.Core/Platform/KeyboardExtensions/KeyboardExtensions.shared.cs
index 14c58799f3..c667d6631c 100644
--- a/src/CommunityToolkit.Maui.Core/Platform/KeyboardExtensions/KeyboardExtensions.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Platform/KeyboardExtensions/KeyboardExtensions.shared.cs
@@ -46,42 +46,28 @@ public static ValueTask HideKeyboardAsync(this ITextInput targetView, Canc
/// Cancellation token
///
/// Returns true if the platform was able to show the soft input device.
- public static Task ShowKeyboardAsync(this ITextInput targetView, CancellationToken token = default)
+ public static async ValueTask ShowKeyboardAsync(this ITextInput targetView, CancellationToken token = default)
{
token.ThrowIfCancellationRequested();
if (!targetView.TryGetPlatformView(out var platformView, out var handler, out var view))
{
- return Task.FromResult(false);
+ return false;
}
if (!view.IsFocused)
{
- var showKeyboardTCS = new TaskCompletionSource();
-
var focusRequest = new FocusRequest();
focusRequest.SetResult(false);
handler.Invoke(nameof(IView.Focus), focusRequest);
- handler.GetRequiredService().Dispatch(() =>
- {
- try
- {
- var result = platformView.ShowKeyboard();
- showKeyboardTCS.SetResult(result);
- }
- catch (Exception e)
- {
- showKeyboardTCS.SetException(e);
- }
- });
-
- return showKeyboardTCS.Task.WaitAsync(token);
+ var result = await handler.GetRequiredService().DispatchAsync(() => platformView.ShowKeyboard()).WaitAsync(token);
+ return result;
}
else
{
var result = platformView.ShowKeyboard();
- return Task.FromResult(result).WaitAsync(token);
+ return result;
}
}
@@ -95,19 +81,18 @@ public static bool IsSoftKeyboardShowing(this ITextInput targetView)
{
if (!targetView.TryGetPlatformView(out var platformView, out _, out _))
{
- throw new SoftKeyboardException($"Unable to retrive {typeof(PlatformView)} to determine soft keyboard status");
+ throw new SoftKeyboardException($"Unable to retrieve {typeof(PlatformView)} to determine soft keyboard status");
}
return platformView.IsSoftKeyboardShowing();
}
static bool TryGetPlatformView(this ITextInput textInput,
- [NotNullWhen(true)] out PlatformView? platformView,
- [NotNullWhen(true)] out IPlatformViewHandler? handler,
- [NotNullWhen(true)] out IView? view)
+ [NotNullWhen(true)] out PlatformView? platformView,
+ [NotNullWhen(true)] out IPlatformViewHandler? handler,
+ [NotNullWhen(true)] out IView? view)
{
- if (textInput is not IView iView ||
- iView.Handler is not IPlatformViewHandler platformViewHandler)
+ if (textInput is not IView { Handler: IPlatformViewHandler platformViewHandler } iView)
{
platformView = null;
handler = null;
From 27e218ee1f541ef11d2cb0fb748e2c10da6b34bb Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Tue, 5 Nov 2024 15:38:30 -0800
Subject: [PATCH 080/171] Refactor Code + Performance Improvements
---
.editorconfig | 5 +-
.../CameraManager.android.cs | 25 ++----
.../CameraManager.macios.cs | 16 ++--
.../CameraManager.shared.cs | 2 +-
.../Handlers/CameraViewHandler.shared.cs | 2 +-
.../Interfaces/ICameraProvider.shared.cs | 4 +-
.../MediaCaptureFailedEventArgs.shared.cs | 17 ++--
.../Providers/CameraProvider.android.cs | 2 +-
.../Views/CameraView.shared.cs | 4 +-
.../Badge/Android/BadgeFactory.android.cs | 7 +-
.../FileSaver/FileSaveException.shared.cs | 14 ++-
.../FileSaverImplementation.android.cs | 1 +
.../FileSaverImplementation.shared.cs | 2 +-
.../FileSaver/FileSaverResult.shared.cs | 6 +-
.../FolderPickerImplementation.android.cs | 6 +-
.../Extensions/WindowExtensions.android.cs | 3 +-
.../Interfaces/IDockLayout.shared.cs | 10 +--
.../Interfaces/IDrawingLine.shared.cs | 2 +-
.../Interfaces/IDrawingView.shared.cs | 6 +-
.../Interfaces/IExpander.shared.cs | 6 +-
.../Interfaces/IPopup.shared.cs | 2 +-
.../Layouts/DockLayoutManager.shared.cs | 16 ++--
.../UniformItemsLayoutManager.shared.cs | 22 ++---
.../DrawingLineCompletedEventArgs.shared.cs | 17 ++--
.../DrawingLineStartedEventArgs.shared.cs | 17 ++--
.../Primitives/ExpandDirection.shared.cs | 2 +-
.../ExpandedChangedEventArgs.shared.cs | 15 ++--
.../Primitives/MathOperator.shared.cs | 40 ++++-----
...auiDrawingLineCompletedEventArgs.shared.cs | 14 ++-
.../MauiDrawingStartedEventArgs.shared.cs | 14 ++-
.../MauiOnDrawingEventArgs.shared.cs | 14 ++-
.../Primitives/PointDrawnEventArgs.shared.cs | 17 ++--
.../PopupDismissedEventArgs.shared.cs | 35 +++-----
.../Primitives/SnackbarOptions.shared.cs | 2 +-
.../Views/Alert/AlertView.macios.cs | 2 +-
.../Views/DrawingView/DrawingLine.shared.cs | 4 +-
.../PlatformView/MauiDrawingView.android.cs | 13 +--
.../PlatformView/MauiDrawingView.shared.cs | 9 +-
.../Service/DrawingViewService.macios.cs | 18 ++--
.../Views/PaddedButton.macios.cs | 16 ++--
.../Views/PaddedLabel.macios.cs | 28 ++----
.../Views/Popup/MauiPopup.android.cs | 46 +++++-----
.../Views/Popup/MauiPopup.macios.cs | 19 ++--
.../Views/Popup/PopupExtensions.android.cs | 18 ++--
.../Views/Popup/PopupExtensions.macios.cs | 6 +-
.../Views/RoundedView.macios.cs | 37 +++-----
.../MauiSemanticOrderView.android.cs | 27 +++---
.../MauiSemanticOrderView.macios.cs | 3 +-
.../Views/Snackbar/PlatformSnackbar.macios.cs | 2 +-
.../Views/Toast/PlatformToast.macios.cs | 4 +-
.../CommunityToolkit.Maui.MediaElement.csproj | 2 +-
.../Converters/MediaSourceConverter.cs | 7 +-
.../Handlers/MediaElementHandler.net.cs | 4 +-
.../Interfaces/IMediaElement.cs | 2 +-
.../MediaElement.shared.cs | 31 +++++--
.../MediaSource/MediaSource.shared.cs | 2 +-
.../Primitives/MediaFailedEventArgs.cs | 17 ++--
.../MediaPositionChangedEventArgs.cs | 17 ++--
.../Primitives/MediaStateChangedEventArgs.cs | 22 ++---
.../Primitives/SeekRequestedEventArgs.cs | 17 ++--
.../Services/MediaControlsService.android.cs | 16 +++-
.../Views/MauiMediaElement.android.cs | 2 +-
.../Views/MediaManager.android.cs | 6 +-
.../Behaviors/GestureManagerTests.cs | 2 +-
.../Views/Popup/PopupTests.cs | 2 +-
.../Alerts/Snackbar/Snackbar.android.cs | 88 +++++++++----------
.../Alerts/Snackbar/Snackbar.macios.cs | 2 +-
.../Alerts/Toast/Toast.android.cs | 9 +-
.../Alerts/Toast/Toast.macios.cs | 11 +--
.../Alerts/Toast/Toast.shared.cs | 2 +-
.../Animations/BaseAnimation.shared.cs | 36 ++++----
.../Animations/FadeAnimation.shared.cs | 12 +--
.../Behaviors/AnimationBehavior.shared.cs | 54 +++++++-----
.../IconTintColorBehavior.android.cs | 6 +-
.../IconTintColorBehavior.macios.cs | 2 +-
.../StatusBar/StatusBarBehavior.shared.cs | 6 +-
.../Touch/GestureManager.shared.cs | 2 +-
.../Touch/TouchBehavior.android.cs | 9 --
.../Touch/TouchBehavior.macios.cs | 25 +++---
.../Touch/TouchBehavior.methods.shared.cs | 2 +-
.../CharactersValidationBehavior.shared.cs | 3 +-
.../MultiValidationBehavior.shared.cs | 6 +-
.../NumericValidationBehavior.shared.cs | 2 +-
.../TextValidationBehavior.shared.cs | 3 +-
.../Validators/ValidationBehavior.shared.cs | 1 -
.../Converters/BaseConverter.shared.cs | 4 +-
.../Converters/BaseConverterOneWay.shared.cs | 6 +-
.../BoolToObjectConverter.shared.cs | 2 +-
.../ByteArrayToImageSourceConverter.shared.cs | 7 +-
.../ColorToStringConverter.shared.cs | 7 +-
.../Converters/CompareConverter.shared.cs | 3 +-
.../DateTimeOffsetConverter.shared.cs | 3 -
.../Converters/EnumToBoolConverter.shared.cs | 2 +-
.../Converters/EnumToIntConverter.shared.cs | 1 -
.../IndexToArrayItemConverter.shared.cs | 9 +-
.../Converters/IntToBoolConverter.shared.cs | 4 +-
.../InvertedBoolConverter.shared.cs | 2 +-
.../Converters/IsInRangeConverter.shared.cs | 2 +-
.../IsListNotNullOrEmptyConverter.shared.cs | 6 +-
.../IsListNullOrEmptyConverter.shared.cs | 20 +++--
.../Converters/IsNotNullConverter.shared.cs | 4 +-
.../Converters/IsNullConverter.shared.cs | 4 +-
.../IsStringNotNullOrEmptyConverter.shared.cs | 6 +-
.../IsStringNotNullOrWhiteSpaceConverter.cs | 6 +-
.../IsStringNullOrEmptyConverter.shared.cs | 4 +-
...sStringNullOrWhiteSpaceConverter.shared.cs | 4 +-
.../MathExpression.shared.cs | 22 +++--
.../Converters/MultiConverter.shared.cs | 4 +-
.../MultiConverterParameter.shared.cs | 2 +-
.../StateToBooleanConverter.shared.cs | 2 -
.../StringToListConverter.shared.cs | 4 +-
.../Converters/TextCaseConverter.shared.cs | 4 +-
.../TimeSpanToSecondsConverter.shared.cs | 2 -
.../VariableMultiValueConverter.shared.cs | 2 +-
.../AppThemeResourceExtension.shared.cs | 2 +-
.../ColorAnimationExtensions.shared.cs | 4 +-
.../CryptographyExtensions.shared.cs | 2 +-
...opertyChangedEventArgsExtensions.shared.cs | 28 +++---
.../ServiceCollectionExtensions.shared.cs | 2 +-
.../Popup/Popup.macios.cs | 28 +++---
.../GravatarImageSource.shared.cs | 12 +--
.../StateContainerController.shared.cs | 2 +-
src/CommunityToolkit.Maui/Options.cs | 6 +-
.../NavigationBar.Impl.android.cs | 16 +++-
.../NavigationBar.Properties.cs | 4 +-
.../Popup/PopupLifecycleController.cs | 2 +-
.../Views/DrawingView/DrawingView.shared.cs | 10 +--
.../Views/Expander/Expander.shared.cs | 2 +-
.../Views/LazyView/LazyView.shared.cs | 2 +-
.../Views/Popup/Popup.shared.cs | 16 ++--
130 files changed, 593 insertions(+), 742 deletions(-)
diff --git a/.editorconfig b/.editorconfig
index 467b91c05c..035a9bac01 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -142,4 +142,7 @@ dotnet_diagnostic.CA2208.severity = error
dotnet_diagnostic.CA1834.severity = error
# IDE0220: Add explicit cast
-dotnet_diagnostic.IDE0220.severity = error
\ No newline at end of file
+dotnet_diagnostic.IDE0220.severity = error
+
+# Warning CA2264 : Calling 'ArgumentNullException.ThrowIfNull' and passing a non-nullable value is a no-op
+dotnet_diagnostic.CA2264.severity = error
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Camera/CameraManager.android.cs b/src/CommunityToolkit.Maui.Camera/CameraManager.android.cs
index 70256b6b17..23cfdd4c63 100644
--- a/src/CommunityToolkit.Maui.Camera/CameraManager.android.cs
+++ b/src/CommunityToolkit.Maui.Camera/CameraManager.android.cs
@@ -321,37 +321,22 @@ public override void OnError(ImageCaptureException exception)
}
}
- sealed class ResolutionFilter : Java.Lang.Object, IResolutionFilter
+ sealed class ResolutionFilter(Android.Util.Size size) : Java.Lang.Object, IResolutionFilter
{
- public Android.Util.Size TargetSize { get; set; }
-
- public ResolutionFilter(Android.Util.Size size)
- {
- TargetSize = size;
- }
+ public Android.Util.Size TargetSize { get; set; } = size;
public IList Filter(IList supportedSizes, int rotationDegrees)
{
var filteredList = supportedSizes.Where(size => size.Width <= TargetSize.Width && size.Height <= TargetSize.Height)
.OrderByDescending(size => size.Width * size.Height).ToList();
- if (!filteredList.Any())
- {
- return supportedSizes;
- }
-
- return filteredList;
+ return filteredList.Count is 0 ? supportedSizes : filteredList;
}
}
- sealed class Observer : Java.Lang.Object, IObserver
+ sealed class Observer(Action action) : Java.Lang.Object, IObserver
{
- Action observerAction = (Java.Lang.Object? o) => { };
-
- public Observer(Action action)
- {
- observerAction = action;
- }
+ readonly Action observerAction = action;
public void OnChanged(Java.Lang.Object? value)
{
diff --git a/src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs b/src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs
index 57c297f451..8136af4374 100644
--- a/src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs
+++ b/src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs
@@ -30,8 +30,10 @@ public UIView CreatePlatformView()
SessionPreset = AVCaptureSession.PresetPhoto
};
- var previewView = new PreviewView();
- previewView.Session = captureSession;
+ var previewView = new PreviewView
+ {
+ Session = captureSession
+ };
return previewView;
}
@@ -60,7 +62,7 @@ public partial void UpdateZoom(float zoomLevel)
return;
}
- captureDevice.LockForConfiguration(out NSError error);
+ captureDevice.LockForConfiguration(out NSError? error);
if (error is not null)
{
Trace.WriteLine(error);
@@ -78,7 +80,7 @@ public async partial ValueTask UpdateCaptureResolution(Size resolution, Cancella
return;
}
- captureDevice.LockForConfiguration(out NSError error);
+ captureDevice.LockForConfiguration(out NSError? error);
if (error is not null)
{
Trace.WriteLine(error);
@@ -97,14 +99,14 @@ public async partial ValueTask UpdateCaptureResolution(Size resolution, Cancella
return d.Width <= resolution.Width && d.Height <= resolution.Height;
}).ToList();
- filteredFormatList = (filteredFormatList.Any() ? filteredFormatList : cameraView.SelectedCamera.SupportedFormats)
+ filteredFormatList = [.. (filteredFormatList.Count is not 0 ? filteredFormatList : cameraView.SelectedCamera.SupportedFormats)
.OrderByDescending(f =>
{
var d = ((CMVideoFormatDescription)f.FormatDescription).Dimensions;
return d.Width * d.Height;
- }).ToList();
+ })];
- if (filteredFormatList.Any())
+ if (filteredFormatList.Count is not 0)
{
captureDevice.ActiveFormat = filteredFormatList.First();
}
diff --git a/src/CommunityToolkit.Maui.Camera/CameraManager.shared.cs b/src/CommunityToolkit.Maui.Camera/CameraManager.shared.cs
index 7155705950..fe846cc604 100644
--- a/src/CommunityToolkit.Maui.Camera/CameraManager.shared.cs
+++ b/src/CommunityToolkit.Maui.Camera/CameraManager.shared.cs
@@ -25,7 +25,7 @@ partial class CameraManager(
internal bool IsInitialized { get; private set; }
///
- /// Whether the required permissions have been granted by the user through the use of the API.
+ /// Whether the user has granted the required permissions through the use of the API.
///
/// Returns true if permission has been granted, false otherwise.
public async Task ArePermissionsGranted()
diff --git a/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs b/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs
index 2d28f10a2e..3836325a10 100644
--- a/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs
+++ b/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs
@@ -67,7 +67,7 @@ public void Dispose()
}
///
- /// Creates a platform specific view that will be rendered on that platform.
+ /// Creates a platform-specific view that will be rendered on that platform.
///
protected override NativePlatformCameraPreviewView CreatePlatformView()
{
diff --git a/src/CommunityToolkit.Maui.Camera/Interfaces/ICameraProvider.shared.cs b/src/CommunityToolkit.Maui.Camera/Interfaces/ICameraProvider.shared.cs
index 5dfd066044..3f0090e2ec 100644
--- a/src/CommunityToolkit.Maui.Camera/Interfaces/ICameraProvider.shared.cs
+++ b/src/CommunityToolkit.Maui.Camera/Interfaces/ICameraProvider.shared.cs
@@ -13,7 +13,7 @@ public interface ICameraProvider
///
/// List is initialized using
///
- public IReadOnlyList? AvailableCameras { get; }
+ IReadOnlyList? AvailableCameras { get; }
///
/// Assigns with the cameras available on device
@@ -21,5 +21,5 @@ public interface ICameraProvider
///
///
[MemberNotNull(nameof(AvailableCameras))]
- public ValueTask RefreshAvailableCameras(CancellationToken token);
+ ValueTask RefreshAvailableCameras(CancellationToken token);
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Camera/Primitives/MediaCaptureFailedEventArgs.shared.cs b/src/CommunityToolkit.Maui.Camera/Primitives/MediaCaptureFailedEventArgs.shared.cs
index 758ca0134c..d829e7b3ba 100644
--- a/src/CommunityToolkit.Maui.Camera/Primitives/MediaCaptureFailedEventArgs.shared.cs
+++ b/src/CommunityToolkit.Maui.Camera/Primitives/MediaCaptureFailedEventArgs.shared.cs
@@ -3,19 +3,14 @@
///
/// Event args containing all contextual information related to a media capture failure event.
///
-public class MediaCaptureFailedEventArgs : EventArgs
+///
+/// Creates a new instance of .
+///
+/// A string containing the reason why the capture attempt failed.
+public class MediaCaptureFailedEventArgs(string failureReason) : EventArgs
{
- ///
- /// Creates a new instance of .
- ///
- /// A string containing the reason why the capture attempt failed.
- public MediaCaptureFailedEventArgs(string failureReason)
- {
- FailureReason = failureReason;
- }
-
///
/// Gets the reason why the capture attempt failed.
///
- public string FailureReason { get; }
+ public string FailureReason { get; } = failureReason;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Camera/Providers/CameraProvider.android.cs b/src/CommunityToolkit.Maui.Camera/Providers/CameraProvider.android.cs
index e1c9eeda79..d12f0bbcb0 100644
--- a/src/CommunityToolkit.Maui.Camera/Providers/CameraProvider.android.cs
+++ b/src/CommunityToolkit.Maui.Camera/Providers/CameraProvider.android.cs
@@ -12,7 +12,7 @@
namespace CommunityToolkit.Maui.Core;
-[SupportedOSPlatform("android21.0")]
+[SupportedOSPlatform("Android21.0")]
partial class CameraProvider
{
readonly Context context = Android.App.Application.Context;
diff --git a/src/CommunityToolkit.Maui.Camera/Views/CameraView.shared.cs b/src/CommunityToolkit.Maui.Camera/Views/CameraView.shared.cs
index 5e0619416d..84e0db8da1 100644
--- a/src/CommunityToolkit.Maui.Camera/Views/CameraView.shared.cs
+++ b/src/CommunityToolkit.Maui.Camera/Views/CameraView.shared.cs
@@ -119,7 +119,7 @@ public event EventHandler MediaCaptured
/// Gets the Command that triggers an image capture.
///
///
- /// has a of Command<CancellationToken> which requires a as a CommandParameter. See and for more information on passing a into as a CommandParameter"
+ /// has a of Command<CancellationToken> which requires a as a CommandParameter. See and for more information on passing a into as a CommandParameter
///
public Command CaptureImageCommand => (Command)GetValue(CaptureImageCommandProperty);
@@ -127,7 +127,7 @@ public event EventHandler MediaCaptured
/// Gets the Command that starts the camera preview.
///
/// ///
- /// has a of Command<CancellationToken> which requires a as a CommandParameter. See and for more information on passing a into as a CommandParameter"
+ /// has a of Command<CancellationToken> which requires a as a CommandParameter. See and for more information on passing a into as a CommandParameter
///
public Command StartCameraPreviewCommand => (Command)GetValue(StartCameraPreviewCommandProperty);
diff --git a/src/CommunityToolkit.Maui.Core/Essentials/Badge/Android/BadgeFactory.android.cs b/src/CommunityToolkit.Maui.Core/Essentials/Badge/Android/BadgeFactory.android.cs
index 560a497260..f9aa1e5781 100644
--- a/src/CommunityToolkit.Maui.Core/Essentials/Badge/Android/BadgeFactory.android.cs
+++ b/src/CommunityToolkit.Maui.Core/Essentials/Badge/Android/BadgeFactory.android.cs
@@ -45,11 +45,6 @@ public static IBadgeProvider GetBadgeProvider()
Application.Context.PackageManager?.ResolveActivity(intent, PackageManager.ResolveInfoFlags.Of(0)) :
Application.Context.PackageManager?.ResolveActivity(intent, PackageInfoFlags.MatchDefaultOnly);
- if (resolveInfo is { ActivityInfo.PackageName: not null })
- {
- return resolveInfo.ActivityInfo.PackageName;
- }
-
- return Application.Context.PackageName;
+ return resolveInfo is { ActivityInfo.PackageName: not null } ? resolveInfo.ActivityInfo.PackageName : Application.Context.PackageName;
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaveException.shared.cs b/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaveException.shared.cs
index 705b635c49..4dd3d9a624 100644
--- a/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaveException.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaveException.shared.cs
@@ -1,15 +1,11 @@
namespace CommunityToolkit.Maui.Storage;
///
-/// Exception occurred if file is not saved
+/// Exception occurred if the file is not saved
///
-public sealed class FileSaveException : Exception
+///
+/// Initializes a new instance of
+///
+public sealed class FileSaveException(string message) : Exception(message)
{
- ///
- /// Initializes a new instance of
- ///
- public FileSaveException(string message) : base(message)
- {
-
- }
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs b/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs
index 4fa686e5d7..51cf2bd437 100644
--- a/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs
+++ b/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs
@@ -1,4 +1,5 @@
using System.Buffers;
+using System.Runtime.Versioning;
using System.Web;
using Android.Content;
using Android.OS;
diff --git a/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.shared.cs b/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.shared.cs
index d222fb4a2a..a90fb6995f 100644
--- a/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.shared.cs
@@ -81,7 +81,7 @@ static async Task WriteStream(Stream stream, string filePath, IProgress?
double totalRead = 0;
while ((bytesRead = await stream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false)) > 0)
{
- await fileStream.WriteAsync(buffer, 0, bytesRead, cancellationToken).ConfigureAwait(false);
+ await fileStream.WriteAsync(buffer.AsMemory(0, bytesRead), cancellationToken).ConfigureAwait(false);
totalRead += bytesRead;
progress?.Report(totalRead / stream.Length);
}
diff --git a/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverResult.shared.cs b/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverResult.shared.cs
index 2ae0d0d8fe..ad8833f8b7 100644
--- a/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverResult.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverResult.shared.cs
@@ -5,19 +5,19 @@ namespace CommunityToolkit.Maui.Storage;
///
/// Result of the
///
-/// Saved file path
+/// The saved file path
/// Exception if operation failed
public record FileSaverResult(string? FilePath, Exception? Exception)
{
///
- /// Check if operation was successful.
+ /// Check if the operation was successful.
///
[MemberNotNullWhen(true, nameof(FilePath))]
[MemberNotNullWhen(false, nameof(Exception))]
public bool IsSuccessful => Exception is null;
///
- /// Check if operation was successful.
+ /// Check if the operation was successful.
///
[MemberNotNull(nameof(FilePath))]
public void EnsureSuccess()
diff --git a/src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.android.cs b/src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.android.cs
index 21607b0128..c606d6cf68 100644
--- a/src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.android.cs
+++ b/src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.android.cs
@@ -1,4 +1,5 @@
using System.Diagnostics;
+using System.Runtime.Versioning;
using System.Web;
using Android.Content;
using Android.Provider;
@@ -11,9 +12,10 @@
namespace CommunityToolkit.Maui.Storage;
///
+[SupportedOSPlatform("Android26.0")]
public sealed partial class FolderPickerImplementation : IFolderPicker
{
- async Task InternalPickAsync(string initialPath, CancellationToken cancellationToken)
+ static async Task InternalPickAsync(string initialPath, CancellationToken cancellationToken)
{
if (!OperatingSystem.IsAndroidVersionAtLeast(26) && !string.IsNullOrEmpty(initialPath))
{
@@ -52,7 +54,7 @@ void OnResult(Intent resultIntent)
}
}
- Task InternalPickAsync(CancellationToken cancellationToken)
+ static Task InternalPickAsync(CancellationToken cancellationToken)
{
return InternalPickAsync(AndroidPathExtensions.GetExternalDirectory(), cancellationToken);
}
diff --git a/src/CommunityToolkit.Maui.Core/Extensions/WindowExtensions.android.cs b/src/CommunityToolkit.Maui.Core/Extensions/WindowExtensions.android.cs
index 1bbb8333ca..b21466033a 100644
--- a/src/CommunityToolkit.Maui.Core/Extensions/WindowExtensions.android.cs
+++ b/src/CommunityToolkit.Maui.Core/Extensions/WindowExtensions.android.cs
@@ -1,5 +1,4 @@
-using Android.OS;
-using Android.Views;
+using Android.Views;
namespace CommunityToolkit.Maui.Core.Extensions;
diff --git a/src/CommunityToolkit.Maui.Core/Interfaces/IDockLayout.shared.cs b/src/CommunityToolkit.Maui.Core/Interfaces/IDockLayout.shared.cs
index 6dfe484afb..0ecf0ddb8f 100644
--- a/src/CommunityToolkit.Maui.Core/Interfaces/IDockLayout.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Interfaces/IDockLayout.shared.cs
@@ -8,29 +8,29 @@ public interface IDockLayout : ILayout
///
/// If true, the last child is expanded to fill the remaining space (default: true).
///
- public bool ShouldExpandLastChild { get; }
+ bool ShouldExpandLastChild { get; }
///
/// Horizontal spacing between docked views.
///
- public double HorizontalSpacing { get; }
+ double HorizontalSpacing { get; }
///
/// Vertical spacing between docked views.
///
- public double VerticalSpacing { get; }
+ double VerticalSpacing { get; }
///
/// Gets the docking position for a view.
///
/// A view that belongs to the DockLayout.
/// DockPosition that signifies where the view will dock.
- public DockPosition GetDockPosition(IView view);
+ DockPosition GetDockPosition(IView view);
///
/// Adds a view to the layout container at the given docking position.
///
/// Child view to be added to the container.
/// Docking position for the view.
- public void Add(IView view, DockPosition position = DockPosition.None);
+ void Add(IView view, DockPosition position = DockPosition.None);
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Interfaces/IDrawingLine.shared.cs b/src/CommunityToolkit.Maui.Core/Interfaces/IDrawingLine.shared.cs
index 6fde7f4d38..fb7c1b92a9 100644
--- a/src/CommunityToolkit.Maui.Core/Interfaces/IDrawingLine.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Interfaces/IDrawingLine.shared.cs
@@ -35,7 +35,7 @@ public interface IDrawingLine
///
/// Retrieves a containing an image of this line, based on the data.
///
- /// Desired width of the image that is returned.
+ /// The desired width of the image that is returned.
/// Desired height of the image that is returned.
/// Background of the generated image.
/// containing the data of the requested image with data that's currently on the .
diff --git a/src/CommunityToolkit.Maui.Core/Interfaces/IDrawingView.shared.cs b/src/CommunityToolkit.Maui.Core/Interfaces/IDrawingView.shared.cs
index bef0059b4b..ca1b8c5209 100644
--- a/src/CommunityToolkit.Maui.Core/Interfaces/IDrawingView.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Interfaces/IDrawingView.shared.cs
@@ -36,14 +36,14 @@ public interface IDrawingView : IView
bool ShouldClearOnFinish { get; }
///
- /// Allows to draw on the .
+ /// Allows drawing on the .
///
Action? DrawAction { get; }
///
/// Retrieves a containing an image of the that are currently drawn on the .
///
- /// Desired width of the image that is returned. The image will be resized proportionally.
+ /// The desired width of the image that is returned. The image will be resized proportionally.
/// Desired height of the image that is returned. The image will be resized proportionally.
/// .
/// containing the data of the requested image with data that's currently on the .
@@ -61,7 +61,7 @@ public interface IDrawingView : IView
void OnDrawingLineStarted(PointF point);
///
- /// Event occurred when drawing line cancelled
+ /// Event occurred when drawing line canceled
///
void OnDrawingLineCancelled();
diff --git a/src/CommunityToolkit.Maui.Core/Interfaces/IExpander.shared.cs b/src/CommunityToolkit.Maui.Core/Interfaces/IExpander.shared.cs
index c6e41dd92d..8d05ed079a 100644
--- a/src/CommunityToolkit.Maui.Core/Interfaces/IExpander.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Interfaces/IExpander.shared.cs
@@ -8,17 +8,17 @@ public interface IExpander : IContentView
///
/// Expander header.
///
- public IView? Header { get; }
+ IView? Header { get; }
///
/// Gets or sets expand direction.
///
- public ExpandDirection Direction { get; }
+ ExpandDirection Direction { get; }
///
/// Gets or sets Expander collapsible state.
///
- public bool IsExpanded { get; set; }
+ bool IsExpanded { get; set; }
///
/// Action when changes
diff --git a/src/CommunityToolkit.Maui.Core/Interfaces/IPopup.shared.cs b/src/CommunityToolkit.Maui.Core/Interfaces/IPopup.shared.cs
index 1a6a06706c..b596eb8f22 100644
--- a/src/CommunityToolkit.Maui.Core/Interfaces/IPopup.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Interfaces/IPopup.shared.cs
@@ -55,7 +55,7 @@ public interface IPopup : IElement, IVisualTreeElement, IAsynchronousHandler
void OnOpened();
///
- /// Occurs when the Popup is dismissed by a user tapping outside of the Popup.
+ /// Occurs when the Popup is dismissed by a user tapping outside the Popup.
///
void OnDismissedByTappingOutsideOfPopup();
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Layouts/DockLayoutManager.shared.cs b/src/CommunityToolkit.Maui.Core/Layouts/DockLayoutManager.shared.cs
index 34aeddd694..8458c59474 100644
--- a/src/CommunityToolkit.Maui.Core/Layouts/DockLayoutManager.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Layouts/DockLayoutManager.shared.cs
@@ -5,18 +5,12 @@ namespace CommunityToolkit.Maui.Core.Layouts;
///
/// for .
///
-public class DockLayoutManager : LayoutManager
+///
+/// Initialize a new instance of .
+///
+public class DockLayoutManager(IDockLayout dockLayout) : LayoutManager(dockLayout)
{
- readonly IDockLayout dockLayout;
-
- ///
- /// Initialize a new instance of .
- ///
- public DockLayoutManager(IDockLayout dockLayout)
- : base(dockLayout)
- {
- this.dockLayout = dockLayout;
- }
+ readonly IDockLayout dockLayout = dockLayout;
///
public override Size Measure(double widthConstraint, double heightConstraint)
diff --git a/src/CommunityToolkit.Maui.Core/Layouts/UniformItemsLayoutManager.shared.cs b/src/CommunityToolkit.Maui.Core/Layouts/UniformItemsLayoutManager.shared.cs
index ea5eeec28a..b23327c983 100644
--- a/src/CommunityToolkit.Maui.Core/Layouts/UniformItemsLayoutManager.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Layouts/UniformItemsLayoutManager.shared.cs
@@ -5,20 +5,14 @@ namespace CommunityToolkit.Maui.Core.Layouts;
///
/// for .
///
-public class UniformItemsLayoutManager : LayoutManager
+///
+/// Initialize a new instance of .
+///
+public class UniformItemsLayoutManager(IUniformItemsLayout uniformItemsLayout) : LayoutManager(uniformItemsLayout)
{
double childWidth, childHeight;
- readonly IUniformItemsLayout uniformItemsLayout;
-
- ///
- /// Initialize a new instance of .
- ///
- public UniformItemsLayoutManager(IUniformItemsLayout uniformItemsLayout)
- : base(uniformItemsLayout)
- {
- this.uniformItemsLayout = uniformItemsLayout;
- }
+ readonly IUniformItemsLayout uniformItemsLayout = uniformItemsLayout;
///
/// Arrange children
@@ -28,9 +22,9 @@ public UniformItemsLayoutManager(IUniformItemsLayout uniformItemsLayout)
public override Size ArrangeChildren(Rect rectangle)
{
var width = rectangle.Width - uniformItemsLayout.Padding.HorizontalThickness;
- var visibleChildren = uniformItemsLayout.Where(x => x.Visibility == Visibility.Visible).ToArray();
+ var visibleChildren = uniformItemsLayout.Where(static x => x.Visibility is Visibility.Visible).ToArray();
- if (visibleChildren.Length == 0 || width == 0)
+ if (visibleChildren.Length is 0 || width is 0)
{
return rectangle.Size;
}
@@ -67,7 +61,7 @@ public override Size ArrangeChildren(Rect rectangle)
/// Grid size
public override Size Measure(double widthConstraint, double heightConstraint)
{
- var visibleChildren = uniformItemsLayout.Where(x => x.Visibility == Visibility.Visible).ToArray();
+ var visibleChildren = uniformItemsLayout.Where(static x => x.Visibility is Visibility.Visible).ToArray();
if (childWidth == 0)
{
diff --git a/src/CommunityToolkit.Maui.Core/Primitives/DrawingLineCompletedEventArgs.shared.cs b/src/CommunityToolkit.Maui.Core/Primitives/DrawingLineCompletedEventArgs.shared.cs
index 6c4fed6764..fe785c8049 100644
--- a/src/CommunityToolkit.Maui.Core/Primitives/DrawingLineCompletedEventArgs.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Primitives/DrawingLineCompletedEventArgs.shared.cs
@@ -3,19 +3,14 @@
///
/// Contains last drawing line
///
-public class DrawingLineCompletedEventArgs : EventArgs
+///
+/// Initialize a new instance of
+///
+/// Last drawing line
+public class DrawingLineCompletedEventArgs(IDrawingLine lastDrawingLine) : EventArgs
{
- ///
- /// Initialize a new instance of
- ///
- /// Last drawing line
- public DrawingLineCompletedEventArgs(IDrawingLine lastDrawingLine)
- {
- LastDrawingLine = lastDrawingLine;
- }
-
///
/// Last drawing line
///
- public IDrawingLine LastDrawingLine { get; }
+ public IDrawingLine LastDrawingLine { get; } = lastDrawingLine;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Primitives/DrawingLineStartedEventArgs.shared.cs b/src/CommunityToolkit.Maui.Core/Primitives/DrawingLineStartedEventArgs.shared.cs
index 67c5dedccb..ec44100a38 100644
--- a/src/CommunityToolkit.Maui.Core/Primitives/DrawingLineStartedEventArgs.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Primitives/DrawingLineStartedEventArgs.shared.cs
@@ -3,19 +3,14 @@ namespace CommunityToolkit.Maui.Core;
///
/// Contains last drawing point
///
-public class DrawingLineStartedEventArgs : EventArgs
+///
+/// Initialize a new instance of
+///
+///
+public class DrawingLineStartedEventArgs(PointF point) : EventArgs
{
- ///
- /// Initialize a new instance of
- ///
- ///
- public DrawingLineStartedEventArgs(PointF point)
- {
- Point = point;
- }
-
///
/// Last drawing point
///
- public PointF Point { get; }
+ public PointF Point { get; } = point;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Primitives/ExpandDirection.shared.cs b/src/CommunityToolkit.Maui.Core/Primitives/ExpandDirection.shared.cs
index 2006a871ee..b59d58c3d3 100644
--- a/src/CommunityToolkit.Maui.Core/Primitives/ExpandDirection.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Primitives/ExpandDirection.shared.cs
@@ -1,7 +1,7 @@
namespace CommunityToolkit.Maui.Core;
///
-/// Expander expand direction.
+/// Direction of expansion
///
public enum ExpandDirection
{
diff --git a/src/CommunityToolkit.Maui.Core/Primitives/ExpandedChangedEventArgs.shared.cs b/src/CommunityToolkit.Maui.Core/Primitives/ExpandedChangedEventArgs.shared.cs
index 39668176c4..17b0eaceab 100644
--- a/src/CommunityToolkit.Maui.Core/Primitives/ExpandedChangedEventArgs.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Primitives/ExpandedChangedEventArgs.shared.cs
@@ -3,18 +3,13 @@
///
/// Contains Expander IsExpanded state.
///
-public class ExpandedChangedEventArgs : EventArgs
+///
+/// Initialize a new instance of
+///
+public class ExpandedChangedEventArgs(bool isExpanded) : EventArgs
{
- ///
- /// Initialize a new instance of
- ///
- public ExpandedChangedEventArgs(bool isExpanded)
- {
- IsExpanded = isExpanded;
- }
-
///
/// True if Is Expanded.
///
- public bool IsExpanded { get; }
+ public bool IsExpanded { get; } = isExpanded;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Primitives/MathOperator.shared.cs b/src/CommunityToolkit.Maui.Core/Primitives/MathOperator.shared.cs
index f2b137f5b1..22d0f1de97 100644
--- a/src/CommunityToolkit.Maui.Core/Primitives/MathOperator.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Primitives/MathOperator.shared.cs
@@ -20,44 +20,36 @@ public enum MathOperatorPrecedence
///
/// Math Operator
///
-public sealed class MathOperator
+///
+/// Initialize
+///
+/// Name
+/// Number of Numerals
+/// Math Operator Preference
+/// Calculation Function
+public sealed class MathOperator(
+ string name,
+ int numericCount,
+ MathOperatorPrecedence precedence,
+ Func calculateFunc)
{
- ///
- /// Initialize
- ///
- /// Name
- /// Number of Numerals
- /// Math Operator Preference
- /// Calculation Function
- public MathOperator(
- string name,
- int numericCount,
- MathOperatorPrecedence precedence,
- Func calculateFunc)
- {
- Name = name;
- CalculateFunc = calculateFunc;
- Precedence = precedence;
- NumericCount = numericCount;
- }
-
///
/// Name
///
- public string Name { get; }
+ public string Name { get; } = name;
///
/// Number of Numerals
///
- public int NumericCount { get; }
+ public int NumericCount { get; } = numericCount;
///
/// Math Operator Precedence
///
- public MathOperatorPrecedence Precedence { get; }
+ public MathOperatorPrecedence Precedence { get; } = precedence;
///
/// Calculation Function
///
- public Func CalculateFunc { get; }
+ public Func CalculateFunc { get; } = calculateFunc;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Primitives/MauiDrawingLineCompletedEventArgs.shared.cs b/src/CommunityToolkit.Maui.Core/Primitives/MauiDrawingLineCompletedEventArgs.shared.cs
index 1d264c89ea..6c556a4046 100644
--- a/src/CommunityToolkit.Maui.Core/Primitives/MauiDrawingLineCompletedEventArgs.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Primitives/MauiDrawingLineCompletedEventArgs.shared.cs
@@ -5,16 +5,14 @@ namespace CommunityToolkit.Maui.Core;
///
/// Contains last drawing line
///
-public class MauiDrawingLineCompletedEventArgs : EventArgs
+///
+/// Initializes last drawing line
+///
+/// Last drawing line
+public class MauiDrawingLineCompletedEventArgs(MauiDrawingLine line) : EventArgs
{
- ///
- /// Initializes last drawing line
- ///
- /// Last drawing line
- public MauiDrawingLineCompletedEventArgs(MauiDrawingLine line) => Line = line;
-
///
/// Last drawing line
///
- public MauiDrawingLine Line { get; }
+ public MauiDrawingLine Line { get; } = line;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Primitives/MauiDrawingStartedEventArgs.shared.cs b/src/CommunityToolkit.Maui.Core/Primitives/MauiDrawingStartedEventArgs.shared.cs
index 4da0d731e6..35a42b1725 100644
--- a/src/CommunityToolkit.Maui.Core/Primitives/MauiDrawingStartedEventArgs.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Primitives/MauiDrawingStartedEventArgs.shared.cs
@@ -3,16 +3,14 @@ namespace CommunityToolkit.Maui.Core;
///
/// Contains last drawing point
///
-public class MauiDrawingStartedEventArgs : EventArgs
+///
+/// Initializes last drawing point
+///
+/// Last drawing point
+public class MauiDrawingStartedEventArgs(PointF point) : EventArgs
{
- ///
- /// Initializes last drawing point
- ///
- /// Last drawing point
- public MauiDrawingStartedEventArgs(PointF point) => Point = point;
-
///
/// Last drawing point
///
- public PointF Point { get; }
+ public PointF Point { get; } = point;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Primitives/MauiOnDrawingEventArgs.shared.cs b/src/CommunityToolkit.Maui.Core/Primitives/MauiOnDrawingEventArgs.shared.cs
index 3219fe348a..83a855c193 100644
--- a/src/CommunityToolkit.Maui.Core/Primitives/MauiOnDrawingEventArgs.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Primitives/MauiOnDrawingEventArgs.shared.cs
@@ -3,16 +3,14 @@ namespace CommunityToolkit.Maui.Core;
///
/// Contains last drawing point
///
-public class MauiOnDrawingEventArgs : EventArgs
+///
+/// Initializes last drawing point
+///
+/// Last drawing point
+public class MauiOnDrawingEventArgs(PointF point) : EventArgs
{
- ///
- /// Initializes last drawing point
- ///
- /// Last drawing point
- public MauiOnDrawingEventArgs(PointF point) => Point = point;
-
///
/// Last drawing point
///
- public PointF Point { get; }
+ public PointF Point { get; } = point;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Primitives/PointDrawnEventArgs.shared.cs b/src/CommunityToolkit.Maui.Core/Primitives/PointDrawnEventArgs.shared.cs
index 9db009b6c3..8e1f8f191e 100644
--- a/src/CommunityToolkit.Maui.Core/Primitives/PointDrawnEventArgs.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Primitives/PointDrawnEventArgs.shared.cs
@@ -3,19 +3,14 @@ namespace CommunityToolkit.Maui.Core;
///
/// Contains last drawing point
///
-public class PointDrawnEventArgs : EventArgs
+///
+/// Initialize a new instance of
+///
+///
+public class PointDrawnEventArgs(PointF point) : EventArgs
{
- ///
- /// Initialize a new instance of
- ///
- ///
- public PointDrawnEventArgs(PointF point)
- {
- Point = point;
- }
-
///
/// Last drawing point
///
- public PointF Point { get; }
+ public PointF Point { get; } = point;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Primitives/PopupDismissedEventArgs.shared.cs b/src/CommunityToolkit.Maui.Core/Primitives/PopupDismissedEventArgs.shared.cs
index fa53e3f165..9b7cc8fbdb 100644
--- a/src/CommunityToolkit.Maui.Core/Primitives/PopupDismissedEventArgs.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Primitives/PopupDismissedEventArgs.shared.cs
@@ -3,32 +3,25 @@
///
/// Popup dismissed event arguments used when a popup is dismissed.
///
-public class PopupClosedEventArgs
+///
+/// Initialization an instance of .
+///
+///
+/// The result of the popup.
+///
+///
+/// If the popup was dismissed by tapping outside the Popup.
+///
+public class PopupClosedEventArgs(object? result, bool wasDismissedByTappingOutsideOfPopup)
{
- ///
- /// Initialization an instance of .
- ///
- ///
- /// The result of the popup.
- ///
- ///
- /// If the popup was dismissed by tapping outside of the Popup.
- ///
- public PopupClosedEventArgs(object? result, bool wasDismissedByTappingOutsideOfPopup)
- {
- Result = result;
- WasDismissedByTappingOutsideOfPopup = wasDismissedByTappingOutsideOfPopup;
- }
-
///
/// The resulting object to return.
///
- public object? Result { get; }
+ public object? Result { get; } = result;
///
- /// If true, then the user tapped outside the bounds of
- /// the popup (a light dismiss). If false, then the
- /// popup was dismissed by user action or code.
+ /// If true, then the user tapped outside the bounds of the popup (aka "Light Dismiss").
+ /// If false, then the popup was dismissed by user action or code.
///
- public bool WasDismissedByTappingOutsideOfPopup { get; }
+ public bool WasDismissedByTappingOutsideOfPopup { get; } = wasDismissedByTappingOutsideOfPopup;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Primitives/SnackbarOptions.shared.cs b/src/CommunityToolkit.Maui.Core/Primitives/SnackbarOptions.shared.cs
index 27b17412f0..ed205b0b0b 100644
--- a/src/CommunityToolkit.Maui.Core/Primitives/SnackbarOptions.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Primitives/SnackbarOptions.shared.cs
@@ -39,6 +39,6 @@ public class SnackbarOptions : ITextStyle
///
/// Snackbar corner radius
///
- public CornerRadius CornerRadius { get; set; } = new CornerRadius(4, 4, 4, 4);
+ public CornerRadius CornerRadius { get; set; } = new(4, 4, 4, 4);
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Core/Views/Alert/AlertView.macios.cs b/src/CommunityToolkit.Maui.Core/Views/Alert/AlertView.macios.cs
index f95d434d4d..78dbc3327d 100644
--- a/src/CommunityToolkit.Maui.Core/Views/Alert/AlertView.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/Alert/AlertView.macios.cs
@@ -8,7 +8,7 @@ namespace CommunityToolkit.Maui.Core.Views;
///
public class AlertView : UIView
{
- readonly List children = Enumerable.Empty().ToList();
+ readonly List children = [];
///
/// Parent UIView
diff --git a/src/CommunityToolkit.Maui.Core/Views/DrawingView/DrawingLine.shared.cs b/src/CommunityToolkit.Maui.Core/Views/DrawingView/DrawingLine.shared.cs
index e1387164bf..d00ad97fa3 100644
--- a/src/CommunityToolkit.Maui.Core/Views/DrawingView/DrawingLine.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/DrawingView/DrawingLine.shared.cs
@@ -41,7 +41,7 @@ public int Granularity
///
/// Retrieves a containing an image of the collection of that is provided as a parameter.
///
- /// A collection of that a image is generated from.
+ /// A collection of that an image is generated from.
/// The desired dimensions of the generated image.
/// The desired line width to be used in the generated image.
/// The desired color of the line to be used in the generated image.
@@ -61,7 +61,7 @@ public static ValueTask GetImageStream(IEnumerable points,
///
/// Retrieves a containing an image of this line, based on the data.
///
- /// Desired width of the image that is returned.
+ /// The desired width of the image that is returned.
/// Desired height of the image that is returned.
/// Background of the generated image.
///
diff --git a/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.android.cs b/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.android.cs
index 1371cd936d..e61696edc8 100644
--- a/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.android.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.android.cs
@@ -10,16 +10,11 @@
namespace CommunityToolkit.Maui.Core.Views;
-public partial class MauiDrawingView : PlatformTouchGraphicsView
+///
+/// Initialize a new instance of .
+///
+public partial class MauiDrawingView(Context context) : PlatformTouchGraphicsView(context)
{
- ///
- /// Initialize a new instance of .
- ///
- public MauiDrawingView(Context context) : base(context)
- {
- previousPoint = new();
- }
-
///
protected override void Dispose(bool disposing)
{
diff --git a/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.shared.cs b/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.shared.cs
index 3d96cec45b..5dc94884e1 100644
--- a/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.shared.cs
@@ -204,14 +204,9 @@ void ClearPath()
currentPath = new PathF();
}
- class DrawingViewDrawable : IDrawable
+ sealed class DrawingViewDrawable(MauiDrawingView drawingView) : IDrawable
{
- readonly MauiDrawingView drawingView;
-
- public DrawingViewDrawable(MauiDrawingView drawingView)
- {
- this.drawingView = drawingView;
- }
+ readonly MauiDrawingView drawingView = drawingView;
public void Draw(ICanvas canvas, RectF dirtyRect)
{
diff --git a/src/CommunityToolkit.Maui.Core/Views/DrawingView/Service/DrawingViewService.macios.cs b/src/CommunityToolkit.Maui.Core/Views/DrawingView/Service/DrawingViewService.macios.cs
index c59c9f7418..968b4b7746 100644
--- a/src/CommunityToolkit.Maui.Core/Views/DrawingView/Service/DrawingViewService.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/DrawingView/Service/DrawingViewService.macios.cs
@@ -64,7 +64,7 @@ public static ValueTask GetImageStream(IList points, Size imageS
}
static UIImage? GetUIImageForPoints(ICollection points,
- NFloat lineWidth,
+ nfloat lineWidth,
Color strokeColor,
Paint? background)
{
@@ -93,7 +93,7 @@ public static ValueTask GetImageStream(IList points, Size imageS
}, background, drawingLineWithLargestLineWidth.LineWidth);
}
- static UIImage? GetUIImage(ICollection points, Action drawStrokes, Paint? background, NFloat maxLineWidth)
+ static UIImage? GetUIImage(ICollection points, Action drawStrokes, Paint? background, nfloat maxLineWidth)
{
const int minSize = 1;
var minPointX = points.Min(p => p.X) - maxLineWidth;
@@ -121,7 +121,7 @@ public static ValueTask GetImageStream(IList points, Size imageS
return image;
}
- static void DrawStrokes(CGContext context, IList points, NFloat lineWidth, Color strokeColor, Size offset)
+ static void DrawStrokes(CGContext context, IList points, nfloat lineWidth, Color strokeColor, Size offset)
{
context.SetStrokeColor(strokeColor.ToCGColor());
context.SetLineWidth(lineWidth);
@@ -129,7 +129,7 @@ static void DrawStrokes(CGContext context, IList points, NFloat lineWidt
context.SetLineJoin(CGLineJoin.Round);
var (startPointX, startPointY) = points[0];
- context.MoveTo(new NFloat(startPointX), new NFloat(startPointY));
+ context.MoveTo(new nfloat(startPointX), new nfloat(startPointY));
context.AddLines(points.Select(p => new CGPoint(p.X - offset.Width, p.Y - offset.Height)).ToArray());
context.StrokePath();
@@ -162,7 +162,7 @@ static void DrawBackground(CGContext context, Paint? brush, CGSize imageSize)
case LinearGradientPaint linearGradientBrush:
{
var colors = new CGColor[linearGradientBrush.GradientStops.Length];
- var positions = new NFloat[linearGradientBrush.GradientStops.Length];
+ var positions = new nfloat[linearGradientBrush.GradientStops.Length];
for (var index = 0; index < linearGradientBrush.GradientStops.Length; index++)
{
var gradientStop = linearGradientBrush.GradientStops[index];
@@ -182,7 +182,7 @@ static void DrawBackground(CGContext context, Paint? brush, CGSize imageSize)
case RadialGradientPaint radialGradientBrush:
{
var colors = new CGColor[radialGradientBrush.GradientStops.Length];
- var positions = new NFloat[radialGradientBrush.GradientStops.Length];
+ var positions = new nfloat[radialGradientBrush.GradientStops.Length];
for (var index = 0; index < radialGradientBrush.GradientStops.Length; index++)
{
var gradientStop = radialGradientBrush.GradientStops[index];
@@ -200,7 +200,7 @@ static void DrawBackground(CGContext context, Paint? brush, CGSize imageSize)
}
}
- static void DrawRadialGradient(CGContext context, CGSize size, CGColor[] colors, NFloat[] locations)
+ static void DrawRadialGradient(CGContext context, CGSize size, CGColor[] colors, nfloat[] locations)
{
var colorSpace = CGColorSpace.CreateDeviceRGB();
@@ -214,13 +214,13 @@ static void DrawRadialGradient(CGContext context, CGSize size, CGColor[] colors,
context.AddPath(path);
context.EOClip();
- context.DrawRadialGradient(gradient, center, 0, center, (NFloat)radius, 0);
+ context.DrawRadialGradient(gradient, center, 0, center, (nfloat)radius, 0);
context.RestoreState();
}
- static void DrawLinearGradient(CGContext context, CGSize size, CGColor[] colors, NFloat[] locations, CGPoint startPoint, CGPoint endPoint)
+ static void DrawLinearGradient(CGContext context, CGSize size, CGColor[] colors, nfloat[] locations, CGPoint startPoint, CGPoint endPoint)
{
var colorSpace = CGColorSpace.CreateDeviceRGB();
diff --git a/src/CommunityToolkit.Maui.Core/Views/PaddedButton.macios.cs b/src/CommunityToolkit.Maui.Core/Views/PaddedButton.macios.cs
index b32b4d0ece..cf3ed8fc6e 100644
--- a/src/CommunityToolkit.Maui.Core/Views/PaddedButton.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/PaddedButton.macios.cs
@@ -1,6 +1,4 @@
-using System.Runtime.InteropServices;
-
-namespace CommunityToolkit.Maui.Core.Views;
+namespace CommunityToolkit.Maui.Core.Views;
///
/// with Left, Top, Right and Bottom Padding
@@ -10,7 +8,7 @@ public sealed class PaddedButton : UIButton
///
/// Initialize
///
- public PaddedButton(NFloat leftPadding, NFloat topPadding, NFloat rightPadding, NFloat bottomPadding)
+ public PaddedButton(nfloat leftPadding, nfloat topPadding, nfloat rightPadding, nfloat bottomPadding)
{
LeftPadding = leftPadding;
TopPadding = topPadding;
@@ -22,24 +20,24 @@ public PaddedButton(NFloat leftPadding, NFloat topPadding, NFloat rightPadding,
///
/// Left Padding
///
- public NFloat LeftPadding { get; }
+ public nfloat LeftPadding { get; }
///
/// Top Padding
///
- public NFloat TopPadding { get; }
+ public nfloat TopPadding { get; }
///
/// Right Padding
///
- public NFloat RightPadding { get; }
+ public nfloat RightPadding { get; }
///
/// Bottom Padding
///
- public NFloat BottomPadding { get; }
+ public nfloat BottomPadding { get; }
- void SetPadding(NFloat leftPadding, NFloat topPadding, NFloat rightPadding, NFloat bottomPadding)
+ void SetPadding(nfloat leftPadding, nfloat topPadding, nfloat rightPadding, nfloat bottomPadding)
{
if (OperatingSystem.IsIOSVersionAtLeast(15) && Configuration is not null)
{
diff --git a/src/CommunityToolkit.Maui.Core/Views/PaddedLabel.macios.cs b/src/CommunityToolkit.Maui.Core/Views/PaddedLabel.macios.cs
index 8dabc1f30a..a797d8ec17 100644
--- a/src/CommunityToolkit.Maui.Core/Views/PaddedLabel.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/PaddedLabel.macios.cs
@@ -1,42 +1,32 @@
-using System.Runtime.InteropServices;
-
-namespace CommunityToolkit.Maui.Core.Views;
+namespace CommunityToolkit.Maui.Core.Views;
///
/// with Left, Top, Right and Bottom Padding
///
-public class PaddedLabel : UILabel
+///
+/// Initialize
+///
+public class PaddedLabel(nfloat leftPadding, nfloat topPadding, nfloat rightPadding, nfloat bottomPadding) : UILabel
{
- ///
- /// Initialize
- ///
- public PaddedLabel(NFloat leftPadding, NFloat topPadding, NFloat rightPadding, NFloat bottomPadding)
- {
- LeftPadding = leftPadding;
- TopPadding = topPadding;
- RightPadding = rightPadding;
- BottomPadding = bottomPadding;
- }
-
///
/// Left Padding
///
- public NFloat LeftPadding { get; }
+ public nfloat LeftPadding { get; } = leftPadding;
///
/// Top Padding
///
- public NFloat TopPadding { get; }
+ public nfloat TopPadding { get; } = topPadding;
///
/// Right Padding
///
- public NFloat RightPadding { get; }
+ public nfloat RightPadding { get; } = rightPadding;
///
/// Bottom Padding
///
- public NFloat BottomPadding { get; }
+ public nfloat BottomPadding { get; } = bottomPadding;
///
public override CGSize IntrinsicContentSize => new(
diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.android.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.android.cs
index 2125ee0655..8586fc9f85 100644
--- a/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.android.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.android.cs
@@ -73,33 +73,14 @@ public void OnDismissedByTappingOutsideOfPopup(IDialogInterface dialog)
}
///
- /// Method to CleanUp the resources of the .
+ /// Method to clean up the resources of the .
///
public void CleanUp()
{
VirtualView = null;
}
- bool TryCreateContainer(in IPopup popup, [NotNullWhen(true)] out AView? container)
- {
- container = null;
-
- if (popup.Content is null)
- {
- return false;
- }
-
- container = popup.Content.ToPlatform(mauiContext);
- SetContentView(container);
-
- return true;
- }
-
- void SubscribeEvents()
- {
- SetOnCancelListener(this);
- }
-
+ ///
public override bool OnTouchEvent(MotionEvent e)
{
if (VirtualView is not null)
@@ -123,14 +104,27 @@ public override bool OnTouchEvent(MotionEvent e)
}
}
- if (this.IsDisposed())
+ return !this.IsDisposed() && base.OnTouchEvent(e);
+ }
+
+ bool TryCreateContainer(in IPopup popup, [NotNullWhen(true)] out AView? container)
+ {
+ container = null;
+
+ if (popup.Content is null)
{
return false;
}
- else
- {
- return base.OnTouchEvent(e);
- }
+
+ container = popup.Content.ToPlatform(mauiContext);
+ SetContentView(container);
+
+ return true;
+ }
+
+ void SubscribeEvents()
+ {
+ SetOnCancelListener(this);
}
void IDialogInterfaceOnCancelListener.OnCancel(IDialogInterface? dialog) => OnDismissedByTappingOutsideOfPopup(this);
diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.macios.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.macios.cs
index 1c3618f83f..c6061660a0 100644
--- a/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.macios.cs
@@ -8,19 +8,14 @@ namespace CommunityToolkit.Maui.Core.Views;
///
/// The native implementation of Popup control.
///
-public class MauiPopup : UIViewController
+///
+/// Constructor of .
+///
+/// An instance of .
+/// If is null an exception will be thrown.
+public class MauiPopup(IMauiContext mauiContext) : UIViewController
{
- readonly IMauiContext mauiContext;
-
- ///
- /// Constructor of .
- ///
- /// An instance of .
- /// If is null an exception will be thrown.
- public MauiPopup(IMauiContext mauiContext)
- {
- this.mauiContext = mauiContext ?? throw new ArgumentNullException(nameof(mauiContext));
- }
+ readonly IMauiContext mauiContext = mauiContext ?? throw new ArgumentNullException(nameof(mauiContext));
///
/// An instance of the that holds the .
diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.android.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.android.cs
index a59ef22bce..097965aa25 100644
--- a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.android.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.android.cs
@@ -205,11 +205,6 @@ public static void SetSize(this Dialog dialog, in IPopup popup, in AView contain
width = width == LayoutParams.WrapContent ? decorView.MeasuredWidth : width;
height = height == LayoutParams.WrapContent ? decorView.MeasuredHeight : height;
-
- handler.LastPopupWidth = decorView.Width;
- handler.LastPopupHeight = decorView.Height;
- handler.LastWindowWidth = windowSize.Width;
- handler.LastWindowHeight = windowSize.Height;
}
else
{
@@ -229,10 +224,6 @@ public static void SetSize(this Dialog dialog, in IPopup popup, in AView contain
window.SetLayout(width, height);
- handler.LastPopupWidth = decorView.Width;
- handler.LastPopupHeight = decorView.Height;
- handler.LastWindowWidth = windowSize.Width;
- handler.LastWindowHeight = windowSize.Height;
}
}
else
@@ -253,12 +244,13 @@ public static void SetSize(this Dialog dialog, in IPopup popup, in AView contain
window.SetLayout(width, height);
- handler.LastPopupWidth = decorView.Width;
- handler.LastPopupHeight = decorView.Height;
- handler.LastWindowWidth = windowSize.Width;
- handler.LastWindowHeight = windowSize.Height;
}
+ handler.LastPopupWidth = decorView.Width;
+ handler.LastPopupHeight = decorView.Height;
+ handler.LastWindowWidth = windowSize.Width;
+ handler.LastWindowHeight = windowSize.Height;
+
SetAnchor(dialog, popup, width, height);
}
diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.macios.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.macios.cs
index f96a8e4b1f..4079f4ba04 100644
--- a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.macios.cs
@@ -153,7 +153,7 @@ public static void SetLayout(this MauiPopup mauiPopup, in IPopup popup)
if (popup.Anchor is null)
{
var isFlowDirectionRightToLeft = popup.Content?.FlowDirection == FlowDirection.RightToLeft;
- var horizontalOptionsPositiveNegativeMultiplier = isFlowDirectionRightToLeft ? (NFloat)(-1) : (NFloat)1;
+ var horizontalOptionsPositiveNegativeMultiplier = isFlowDirectionRightToLeft ? (nfloat)(-1) : (nfloat)1;
nfloat originY;
if (mauiPopup.PreferredContentSize.Height < frame.Height)
@@ -218,7 +218,7 @@ public static void SetLayout(this MauiPopup mauiPopup, in IPopup popup)
}
}
- class TransparentPopoverBackgroundView : UIPopoverBackgroundView
+ sealed class TransparentPopoverBackgroundView : UIPopoverBackgroundView
{
public TransparentPopoverBackgroundView(IntPtr handle) : base(handle)
{
@@ -226,7 +226,7 @@ public TransparentPopoverBackgroundView(IntPtr handle) : base(handle)
Alpha = 0.0f;
}
- public override NFloat ArrowOffset { get; set; }
+ public override nfloat ArrowOffset { get; set; }
public override UIPopoverArrowDirection ArrowDirection { get; set; }
diff --git a/src/CommunityToolkit.Maui.Core/Views/RoundedView.macios.cs b/src/CommunityToolkit.Maui.Core/Views/RoundedView.macios.cs
index 8cfd8144ce..50b2de4545 100644
--- a/src/CommunityToolkit.Maui.Core/Views/RoundedView.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/RoundedView.macios.cs
@@ -1,43 +1,34 @@
-using System.Runtime.InteropServices;
-using CoreAnimation;
+using CoreAnimation;
namespace CommunityToolkit.Maui.Core.Views;
///
/// A rounded
///
-public class RoundedView : UIView
+///
+/// Initialize
+///
+public class RoundedView(nfloat leftPadding, nfloat topPadding, nfloat rightPadding, nfloat bottomPadding) : UIView
{
- ///
- /// Initialize
- ///
- public RoundedView(NFloat leftPadding, NFloat topPadding, NFloat rightPadding, NFloat bottomPadding)
- {
- LeftPadding = leftPadding;
- TopPadding = topPadding;
- RightPadding = rightPadding;
- BottomPadding = bottomPadding;
- }
-
///
/// Left Padding
///
- public NFloat LeftPadding { get; }
+ public nfloat LeftPadding { get; } = leftPadding;
///
/// Top Padding
///
- public NFloat TopPadding { get; }
+ public nfloat TopPadding { get; } = topPadding;
///
/// Right Padding
///
- public NFloat RightPadding { get; }
+ public nfloat RightPadding { get; } = rightPadding;
///
/// Bottom Padding
///
- public NFloat BottomPadding { get; }
+ public nfloat BottomPadding { get; } = bottomPadding;
///
public override void Draw(CGRect rect)
@@ -62,21 +53,21 @@ public override void LayoutSubviews()
Draw(Frame);
}
- static CGPath? GetRoundedPath(CGRect rect, NFloat left, NFloat top, NFloat right, NFloat bottom)
+ static CGPath? GetRoundedPath(CGRect rect, nfloat left, nfloat top, nfloat right, nfloat bottom)
{
var path = new UIBezierPath();
path.MoveTo(new CGPoint(rect.Width - right, rect.Y));
- path.AddArc(new CGPoint(rect.X + rect.Width - right, rect.Y + right), right, (NFloat)(Math.PI * 1.5), (NFloat)Math.PI * 2, true);
+ path.AddArc(new CGPoint(rect.X + rect.Width - right, rect.Y + right), right, (nfloat)(Math.PI * 1.5), (nfloat)Math.PI * 2, true);
path.AddLineTo(new CGPoint(rect.Width, rect.Height - bottom));
- path.AddArc(new CGPoint(rect.X + rect.Width - bottom, rect.Y + rect.Height - bottom), bottom, 0, (NFloat)(Math.PI * .5), true);
+ path.AddArc(new CGPoint(rect.X + rect.Width - bottom, rect.Y + rect.Height - bottom), bottom, 0, (nfloat)(Math.PI * .5), true);
path.AddLineTo(new CGPoint(left, rect.Height));
- path.AddArc(new CGPoint(rect.X + left, rect.Y + rect.Height - left), left, (NFloat)(Math.PI * .5), (NFloat)Math.PI, true);
+ path.AddArc(new CGPoint(rect.X + left, rect.Y + rect.Height - left), left, (nfloat)(Math.PI * .5), (nfloat)Math.PI, true);
path.AddLineTo(new CGPoint(rect.X, top));
- path.AddArc(new CGPoint(rect.X + top, rect.Y + top), top, (NFloat)Math.PI, (NFloat)(Math.PI * 1.5), true);
+ path.AddArc(new CGPoint(rect.X + top, rect.Y + top), top, (nfloat)Math.PI, (nfloat)(Math.PI * 1.5), true);
path.ClosePath();
diff --git a/src/CommunityToolkit.Maui.Core/Views/SemanticOrderView/MauiSemanticOrderView.android.cs b/src/CommunityToolkit.Maui.Core/Views/SemanticOrderView/MauiSemanticOrderView.android.cs
index 024b9a6625..3bd6092fb8 100644
--- a/src/CommunityToolkit.Maui.Core/Views/SemanticOrderView/MauiSemanticOrderView.android.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/SemanticOrderView/MauiSemanticOrderView.android.cs
@@ -1,4 +1,6 @@
-using Android.Content;
+using System.Diagnostics;
+using System.Runtime.Versioning;
+using Android.Content;
using Microsoft.Maui.Platform;
namespace CommunityToolkit.Maui.Core.Views;
@@ -6,18 +8,15 @@ namespace CommunityToolkit.Maui.Core.Views;
///
/// The native implementation of the control.
///
-public class MauiSemanticOrderView : ContentViewGroup
+///
+/// Initialize
+///
+/// Android Context
+[SupportedOSPlatform("Android22.0")]
+public class MauiSemanticOrderView(Context context) : ContentViewGroup(context)
{
ISemanticOrderView? virtualView;
- ///
- /// Initialize
- ///
- /// Android Context
- public MauiSemanticOrderView(Context context) : base(context)
- {
- }
-
internal ISemanticOrderView? VirtualView
{
get => virtualView;
@@ -39,8 +38,8 @@ internal void UpdateViewOrder()
for (var i = 1; i < viewOrder.Count; i++)
{
- var view1 = (viewOrder[i - 1]?.Handler as IPlatformViewHandler)?.PlatformView;
- var view2 = (viewOrder[i]?.Handler as IPlatformViewHandler)?.PlatformView;
+ var view1 = (viewOrder[i - 1].Handler as IPlatformViewHandler)?.PlatformView;
+ var view2 = (viewOrder[i].Handler as IPlatformViewHandler)?.PlatformView;
if (view1 is null || view2 is null)
{
@@ -62,6 +61,10 @@ internal void UpdateViewOrder()
view2.AccessibilityTraversalAfter = view1.Id;
view1.AccessibilityTraversalBefore = view2.Id;
}
+ else
+ {
+ Trace.WriteLine($"{nameof(ISemanticOrderView)} is only supported on Android 22.0 and higher");
+ }
}
}
diff --git a/src/CommunityToolkit.Maui.Core/Views/SemanticOrderView/MauiSemanticOrderView.macios.cs b/src/CommunityToolkit.Maui.Core/Views/SemanticOrderView/MauiSemanticOrderView.macios.cs
index 6ec6a4ad6a..35bed77e77 100644
--- a/src/CommunityToolkit.Maui.Core/Views/SemanticOrderView/MauiSemanticOrderView.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/SemanticOrderView/MauiSemanticOrderView.macios.cs
@@ -35,8 +35,7 @@ IEnumerable GetAccessibilityElements()
foreach (var view in viewOrder)
{
- if (view.Handler is IPlatformViewHandler platformViewHandler
- && platformViewHandler.PlatformView is not null)
+ if (view.Handler is IPlatformViewHandler { PlatformView: not null } platformViewHandler)
{
yield return platformViewHandler.PlatformView;
}
diff --git a/src/CommunityToolkit.Maui.Core/Views/Snackbar/PlatformSnackbar.macios.cs b/src/CommunityToolkit.Maui.Core/Views/Snackbar/PlatformSnackbar.macios.cs
index a64cb5eda3..f877678d20 100644
--- a/src/CommunityToolkit.Maui.Core/Views/Snackbar/PlatformSnackbar.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/Snackbar/PlatformSnackbar.macios.cs
@@ -32,7 +32,7 @@ public PlatformSnackbar(
string actionButtonText,
UIColor actionTextColor,
UIFont actionButtonFont,
- NFloat padding)
+ nfloat padding)
: base(message, backgroundColor, cornerRadius, textColor, textFont, characterSpacing, padding)
{
padding += DefaultPadding;
diff --git a/src/CommunityToolkit.Maui.Core/Views/Toast/PlatformToast.macios.cs b/src/CommunityToolkit.Maui.Core/Views/Toast/PlatformToast.macios.cs
index 989aef03d4..015ba554cb 100644
--- a/src/CommunityToolkit.Maui.Core/Views/Toast/PlatformToast.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/Toast/PlatformToast.macios.cs
@@ -32,7 +32,7 @@ public PlatformToast(
UIColor textColor,
UIFont font,
double characterSpacing,
- NFloat padding)
+ nfloat padding)
{
padding += DefaultPadding;
@@ -115,5 +115,5 @@ protected virtual void Dispose(bool isDisposing)
}
}
- static NFloat GetEmFromPx(NFloat defaultFontSize, double currentValue) => 100 * (NFloat)currentValue / defaultFontSize;
+ static nfloat GetEmFromPx(nfloat defaultFontSize, double currentValue) => 100 * (nfloat)currentValue / defaultFontSize;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj b/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj
index ea625fe51a..5cebaf18a1 100644
--- a/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj
+++ b/src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj
@@ -10,7 +10,7 @@
15.0
15.0
- 21.0
+ 26.0
10.0.17763.0
10.0.17763.0
6.5
diff --git a/src/CommunityToolkit.Maui.MediaElement/Converters/MediaSourceConverter.cs b/src/CommunityToolkit.Maui.MediaElement/Converters/MediaSourceConverter.cs
index 5677c8e720..60ad208bd1 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Converters/MediaSourceConverter.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Converters/MediaSourceConverter.cs
@@ -21,7 +21,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina
=> destinationType == typeof(string);
///
- public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)
+ public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object? value)
{
var valueAsString = value?.ToString() ?? string.Empty;
@@ -37,7 +37,8 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina
return MediaSource.FromResource(
valueAsString[embeddedResourcePrefix.Length..]);
}
- else if (valueAsStringLowercase.StartsWith(fileSystemPrefix))
+
+ if (valueAsStringLowercase.StartsWith(fileSystemPrefix))
{
return MediaSource.FromFile(valueAsString[fileSystemPrefix.Length..]);
}
@@ -48,7 +49,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina
}
///
- public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType) => value switch
+ public override object ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType) => value switch
{
UriMediaSource uriMediaSource => uriMediaSource.ToString(),
FileMediaSource fileMediaSource => fileMediaSource.ToString(),
diff --git a/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.net.cs b/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.net.cs
index 6565af51ef..7f162eb052 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.net.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Handlers/MediaElementHandler.net.cs
@@ -3,10 +3,10 @@
namespace CommunityToolkit.Maui.Core.Handlers;
-public partial class MediaElementHandler : ViewHandler
+public partial class MediaElementHandler : ViewHandler
{
///
- protected override object CreatePlatformView() => throw new NotImplementedException();
+ protected override PlatformMediaElement CreatePlatformView() => throw new NotImplementedException();
// Ignoring XML comments for this implementation since it's not used.
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
diff --git a/src/CommunityToolkit.Maui.MediaElement/Interfaces/IMediaElement.cs b/src/CommunityToolkit.Maui.MediaElement/Interfaces/IMediaElement.cs
index f99332e28c..05e3ce7f51 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Interfaces/IMediaElement.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Interfaces/IMediaElement.cs
@@ -4,7 +4,7 @@
namespace CommunityToolkit.Maui.Core;
///
-/// With MediaElement you can play multimedia inside of your app.
+/// With MediaElement you can play multimedia inside your app.
///
public interface IMediaElement : IView, IAsynchronousMediaElementHandler
{
diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs
index 6fcb682b50..b23d291711 100644
--- a/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/MediaElement.shared.cs
@@ -6,7 +6,7 @@
namespace CommunityToolkit.Maui.Views;
///
-/// Represents an object that is used to render audio and video to the display.
+/// Represents an object used to render audio and video to the display.
///
public partial class MediaElement : View, IMediaElement, IDisposable
{
@@ -232,7 +232,7 @@ public bool ShouldAutoPlay
}
///
- /// Gets or sets if the video will play when reaches the end.
+ /// Gets or sets if the video plays when reaches the end.
/// Default is . This is a bindable property.
///
public bool ShouldLoopPlayback
@@ -242,7 +242,7 @@ public bool ShouldLoopPlayback
}
///
- /// Gets or sets if media playback will prevent the device display from going to sleep.
+ /// Gets or sets if media playback prevents the device display from going to sleep.
/// This is a bindable property.
///
/// If media is paused, stopped or has completed playing, the display will turn off.
@@ -291,7 +291,7 @@ public MediaSource? Source
/// Gets or sets the volume of the audio for the media.
///
///
- /// A value of 1 means full volume, 0 is silence.
+ /// A value of 1 indicates full-volume, 0 is silence.
/// When is , changes to are ignored.
/// The new volume will be applied when is set to again.
/// When the user uses the platform player controls to influence the volume, it might still unmute.
@@ -299,7 +299,20 @@ public MediaSource? Source
public double Volume
{
get => (double)GetValue(VolumeProperty);
- set => SetValue(VolumeProperty, value);
+ set
+ {
+ switch (value)
+ {
+ case > 1:
+ throw new ArgumentOutOfRangeException(nameof(value), value, $"The value of {nameof(Volume)} cannot be greater than {1}");
+ case < 0:
+ throw new ArgumentOutOfRangeException(nameof(value), value, $"The value of {nameof(Volume)} cannot be less than {0}");
+ default:
+ SetValue(VolumeProperty, value);
+ break;
+ }
+
+ }
}
///
@@ -318,14 +331,14 @@ public double Speed
/// Gets the height (in pixels) of the loaded media in pixels.
/// This is a bindable property.
///
- /// Not reported for non-visual media, sometimes not available for live streamed content on iOS and macOS.
+ /// Not reported for non-visual media, sometimes not available for live-streamed content on iOS and macOS.
public int MediaHeight => (int)GetValue(MediaHeightProperty);
///
/// Gets the width (in pixels) of the loaded media in pixels.
/// This is a bindable property.
///
- /// Not reported for non-visual media, sometimes not available for live streamed content on iOS and macOS.
+ /// Not reported for non-visual media, sometimes not available for live-streamed content on iOS and macOS.
public int MediaWidth => (int)GetValue(MediaWidthProperty);
///
@@ -516,11 +529,11 @@ static void OnSourcePropertyChanging(BindableObject bindable, object oldValue, o
static void OnCurrentStatePropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
- var MediaElement = (MediaElement)bindable;
+ var mediaElement = (MediaElement)bindable;
var previousState = (MediaElementState)oldValue;
var newState = (MediaElementState)newValue;
- MediaElement.OnStateChanged(new MediaStateChangedEventArgs(previousState, newState));
+ mediaElement.OnStateChanged(new MediaStateChangedEventArgs(previousState, newState));
}
static void ValidateVolume(BindableObject bindable, object oldValue, object newValue)
diff --git a/src/CommunityToolkit.Maui.MediaElement/MediaSource/MediaSource.shared.cs b/src/CommunityToolkit.Maui.MediaElement/MediaSource/MediaSource.shared.cs
index 8e58d6dcf3..9d716e9f87 100644
--- a/src/CommunityToolkit.Maui.MediaElement/MediaSource/MediaSource.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/MediaSource/MediaSource.shared.cs
@@ -41,7 +41,7 @@ internal event EventHandler SourceChanged
public static MediaSource FromResource(string? path) => new ResourceMediaSource { Path = isAndroid ? $"Assets/{path}" : path };
///
- /// Creates a from an string that contains an absolute URI.
+ /// Creates a from a string that contains an absolute URI.
///
/// String representation or an absolute URI to load.
/// A instance.
diff --git a/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaFailedEventArgs.cs b/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaFailedEventArgs.cs
index dabf8a6115..afd6c9623d 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaFailedEventArgs.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaFailedEventArgs.cs
@@ -3,19 +3,14 @@
///
/// Represents event data for when media has failed loading or playing.
///
-public sealed class MediaFailedEventArgs : EventArgs
+///
+/// Initializes a new instance of the class.
+///
+/// An error message providing more information for this event.
+public sealed class MediaFailedEventArgs(string errorMessage) : EventArgs
{
- ///
- /// Initializes a new instance of the class.
- ///
- /// An error message providing more information for this event.
- public MediaFailedEventArgs(string errorMessage)
- {
- ErrorMessage = errorMessage;
- }
-
///
/// Gets a description of why the media failed to load and/or play.
///
- public string ErrorMessage { get; }
+ public string ErrorMessage { get; } = errorMessage;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaPositionChangedEventArgs.cs b/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaPositionChangedEventArgs.cs
index 13535ab756..272edd2a3d 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaPositionChangedEventArgs.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaPositionChangedEventArgs.cs
@@ -3,19 +3,14 @@
///
/// Represents event data for when media position has changed.
///
-public sealed class MediaPositionChangedEventArgs : EventArgs
+///
+/// Initializes a new instance of the class.
+///
+/// The position associated to this event.
+public sealed class MediaPositionChangedEventArgs(TimeSpan position) : EventArgs
{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The position associated to this event.
- public MediaPositionChangedEventArgs(TimeSpan position)
- {
- Position = position;
- }
-
///
/// Gets the position the media has progressed to.
///
- public TimeSpan Position { get; }
+ public TimeSpan Position { get; } = position;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaStateChangedEventArgs.cs b/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaStateChangedEventArgs.cs
index cff5e9e18e..f83d709f06 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaStateChangedEventArgs.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Primitives/MediaStateChangedEventArgs.cs
@@ -3,26 +3,20 @@
///
/// Represents event data for when media state has changed.
///
-public sealed class MediaStateChangedEventArgs : EventArgs
+///
+/// Initializes a new instance of the class.
+///
+/// The previous state.
+/// The new state.
+public sealed class MediaStateChangedEventArgs(MediaElementState previousState, MediaElementState newState) : EventArgs
{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The previous state.
- /// The new state.
- public MediaStateChangedEventArgs(MediaElementState previousState, MediaElementState newState)
- {
- PreviousState = previousState;
- NewState = newState;
- }
-
///
/// Gets the previous state that the instance is transitioning from.
///
- public MediaElementState PreviousState { get; }
+ public MediaElementState PreviousState { get; } = previousState;
///
/// Gets the new state that the instance is transitioning to.
///
- public MediaElementState NewState { get; }
+ public MediaElementState NewState { get; } = newState;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.MediaElement/Primitives/SeekRequestedEventArgs.cs b/src/CommunityToolkit.Maui.MediaElement/Primitives/SeekRequestedEventArgs.cs
index 28016aebe0..7677b9aa29 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Primitives/SeekRequestedEventArgs.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Primitives/SeekRequestedEventArgs.cs
@@ -3,19 +3,14 @@
///
/// Represents event data for when a seek operation is requested on media.
///
-sealed class MediaSeekRequestedEventArgs : EventArgs
+///
+/// Initializes a new instance of the class.
+///
+/// The requested position to seek to.
+sealed class MediaSeekRequestedEventArgs(TimeSpan requestedPosition) : EventArgs
{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The requested position to seek to.
- public MediaSeekRequestedEventArgs(TimeSpan requestedPosition)
- {
- RequestedPosition = requestedPosition;
- }
-
///
/// Gets the requested position to seek to.
///
- public TimeSpan RequestedPosition { get; }
+ public TimeSpan RequestedPosition { get; } = requestedPosition;
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs b/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
index 2097ea7db6..ccf78b2621 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
@@ -1,6 +1,7 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
using Android.App;
using Android.Content;
using Android.Content.PM;
@@ -17,6 +18,7 @@
namespace CommunityToolkit.Maui.Media.Services;
+[SupportedOSPlatform("Android26.0")]
[Service(Exported = false, Enabled = true, Name = "communityToolkit.maui.media.services", ForegroundServiceType = ForegroundService.TypeMediaPlayback)]
class MediaControlsService : Service
{
@@ -138,13 +140,13 @@ async ValueTask InitializeNotification(MediaSessionCompat mediaSession, Intent m
CreateNotificationChannel(notificationManager);
}
- if (Build.VERSION.SdkInt >= BuildVersionCodes.Q)
+ if (OperatingSystem.IsAndroidVersionAtLeast(29))
{
StartForeground(1, notification.Build(), ForegroundService.TypeMediaPlayback);
return;
}
- if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
+ if (OperatingSystem.IsAndroidVersionAtLeast(26))
{
StartForeground(1, notification.Build());
}
@@ -267,9 +269,15 @@ protected override void Dispose(bool disposing)
///
sealed class ReceiveUpdates : BroadcastReceiver
{
+ readonly WeakEventManager propertyChangedEventManager = new();
+
public string Action = string.Empty;
- public event PropertyChangedEventHandler? PropertyChanged;
+ public event PropertyChangedEventHandler PropertyChanged
+ {
+ add => propertyChangedEventManager.AddEventHandler(value);
+ remove => propertyChangedEventManager.RemoveEventHandler(value);
+ }
///
/// Method that is called when a broadcast is received.
@@ -281,6 +289,6 @@ public override void OnReceive(Context? context, Intent? intent)
ArgumentNullException.ThrowIfNull(intent);
ArgumentNullException.ThrowIfNull(intent.Action);
Action = intent.GetStringExtra("ACTION") ?? string.Empty;
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Action)));
+ propertyChangedEventManager.HandleEvent(this, new PropertyChangedEventArgs(nameof(Action)), nameof(PropertyChanged));
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
index 011d1d9827..e7f8733090 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Views/MauiMediaElement.android.cs
@@ -72,7 +72,7 @@ public override void OnDetachedFromWindow()
protected override void OnVisibilityChanged(Android.Views.View changedView, [GeneratedEnum] ViewStates visibility)
{
base.OnVisibilityChanged(changedView, visibility);
- if (isFullScreen && visibility == ViewStates.Visible)
+ if (isFullScreen && visibility is ViewStates.Visible)
{
SetSystemBarsVisibility();
}
diff --git a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs
index 39be2d58ee..679c393d9f 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.android.cs
@@ -259,12 +259,12 @@ public void OnPlayerError(PlaybackException? error)
if (error?.ErrorCode is not null)
{
- errorCode = $"Error code: {error?.ErrorCode}";
+ errorCode = $"Error code: {error.ErrorCode}";
}
if (!string.IsNullOrWhiteSpace(error?.ErrorCodeName))
{
- errorCodeName = $"Error codename: {error?.ErrorCodeName}";
+ errorCodeName = $"Error codename: {error.ErrorCodeName}";
}
var message = string.Join(", ", new[]
@@ -272,7 +272,7 @@ public void OnPlayerError(PlaybackException? error)
errorCodeName,
errorCode,
errorMessage
- }.Where(s => !string.IsNullOrEmpty(s)));
+ }.Where(static s => !string.IsNullOrEmpty(s)));
MediaElement.MediaFailed(new MediaFailedEventArgs(message));
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/GestureManagerTests.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/GestureManagerTests.cs
index 178e4158cf..034dae33d8 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/GestureManagerTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/GestureManagerTests.cs
@@ -56,7 +56,7 @@ public void HandleTouch_ShouldUpdateTouchStatusAndState(TouchStatus status, bool
// Act
var gestureManager = new GestureManager();
- gestureManager.HandleTouch(in touchBehavior, in status);
+ GestureManager.HandleTouch(in touchBehavior, in status);
// Assert
Assert.Equal(expectedTouchState, touchBehavior.CurrentTouchState);
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs
index 6b12c452e3..0041b0a02b 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/Popup/PopupTests.cs
@@ -394,6 +394,6 @@ public Color? Color
interface IFooService
{
- public int MyProperty { get; set; }
+ int MyProperty { get; set; }
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.android.cs b/src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.android.cs
index 793d0ddfa7..57881d9617 100644
--- a/src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.android.cs
+++ b/src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.android.cs
@@ -51,20 +51,22 @@ static View GetParentView()
static void SetLayoutParametersForView(in View snackbarView)
{
- if (IsModalPageActive() && snackbarView.Context?.Resources is not null)
+ if (!IsModalPageActive() || snackbarView.Context?.Resources is null)
{
- var resourceId = snackbarView.Context.Resources.GetIdentifier(
- "navigation_bar_height",
- "dimen",
- "android"
- );
- var navBarHeight = snackbarView.Context.Resources.GetDimensionPixelSize(resourceId);
- var layoutParameters = (FrameLayout.LayoutParams?)snackbarView.LayoutParameters;
- if (layoutParameters is not null)
- {
- layoutParameters.SetMargins(layoutParameters.LeftMargin, layoutParameters.TopMargin, layoutParameters.RightMargin, layoutParameters.BottomMargin + navBarHeight);
- snackbarView.LayoutParameters = layoutParameters;
- }
+ return;
+ }
+
+ var resourceId = snackbarView.Context.Resources.GetIdentifier(
+ "navigation_bar_height",
+ "dimen",
+ "android"
+ );
+ var navBarHeight = snackbarView.Context.Resources.GetDimensionPixelSize(resourceId);
+ var layoutParameters = (FrameLayout.LayoutParams?)snackbarView.LayoutParameters;
+ if (layoutParameters is not null)
+ {
+ layoutParameters.SetMargins(layoutParameters.LeftMargin, layoutParameters.TopMargin, layoutParameters.RightMargin, layoutParameters.BottomMargin + navBarHeight);
+ snackbarView.LayoutParameters = layoutParameters;
}
}
@@ -116,31 +118,33 @@ async Task ShowPlatform(CancellationToken token)
void SetContainerForView(in View snackbarView)
{
- if (snackbarView.Background is GradientDrawable shape)
+ if (snackbarView.Background is not GradientDrawable shape)
{
- shape.SetColor(VisualOptions.BackgroundColor.ToPlatform().ToArgb());
-
- var density = snackbarView.Context?.Resources?.DisplayMetrics?.Density ?? 1;
- var cornerRadius = new Thickness(
- VisualOptions.CornerRadius.BottomLeft * density,
- VisualOptions.CornerRadius.TopLeft * density,
- VisualOptions.CornerRadius.TopRight * density,
- VisualOptions.CornerRadius.BottomRight * density);
-
- shape.SetCornerRadii(
- [
- (float)cornerRadius.Left,
- (float)cornerRadius.Left,
- (float)cornerRadius.Top,
- (float)cornerRadius.Top,
- (float)cornerRadius.Right,
- (float)cornerRadius.Right,
- (float)cornerRadius.Bottom,
- (float)cornerRadius.Bottom
- ]);
-
- snackbarView.SetBackground(shape);
+ return;
}
+
+ shape.SetColor(VisualOptions.BackgroundColor.ToPlatform().ToArgb());
+
+ var density = snackbarView.Context?.Resources?.DisplayMetrics?.Density ?? 1;
+ var cornerRadius = new Thickness(
+ VisualOptions.CornerRadius.BottomLeft * density,
+ VisualOptions.CornerRadius.TopLeft * density,
+ VisualOptions.CornerRadius.TopRight * density,
+ VisualOptions.CornerRadius.BottomRight * density);
+
+ shape.SetCornerRadii(
+ [
+ (float)cornerRadius.Left,
+ (float)cornerRadius.Left,
+ (float)cornerRadius.Top,
+ (float)cornerRadius.Top,
+ (float)cornerRadius.Right,
+ (float)cornerRadius.Right,
+ (float)cornerRadius.Bottom,
+ (float)cornerRadius.Bottom
+ ]);
+
+ snackbarView.SetBackground(shape);
}
void SetMessageForView(in View snackbarView, IFontManager fontManager)
@@ -177,16 +181,10 @@ void SetActionForSnackbar(in Google.Android.Material.Snackbar.Snackbar platformS
platformSnackbar.AddCallback(new SnackbarCallback(this, dismissedTCS = new()));
}
- class SnackbarCallback : BaseTransientBottomBar.BaseCallback
+ sealed class SnackbarCallback(in Snackbar snackbar, in TaskCompletionSource dismissedTcs) : BaseTransientBottomBar.BaseCallback
{
- readonly Snackbar snackbar;
- readonly TaskCompletionSource dismissedTCS;
-
- public SnackbarCallback(in Snackbar snackbar, in TaskCompletionSource dismissedTCS)
- {
- this.snackbar = snackbar;
- this.dismissedTCS = dismissedTCS;
- }
+ readonly Snackbar snackbar = snackbar;
+ readonly TaskCompletionSource dismissedTCS = dismissedTcs;
public override void OnShown(Object? transientBottomBar)
{
diff --git a/src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.macios.cs b/src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.macios.cs
index 23d8774899..2aeb962cd6 100644
--- a/src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.macios.cs
+++ b/src/CommunityToolkit.Maui/Alerts/Snackbar/Snackbar.macios.cs
@@ -8,7 +8,7 @@ namespace CommunityToolkit.Maui.Alerts;
public partial class Snackbar
{
- static CommunityToolkit.Maui.Core.Views.PlatformSnackbar? PlatformSnackbar { get; set; }
+ static PlatformSnackbar? PlatformSnackbar { get; set; }
///
/// Dispose Snackbar
diff --git a/src/CommunityToolkit.Maui/Alerts/Toast/Toast.android.cs b/src/CommunityToolkit.Maui/Alerts/Toast/Toast.android.cs
index 9bf2acf086..b60efc4fa1 100644
--- a/src/CommunityToolkit.Maui/Alerts/Toast/Toast.android.cs
+++ b/src/CommunityToolkit.Maui/Alerts/Toast/Toast.android.cs
@@ -28,12 +28,13 @@ protected virtual void Dispose(bool isDisposing)
static void DismissPlatform(CancellationToken token)
{
- if (PlatformToast is not null)
+ if (PlatformToast is null)
{
- token.ThrowIfCancellationRequested();
-
- PlatformToast.Cancel();
+ return;
}
+
+ token.ThrowIfCancellationRequested();
+ PlatformToast.Cancel();
}
void ShowPlatform(CancellationToken token)
diff --git a/src/CommunityToolkit.Maui/Alerts/Toast/Toast.macios.cs b/src/CommunityToolkit.Maui/Alerts/Toast/Toast.macios.cs
index 04b3e3abbb..68408b173b 100644
--- a/src/CommunityToolkit.Maui/Alerts/Toast/Toast.macios.cs
+++ b/src/CommunityToolkit.Maui/Alerts/Toast/Toast.macios.cs
@@ -9,7 +9,7 @@ namespace CommunityToolkit.Maui.Alerts;
public partial class Toast
{
- static CommunityToolkit.Maui.Core.Views.PlatformToast? PlatformToast { get; set; }
+ static PlatformToast? PlatformToast { get; set; }
///
/// Dispose Toast
@@ -31,12 +31,13 @@ protected virtual void Dispose(bool isDisposing)
static void DismissPlatform(CancellationToken token)
{
- if (PlatformToast is not null)
+ if (PlatformToast is null)
{
- token.ThrowIfCancellationRequested();
-
- PlatformToast.Dismiss();
+ return;
}
+
+ token.ThrowIfCancellationRequested();
+ PlatformToast.Dismiss();
}
///
diff --git a/src/CommunityToolkit.Maui/Alerts/Toast/Toast.shared.cs b/src/CommunityToolkit.Maui/Alerts/Toast/Toast.shared.cs
index 1332db6b6d..78b7531699 100644
--- a/src/CommunityToolkit.Maui/Alerts/Toast/Toast.shared.cs
+++ b/src/CommunityToolkit.Maui/Alerts/Toast/Toast.shared.cs
@@ -25,7 +25,7 @@ public ToastDuration Duration
get => duration;
init
{
- if (!Enum.IsDefined(typeof(ToastDuration), value))
+ if (!Enum.IsDefined(value))
{
throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(ToastDuration));
}
diff --git a/src/CommunityToolkit.Maui/Animations/BaseAnimation.shared.cs b/src/CommunityToolkit.Maui/Animations/BaseAnimation.shared.cs
index 1c4aaa39d4..4b406308c9 100644
--- a/src/CommunityToolkit.Maui/Animations/BaseAnimation.shared.cs
+++ b/src/CommunityToolkit.Maui/Animations/BaseAnimation.shared.cs
@@ -3,9 +3,13 @@
/// Abstract class for animation types to inherit.
///
/// The that the behavior can be applied to
-public abstract class BaseAnimation : BindableObject where TAnimatable : IAnimatable
+///
+/// Initialize BaseAnimation
+///
+/// The default time, in milliseconds, over which to animate the transition
+public abstract class BaseAnimation(uint defaultLength = 250u) : BindableObject where TAnimatable : IAnimatable
{
- readonly uint defaultLength;
+ readonly uint defaultLength = defaultLength;
///
/// Backing BindableProperty for the property.
@@ -20,16 +24,10 @@ public abstract class BaseAnimation : BindableObject where TAnimata
public static readonly BindableProperty EasingProperty =
BindableProperty.Create(nameof(Easing), typeof(Easing), typeof(BaseAnimation), Easing.Linear, BindingMode.OneWay);
- ///
- /// Initialize BaseAnimation
- ///
- /// The default time, in milliseconds, over which to animate the transition
- protected BaseAnimation(uint defaultLength = 250u) => this.defaultLength = defaultLength;
-
- ///
- /// The time, in milliseconds, over which to animate the transition.
- ///
- public uint Length
+ ///
+ /// The time, in milliseconds, over which to animate the transition.
+ ///
+ public uint Length
{
get => (uint)GetValue(LengthProperty);
set => SetValue(LengthProperty, value);
@@ -53,14 +51,10 @@ public Easing Easing
}
///
-public abstract class BaseAnimation : BaseAnimation
+///
+/// Initialize BaseAnimation
+///
+/// The default time, in milliseconds, over which to animate the transition
+public abstract class BaseAnimation(uint defaultLength = 250u) : BaseAnimation(defaultLength)
{
- ///
- /// Initialize BaseAnimation
- ///
- /// The default time, in milliseconds, over which to animate the transition
- protected BaseAnimation(uint defaultLength = 250u) : base(defaultLength)
- {
-
- }
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/Animations/FadeAnimation.shared.cs b/src/CommunityToolkit.Maui/Animations/FadeAnimation.shared.cs
index ce9f43a1f5..1328430761 100644
--- a/src/CommunityToolkit.Maui/Animations/FadeAnimation.shared.cs
+++ b/src/CommunityToolkit.Maui/Animations/FadeAnimation.shared.cs
@@ -2,9 +2,9 @@
///
/// Animation that will fade the supplied view to the specified
-/// and then back to it's original .
+/// and then back to its original .
///
-public partial class FadeAnimation : BaseAnimation
+public partial class FadeAnimation() : BaseAnimation(300)
{
///
/// Backing BindableProperty for the property.
@@ -17,14 +17,6 @@ public partial class FadeAnimation : BaseAnimation
0.3,
BindingMode.TwoWay);
- ///
- /// Initializes a new instance of .
- ///
- public FadeAnimation() : base(300)
- {
-
- }
-
///
/// Gets or sets the opacity to fade to before returning to the elements current Opacity.
///
diff --git a/src/CommunityToolkit.Maui/Behaviors/AnimationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/AnimationBehavior.shared.cs
index adb9f9dcd0..9ecd06b0e8 100644
--- a/src/CommunityToolkit.Maui/Behaviors/AnimationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/AnimationBehavior.shared.cs
@@ -8,6 +8,15 @@ namespace CommunityToolkit.Maui.Behaviors;
///
public partial class AnimationBehavior : EventToCommandBehavior
{
+ const string animateCommandSetterWarning =
+ """
+ Do not use this setter, it only exists to enable XAML Hot reload support in your IDE.
+
+ Instead, apps should provide a value for this OneWayToSource property by creating a binding, in XAML or C#. If done via C# use code like this:
+
+ behavior.SetBinding(AnimationBehavior.AnimateCommandProperty, nameof(ViewModel.TriggerAnimationCommand));
+ """;
+
///
/// Backing BindableProperty for the property.
///
@@ -36,15 +45,12 @@ public partial class AnimationBehavior : EventToCommandBehavior
public Command AnimateCommand
{
get => (Command)GetValue(AnimateCommandProperty);
- [Obsolete(
- """
-Do not use this setter, it only exists to enable XAML Hot reload support in your IDE.
-
-Instead, apps should provide a value for this OneWayToSource property by creating a binding, in XAML or C#. If done via C# use code like this:
-
-behavior.SetBinding(AnimationBehavior.AnimateCommandProperty, nameof(ViewModel.TriggerAnimationCommand));
-""")]
- set => SetValue(AnimateCommandProperty, value);
+ [Obsolete(animateCommandSetterWarning)]
+ set
+ {
+ Trace.WriteLine(animateCommandSetterWarning);
+ SetValue(AnimateCommandProperty, value);
+ }
}
///
@@ -61,29 +67,31 @@ protected override void OnAttachedTo(VisualElement bindable)
{
base.OnAttachedTo(bindable);
- if (string.IsNullOrWhiteSpace(EventName))
+ if (!string.IsNullOrWhiteSpace(EventName))
{
- if (bindable is ITextInput)
- {
- throw new InvalidOperationException($"Animation Behavior can not be attached to {nameof(ITextInput)} without using the EventName property.");
- }
-
- if (bindable is not IGestureRecognizers gestureRecognizers)
- {
- throw new InvalidOperationException($"VisualElement does not implement {nameof(IGestureRecognizers)}.");
- }
+ return;
+ }
- tapGestureRecognizer = new TapGestureRecognizer();
- tapGestureRecognizer.Tapped += OnTriggerHandled;
+ if (bindable is ITextInput)
+ {
+ throw new InvalidOperationException($"Animation Behavior can not be attached to {nameof(ITextInput)} without using the EventName property.");
+ }
- gestureRecognizers.GestureRecognizers.Add(tapGestureRecognizer);
+ if (bindable is not IGestureRecognizers gestureRecognizers)
+ {
+ throw new InvalidOperationException($"VisualElement does not implement {nameof(IGestureRecognizers)}.");
}
+
+ tapGestureRecognizer = new TapGestureRecognizer();
+ tapGestureRecognizer.Tapped += OnTriggerHandled;
+
+ gestureRecognizers.GestureRecognizers.Add(tapGestureRecognizer);
}
///
protected override void OnDetachingFrom(VisualElement bindable)
{
- if (tapGestureRecognizer != null)
+ if (tapGestureRecognizer is not null)
{
tapGestureRecognizer.Tapped -= OnTriggerHandled;
tapGestureRecognizer = null;
diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.android.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.android.cs
index 520633e191..9845a43c12 100644
--- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.android.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.android.cs
@@ -83,10 +83,7 @@ static void SetImageViewTintColor(ImageView image, Color? color)
static void SetMaterialButtonTintColor(AndroidMaterialButton button, Color color)
{
button.IconTintMode = PorterDuff.Mode.SrcIn;
- button.IconTint = new Android.Content.Res.ColorStateList(new int[][]
- {
- []
- }, [color.ToPlatform()]);
+ button.IconTint = new Android.Content.Res.ColorStateList([[]], [color.ToPlatform()]);
}
static void SetWidgetButtonTintColor(AndroidWidgetButton button, Color? color)
@@ -127,6 +124,7 @@ static void ClearTintColor(AndroidView? nativeView)
case AndroidMaterialButton mButton:
mButton.IconTint = null;
break;
+
case AndroidWidgetButton button:
foreach (var drawable in button.GetCompoundDrawables())
{
diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.macios.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.macios.cs
index 8f61d51298..e20bf61fac 100644
--- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.macios.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.macios.cs
@@ -33,7 +33,7 @@ protected override void OnAttachedTo(View bindable, UIView platformView)
ApplyTintColor(platformView, bindable, TintColor);
- this.PropertyChanged += (s, e) =>
+ PropertyChanged += (s, e) =>
{
if (e.PropertyName == TintColorProperty.PropertyName)
{
diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/StatusBar/StatusBarBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/StatusBar/StatusBarBehavior.shared.cs
index 5df0bd539c..507af7c4c1 100644
--- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/StatusBar/StatusBarBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/StatusBar/StatusBarBehavior.shared.cs
@@ -87,7 +87,7 @@ protected override void OnAttachedTo(Page bindable, object platformView)
{
base.OnAttachedTo(bindable, platformView);
- if (ApplyOn == StatusBarApplyOn.OnBehaviorAttachedTo)
+ if (ApplyOn is StatusBarApplyOn.OnBehaviorAttachedTo)
{
StatusBar.SetColor(StatusBarColor);
StatusBar.SetStyle(StatusBarStyle);
@@ -117,7 +117,7 @@ protected override void OnDetachedFrom(Page bindable, object platformView)
}
#if IOS
- void OnPageSizeChanged(object? sender, EventArgs e)
+ static void OnPageSizeChanged(object? sender, EventArgs e)
{
StatusBar.UpdateBarSize();
}
@@ -125,7 +125,7 @@ void OnPageSizeChanged(object? sender, EventArgs e)
void OnPageNavigatedTo(object? sender, NavigatedToEventArgs e)
{
- if (ApplyOn == StatusBarApplyOn.OnPageNavigatedTo)
+ if (ApplyOn is StatusBarApplyOn.OnPageNavigatedTo)
{
StatusBar.SetColor(StatusBarColor);
StatusBar.SetStyle(StatusBarStyle);
diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/GestureManager.shared.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/GestureManager.shared.cs
index a9aca720da..6dd518db49 100644
--- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/GestureManager.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/GestureManager.shared.cs
@@ -57,7 +57,7 @@ internal static void HandleHover(in TouchBehavior touchBehavior, in HoverStatus
touchBehavior.CurrentHoverStatus = hoverStatus;
}
- internal void HandleTouch(in TouchBehavior touchBehavior, in TouchStatus status)
+ internal static void HandleTouch(in TouchBehavior touchBehavior, in TouchStatus status)
{
if (!touchBehavior.IsEnabled)
{
diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.android.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.android.cs
index 09f18bc60f..b29bb03d67 100644
--- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.android.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.android.cs
@@ -1,5 +1,4 @@
using Android.Content;
-using Android.Content.Res;
using Android.OS;
using Android.Views;
using Android.Views.Accessibility;
@@ -103,14 +102,6 @@ protected override void OnDetachedFrom(VisualElement bindable, AView platformVie
isHoverSupported = false;
}
- static ColorStateList GetColorStateList(MColor? color)
- {
- var animationColor = color;
- animationColor ??= defaultNativeAnimationColor;
-
- return new ColorStateList([[]], [animationColor.ToPlatform()]);
- }
-
void UpdateClickHandler()
{
if (view is null || !view.IsAlive())
diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.macios.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.macios.cs
index 3fb8d7ee9c..6258454b2c 100644
--- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.macios.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.macios.cs
@@ -92,9 +92,6 @@ sealed class TouchUITapGestureRecognizer : UIGestureRecognizer
{
readonly TouchBehavior behavior;
- float? defaultRadius;
- float? defaultShadowRadius;
- float? defaultShadowOpacity;
CGPoint? startPoint;
bool isCanceled;
@@ -106,8 +103,6 @@ public TouchUITapGestureRecognizer(TouchBehavior behavior)
Delegate = new TouchUITapGestureRecognizerDelegate();
}
- public bool IsButton { get; set; }
-
public override void TouchesBegan(NSSet touches, UIEvent evt)
{
base.TouchesBegan(touches, evt);
@@ -191,6 +186,16 @@ public override void TouchesMoved(NSSet touches, UIEvent evt)
}
}
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ Delegate.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
void HandleTouch(TouchStatus status, TouchInteractionStatus? interactionStatus = null)
{
if (isCanceled || !behavior.IsEnabled)
@@ -212,16 +217,6 @@ void HandleTouch(TouchStatus status, TouchInteractionStatus? interactionStatus =
}
}
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- Delegate.Dispose();
- }
-
- base.Dispose(disposing);
- }
-
CGPoint? GetTouchPoint(NSSet touches)
{
return (touches?.AnyObject as UITouch)?.LocationInView(View);
diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.methods.shared.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.methods.shared.cs
index 5f85cd6811..6c8c27b6bf 100644
--- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.methods.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.methods.shared.cs
@@ -71,7 +71,7 @@ internal void HandleTouch(TouchStatus status)
{
ObjectDisposedException.ThrowIf(isDisposed, this);
- gestureManager.HandleTouch(this, status);
+ GestureManager.HandleTouch(this, status);
}
internal void HandleUserInteraction(TouchInteractionStatus interactionStatus)
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/CharactersValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/CharactersValidationBehavior.shared.cs
index 8d4f60cd31..8dfe10dc7f 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/CharactersValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/CharactersValidationBehavior.shared.cs
@@ -40,7 +40,8 @@ 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 .
+/// 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 .
///
[RequiresUnreferencedCode($"{nameof(CharactersValidationBehavior)} is not trim safe because it uses bindings with string paths.")]
public partial class CharactersValidationBehavior : TextValidationBehavior
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs
index 0cf3e03815..f5d79c4a30 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs
@@ -57,10 +57,10 @@ public List? Errors
///
protected override async ValueTask ValidateAsync(object? value, CancellationToken token)
{
- await Task.WhenAll(children.Select(c =>
+ await Task.WhenAll(children.Select(async validationBehavior =>
{
- c.Value = value;
- return c.ValidateNestedAsync(token).AsTask();
+ validationBehavior.Value = value;
+ await validationBehavior.ValidateNestedAsync(token);
})).ConfigureAwait(false);
var errors = children.Where(static c => c.IsNotValid).Select(GetError).ToList();
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs
index 1e1fcd035f..e51ccb668e 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs
@@ -94,7 +94,7 @@ protected override ValueTask ValidateAsync(string? value, CancellationToke
}
var decimalPlaces = hasDecimalDelimiter
- ? value.Substring(decimalDelimiterIndex + 1, value.Length - decimalDelimiterIndex - 1).Length
+ ? value.Substring(decimalDelimiterIndex + 1).Length
: 0;
return new ValueTask(decimalPlaces >= MinimumDecimalPlaces && decimalPlaces <= MaximumDecimalPlaces);
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs
index 0ec6a9f874..90e3276d6e 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/TextValidationBehavior.shared.cs
@@ -123,7 +123,7 @@ public RegexOptions RegexOptions
///
protected override string? Decorate(string? value)
{
- var stringValue = base.Decorate(value)?.ToString();
+ var stringValue = base.Decorate(value);
var flags = DecorationFlags;
if (flags.HasFlag(TextDecorationFlags.NullToEmpty))
@@ -198,6 +198,7 @@ static string NormalizeWhiteSpace(string value)
builder.Append(ch);
}
+
return builder.ToString();
}
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs
index a1c776425a..74d1882f43 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs
@@ -321,7 +321,6 @@ static async void OnValuePropertyChanged(BindableObject bindable, object oldValu
OnValidationPropertyChanged(bindable, oldValue, newValue);
}
- [RequiresUnreferencedCode($"{nameof(ValidationBehavior)} is not trim safe because it uses bindings with string paths.")]
static void OnValuePropertyNamePropertyChanged(BindableObject bindable, object oldValue, object newValue)
=> ((ValidationBehavior)bindable).OnValuePropertyNamePropertyChanged();
diff --git a/src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs
index 223dcbe2af..01f6aab146 100644
--- a/src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/BaseConverter.shared.cs
@@ -6,7 +6,7 @@
namespace CommunityToolkit.Maui.Converters;
///
-/// Abstract class used to implement converters that implements the ConvertBack logic.
+/// Abstract class used to implement converters that implement the ConvertBack logic.
///
/// Type of the input value.
/// Type of the output value.
@@ -104,7 +104,7 @@ private protected BaseConverter()
}
///
-/// Abstract class used to implement converters that implements the ConvertBack logic.
+/// Abstract class used to implement converters that implement the ConvertBack logic.
///
/// Type of the input value.
/// Type of the output value.
diff --git a/src/CommunityToolkit.Maui/Converters/BaseConverterOneWay.shared.cs b/src/CommunityToolkit.Maui/Converters/BaseConverterOneWay.shared.cs
index 585607f44b..f6a22c0e84 100644
--- a/src/CommunityToolkit.Maui/Converters/BaseConverterOneWay.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/BaseConverterOneWay.shared.cs
@@ -4,7 +4,7 @@
namespace CommunityToolkit.Maui.Converters;
///
-/// Abstract class used to implement converters that implements the Convert logic.
+/// Abstract class used to implement converters that implement the Convert logic.
///
/// Type of the input value
/// Type of the output value
@@ -23,7 +23,7 @@ public sealed override TFrom ConvertBackTo(TTo value, CultureInfo? culture) =>
}
///
-/// Abstract class used to implement converters that implements the Convert logic.
+/// Abstract class used to implement converters that implement the Convert logic.
///
/// Type of the input value
/// Type of the output value
@@ -38,6 +38,6 @@ public sealed override TFrom DefaultConvertBackReturnValue
}
///
- public sealed override TFrom ConvertBackTo(TTo value, TParam? parameter, CultureInfo? culture) =>
+ public sealed override TFrom ConvertBackTo(TTo? value, TParam? parameter, CultureInfo? culture) =>
throw new NotSupportedException("Impossible to revert to original value. Consider setting BindingMode to OneWay.");
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/Converters/BoolToObjectConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/BoolToObjectConverter.shared.cs
index 3d170fbd8b..c2d9e636bf 100644
--- a/src/CommunityToolkit.Maui/Converters/BoolToObjectConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/BoolToObjectConverter.shared.cs
@@ -42,7 +42,7 @@ public partial class BoolToObjectConverter<[DynamicallyAccessedMembers(Dynamical
public override TObject? ConvertFrom(bool value, CultureInfo? culture = null) => value ? TrueObject : FalseObject;
///
- /// Converts back object to .
+ /// Converts back the object to .
///
/// The value to convert.
/// The culture to use in the converter. This is not implemented.
diff --git a/src/CommunityToolkit.Maui/Converters/ByteArrayToImageSourceConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/ByteArrayToImageSourceConverter.shared.cs
index 8f1295d738..abdc0cedd8 100644
--- a/src/CommunityToolkit.Maui/Converters/ByteArrayToImageSourceConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/ByteArrayToImageSourceConverter.shared.cs
@@ -24,12 +24,7 @@ public partial class ByteArrayToImageSourceConverter : BaseConverter new MemoryStream(value));
+ return value is null ? null : ImageSource.FromStream(() => new MemoryStream(value));
}
///
diff --git a/src/CommunityToolkit.Maui/Converters/ColorToStringConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/ColorToStringConverter.shared.cs
index f7a50cf1af..f09148cebe 100644
--- a/src/CommunityToolkit.Maui/Converters/ColorToStringConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/ColorToStringConverter.shared.cs
@@ -50,12 +50,7 @@ public partial class ColorToRgbaStringConverter : BaseConverter
///
public override Color ConvertBackTo(string value, CultureInfo? culture)
{
- if (Color.TryParse(value, out Color color))
- {
- return color;
- }
-
- return DefaultConvertBackReturnValue;
+ return Color.TryParse(value, out var color) ? color : DefaultConvertBackReturnValue;
}
///
diff --git a/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs
index 28694b5e31..083013b479 100644
--- a/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs
@@ -88,9 +88,8 @@ public override object ConvertFrom(TValue value, CultureInfo? culture = null)
{
ArgumentNullException.ThrowIfNull(value);
ArgumentNullException.ThrowIfNull(ComparingValue);
- ArgumentNullException.ThrowIfNull(ComparisonOperator);
- if (!Enum.IsDefined(typeof(OperatorType), ComparisonOperator))
+ if (!Enum.IsDefined(ComparisonOperator))
{
throw new InvalidEnumArgumentException(nameof(ComparisonOperator), (int)ComparisonOperator, typeof(OperatorType));
}
diff --git a/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs
index 80f4cdb341..6ba762621e 100644
--- a/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs
@@ -22,7 +22,6 @@ public partial class DateTimeOffsetConverter : BaseConverterThe value.
public override DateTime ConvertFrom(DateTimeOffset value, CultureInfo? culture = null)
{
- ArgumentNullException.ThrowIfNull(value);
return value.DateTime;
}
@@ -34,8 +33,6 @@ public override DateTime ConvertFrom(DateTimeOffset value, CultureInfo? culture
/// The value.
public override DateTimeOffset ConvertBackTo(DateTime value, CultureInfo? culture = null)
{
- ArgumentNullException.ThrowIfNull(value);
-
var offset = value.Kind switch
{
DateTimeKind.Local => DateTimeOffset.Now.Offset,
diff --git a/src/CommunityToolkit.Maui/Converters/EnumToBoolConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/EnumToBoolConverter.shared.cs
index a5b9919aef..16e6aee2dc 100644
--- a/src/CommunityToolkit.Maui/Converters/EnumToBoolConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/EnumToBoolConverter.shared.cs
@@ -52,7 +52,7 @@ static bool CompareTwoEnums(in Enum valueToCheck, in Enum? referenceEnumValue)
return false;
}
- if (valueToCheckType.GetTypeInfo().GetCustomAttribute() != null)
+ if (valueToCheckType.GetTypeInfo().GetCustomAttribute() is not null)
{
return referenceEnumValue.HasFlag(valueToCheck);
}
diff --git a/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs
index aa63657815..7e33e03405 100644
--- a/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/EnumToIntConverter.shared.cs
@@ -42,7 +42,6 @@ public override int ConvertFrom(Enum value, Type? parameter = null, CultureInfo?
/// If value is not a valid value in the targetType enum
public override Enum ConvertBackTo(int value, Type parameter, CultureInfo? culture = null)
{
- ArgumentNullException.ThrowIfNull(value);
ArgumentNullException.ThrowIfNull(parameter);
if (!Enum.IsDefined(parameter, value))
diff --git a/src/CommunityToolkit.Maui/Converters/IndexToArrayItemConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IndexToArrayItemConverter.shared.cs
index 0e5fced476..6f2ced9bdf 100644
--- a/src/CommunityToolkit.Maui/Converters/IndexToArrayItemConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/IndexToArrayItemConverter.shared.cs
@@ -1,4 +1,5 @@
-using System.Globalization;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
namespace CommunityToolkit.Maui.Converters;
@@ -21,7 +22,7 @@ public partial class IndexToArrayItemConverter : BaseConverterThe items array.
/// The culture to use in the converter. This is not implemented.
/// The item from the array that corresponds to passed index.
- public override object? ConvertFrom(int value, Array parameter, CultureInfo? culture = null)
+ public override object? ConvertFrom(int value, [AllowNull] Array parameter, CultureInfo? culture = null)
{
ArgumentNullException.ThrowIfNull(parameter);
@@ -34,10 +35,10 @@ public partial class IndexToArrayItemConverter : BaseConverter
- /// Converts back an array item to corresponding index of the item in the array.
+ /// Converts back an array item to the corresponding index of the item in the array.
///
/// The item from the array.
- /// The items array.
+ /// The item array.
/// The culture to use in the converter. This is not implemented.
/// The index of the item from the array.
public override int ConvertBackTo(object? value, Array parameter, CultureInfo? culture = null)
diff --git a/src/CommunityToolkit.Maui/Converters/IntToBoolConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IntToBoolConverter.shared.cs
index 5a21a1d534..c5ab8bd082 100644
--- a/src/CommunityToolkit.Maui/Converters/IntToBoolConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/IntToBoolConverter.shared.cs
@@ -15,7 +15,7 @@ public partial class IntToBoolConverter : BaseConverter
public override int DefaultConvertBackReturnValue { get; set; } = 0;
///
- /// Converts the incoming to a indicating whether or not the value is not equal to 0.
+ /// Converts the incoming to a indicating whether the value is not equal to 0.
///
/// The value to convert.
/// (Not Used)
@@ -23,7 +23,7 @@ public partial class IntToBoolConverter : BaseConverter
public override bool ConvertFrom(int value, CultureInfo? culture = null) => value is not 0;
///
- /// Converts the incoming to an indicating whether or not the value is true.
+ /// Converts the incoming to an indicating whether the value is true.
///
/// The value to convert.
/// (Not Used)
diff --git a/src/CommunityToolkit.Maui/Converters/InvertedBoolConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/InvertedBoolConverter.shared.cs
index ede5edb9f2..559d35bf62 100644
--- a/src/CommunityToolkit.Maui/Converters/InvertedBoolConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/InvertedBoolConverter.shared.cs
@@ -3,7 +3,7 @@
namespace CommunityToolkit.Maui.Converters;
///
-/// Converts true to false and false to true. Simple as that!
+/// Converts true to false and false to true
///
[AcceptEmptyServiceProvider]
public partial class InvertedBoolConverter : BaseConverter
diff --git a/src/CommunityToolkit.Maui/Converters/IsInRangeConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsInRangeConverter.shared.cs
index 7d7ab0c30a..d9b70128fc 100644
--- a/src/CommunityToolkit.Maui/Converters/IsInRangeConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/IsInRangeConverter.shared.cs
@@ -33,7 +33,7 @@ public abstract class IsInRangeConverter<[DynamicallyAccessedMembers(Dynamically
///
public override object DefaultConvertReturnValue { get; set; } = new();
- /// If supplied this value will be returned when the converter receives an input value that is outside of the and s.
+ /// If supplied this value will be returned when the converter receives an input value that is outside the and s.
public TReturnObject? FalseObject
{
get => (TReturnObject?)GetValue(FalseObjectProperty);
diff --git a/src/CommunityToolkit.Maui/Converters/IsListNotNullOrEmptyConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsListNotNullOrEmptyConverter.shared.cs
index f7923c523f..2ad4f3300f 100644
--- a/src/CommunityToolkit.Maui/Converters/IsListNotNullOrEmptyConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/IsListNotNullOrEmptyConverter.shared.cs
@@ -4,7 +4,7 @@
namespace CommunityToolkit.Maui.Converters;
///
-/// Converts the incoming value to a indicating whether or not the value is not null and not empty.
+/// Converts the incoming value to a indicating whether the value is not null and not empty.
///
[AcceptEmptyServiceProvider]
public partial class IsListNotNullOrEmptyConverter : BaseConverterOneWay
@@ -13,11 +13,11 @@ public partial class IsListNotNullOrEmptyConverter : BaseConverterOneWay
- /// Converts the incoming value to a indicating whether or not the value is not null and not empty.
+ /// Converts the incoming value to a indicating whether the value is not null and not empty.
///
/// The value to convert.
/// (Not Used)
- /// Whether the the list is not null or empty
+ /// Whether the list is not null or empty
public override bool ConvertFrom(IEnumerable? value, CultureInfo? culture = null) =>
!IsListNullOrEmptyConverter.IsListNullOrEmpty(value);
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/Converters/IsListNullOrEmptyConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsListNullOrEmptyConverter.shared.cs
index 1400d5ba62..f97168de9f 100644
--- a/src/CommunityToolkit.Maui/Converters/IsListNullOrEmptyConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/IsListNullOrEmptyConverter.shared.cs
@@ -4,7 +4,7 @@
namespace CommunityToolkit.Maui.Converters;
///
-/// Converts the incoming value to a indicating whether or not the value is null or empty.
+/// Converts the incoming value to a indicating whether the value is null or empty.
///
[AcceptEmptyServiceProvider]
public partial class IsListNullOrEmptyConverter : BaseConverterOneWay
@@ -13,16 +13,24 @@ public partial class IsListNullOrEmptyConverter : BaseConverterOneWay
- /// Converts the incoming value to a indicating whether or not the value is null or empty.
+ /// Converts the incoming value to a indicating whether the value is null or empty.
///
/// IEnumerable to convert
/// (Not Used)
/// A indicating if the incoming value is null or empty.
public override bool ConvertFrom(IEnumerable? value, CultureInfo? culture = null) => IsListNullOrEmpty(value);
- internal static bool IsListNullOrEmpty(IEnumerable? value) => value switch
+ internal static bool IsListNullOrEmpty(IEnumerable? value)
{
- null => true,
- _ => !value.GetEnumerator().MoveNext()
- };
+ if (value is null)
+ {
+ return true;
+ }
+
+ var enumerator = value.GetEnumerator();
+ bool result = !enumerator.MoveNext();
+
+ ((IDisposable)enumerator).Dispose();
+ return result;
+ }
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/Converters/IsNotNullConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsNotNullConverter.shared.cs
index bee2e16280..a6a5b086a7 100644
--- a/src/CommunityToolkit.Maui/Converters/IsNotNullConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/IsNotNullConverter.shared.cs
@@ -3,7 +3,7 @@
namespace CommunityToolkit.Maui.Converters;
///
-/// Converts the incoming value to a indicating whether or not the value is not null.
+/// Converts the incoming value to a indicating whether the value is not null.
///
[AcceptEmptyServiceProvider]
public partial class IsNotNullConverter : BaseConverterOneWay
@@ -12,7 +12,7 @@ public partial class IsNotNullConverter : BaseConverterOneWay
public override bool DefaultConvertReturnValue { get; set; } = false;
///
- /// Converts the incoming object to a indicating whether or not the value is not null.
+ /// Converts the incoming object to a indicating whether the value is not null.
///
/// The value to convert.
/// (Not Used)
diff --git a/src/CommunityToolkit.Maui/Converters/IsNullConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsNullConverter.shared.cs
index fd58252a4a..ddb54e315d 100644
--- a/src/CommunityToolkit.Maui/Converters/IsNullConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/IsNullConverter.shared.cs
@@ -3,7 +3,7 @@
namespace CommunityToolkit.Maui.Converters;
///
-/// Converts the incoming value to a indicating whether or not the value is null.
+/// Converts the incoming value to a indicating whether the value is null.
///
[AcceptEmptyServiceProvider]
public partial class IsNullConverter : BaseConverterOneWay
@@ -12,7 +12,7 @@ public partial class IsNullConverter : BaseConverterOneWay
public override bool DefaultConvertReturnValue { get; set; } = false;
///
- /// Converts the incoming object to a indicating whether or not the value is null.
+ /// Converts the incoming object to a indicating whether the value is null.
///
/// The value to convert.
/// (Not Used)
diff --git a/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrEmptyConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrEmptyConverter.shared.cs
index 004e05de5d..fc7412b092 100644
--- a/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrEmptyConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrEmptyConverter.shared.cs
@@ -3,7 +3,7 @@
namespace CommunityToolkit.Maui.Converters;
///
-/// Converts the incoming value to a indicating whether or not the value is not null and not empty.
+/// Converts the incoming value to a indicating whether the value is not null and not empty.
///
[AcceptEmptyServiceProvider]
public partial class IsStringNotNullOrEmptyConverter : BaseConverterOneWay
@@ -12,11 +12,11 @@ public partial class IsStringNotNullOrEmptyConverter : BaseConverterOneWay
- /// Converts the incoming string to a indicating whether or not the value is not null and not empty using string.IsNullOrEmpty.
+ /// Converts the incoming string to a indicating whether the value is not null and not empty using string.IsNullOrEmpty.
///
/// The string to convert.
/// (Not Used)
- /// Whether the the string is not null or empty
+ /// Whether the string is not null or empty
public override bool ConvertFrom(string? value, CultureInfo? culture = null)
=> !string.IsNullOrEmpty(value);
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrWhiteSpaceConverter.cs b/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrWhiteSpaceConverter.cs
index e2a7b3aa9f..ff22149cd2 100644
--- a/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrWhiteSpaceConverter.cs
+++ b/src/CommunityToolkit.Maui/Converters/IsStringNotNullOrWhiteSpaceConverter.cs
@@ -3,7 +3,7 @@
namespace CommunityToolkit.Maui.Converters;
///
-/// Converts the incoming value to a indicating whether or not the value is not null and not white space.
+/// Converts the incoming value to a indicating whether the value is not null and not white space.
///
[AcceptEmptyServiceProvider]
public partial class IsStringNotNullOrWhiteSpaceConverter : BaseConverterOneWay
@@ -12,11 +12,11 @@ public partial class IsStringNotNullOrWhiteSpaceConverter : BaseConverterOneWay<
public override bool DefaultConvertReturnValue { get; set; } = false;
///
- /// Converts the incoming string to a indicating whether or not the value is not null and not white space using string.IsNullOrWhiteSpace.
+ /// Converts the incoming string to a indicating whether the value is not null and not white space using string.IsNullOrWhiteSpace.
///
/// The value to convert.
/// (Not Used)
- /// Whether the the list is not null or empty
+ /// Whether the list is not null or empty
/// A indicating if the incoming value is not null and not white space.
public override bool ConvertFrom(string? value, CultureInfo? culture = null)
=> !string.IsNullOrWhiteSpace(value);
diff --git a/src/CommunityToolkit.Maui/Converters/IsStringNullOrEmptyConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsStringNullOrEmptyConverter.shared.cs
index fa2c5d0f89..8888329e8a 100644
--- a/src/CommunityToolkit.Maui/Converters/IsStringNullOrEmptyConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/IsStringNullOrEmptyConverter.shared.cs
@@ -3,7 +3,7 @@
namespace CommunityToolkit.Maui.Converters;
///
-/// Converts the incoming value to a indicating whether or not the value is null or empty.
+/// Converts the incoming value to a indicating whether the value is null or empty.
///
[AcceptEmptyServiceProvider]
public partial class IsStringNullOrEmptyConverter : BaseConverterOneWay
@@ -12,7 +12,7 @@ public partial class IsStringNullOrEmptyConverter : BaseConverterOneWay
- /// Converts the incoming string to a indicating whether or not the string is null or empty using string.IsNullOrEmpty.
+ /// Converts the incoming string to a indicating whether the string is null or empty using string.IsNullOrEmpty.
///
/// The value to convert.
/// (Not Used)
diff --git a/src/CommunityToolkit.Maui/Converters/IsStringNullOrWhiteSpaceConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsStringNullOrWhiteSpaceConverter.shared.cs
index e696d73d60..e0abedfe71 100644
--- a/src/CommunityToolkit.Maui/Converters/IsStringNullOrWhiteSpaceConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/IsStringNullOrWhiteSpaceConverter.shared.cs
@@ -3,7 +3,7 @@
namespace CommunityToolkit.Maui.Converters;
///
-/// Converts the incoming value to a indicating whether or not the value is null or white space.
+/// Converts the incoming value to a indicating whether the value is null or white space.
///
[AcceptEmptyServiceProvider]
public partial class IsStringNullOrWhiteSpaceConverter : BaseConverterOneWay
@@ -12,7 +12,7 @@ public partial class IsStringNullOrWhiteSpaceConverter : BaseConverterOneWay
- /// Converts the incoming string to a indicating whether or not the string is null or white space using string.IsNullOrWhiteSpace.
+ /// Converts the incoming string to a indicating whether the string is null or white space using string.IsNullOrWhiteSpace.
///
/// The value to convert.
/// (Not Used)
diff --git a/src/CommunityToolkit.Maui/Converters/MathExpressionConverter/MathExpression.shared.cs b/src/CommunityToolkit.Maui/Converters/MathExpressionConverter/MathExpression.shared.cs
index 2d1840407c..77223c0580 100644
--- a/src/CommunityToolkit.Maui/Converters/MathExpressionConverter/MathExpression.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/MathExpressionConverter/MathExpression.shared.cs
@@ -11,7 +11,6 @@ sealed partial class MathExpression
static readonly IFormatProvider formatProvider = new CultureInfo("en-US");
readonly IReadOnlyList operators;
- readonly IReadOnlyList arguments;
internal MathExpression(string expression, IEnumerable? arguments = null)
{
@@ -69,7 +68,6 @@ internal MathExpression(string expression, IEnumerable? arguments = null
}
this.operators = operators;
- this.arguments = argumentList;
}
internal string Expression { get; }
@@ -126,7 +124,7 @@ public double Calculate()
[GeneratedRegex(@"(? GetReversePolishNotation(string expression)
+ List GetReversePolishNotation(string expression)
{
var matches = MathExpressionRegexPattern().Matches(expression) ?? throw new ArgumentException("Invalid math expression.");
@@ -151,7 +149,7 @@ IEnumerable GetReversePolishNotation(string expression)
if (!isNegative)
{
stack.Push(("-", MathOperatorPrecedence.Low));
- output.Add(Math.Abs(numeric).ToString());
+ output.Add(Math.Abs(numeric).ToString(formatProvider));
continue;
}
}
@@ -160,10 +158,10 @@ IEnumerable GetReversePolishNotation(string expression)
continue;
}
- var @operator = operators.FirstOrDefault(x => x.Name == value);
- if (@operator != null)
+ var mathOperator = operators.FirstOrDefault(x => x.Name == value);
+ if (mathOperator is not null)
{
- if (@operator.Precedence is MathOperatorPrecedence.Constant)
+ if (mathOperator.Precedence is MathOperatorPrecedence.Constant)
{
output.Add(value);
continue;
@@ -171,8 +169,8 @@ IEnumerable GetReversePolishNotation(string expression)
while (stack.Count > 0)
{
- var (name, precedence) = stack.Peek();
- if (precedence >= @operator.Precedence)
+ var (_, precedence) = stack.Peek();
+ if (precedence >= mathOperator.Precedence)
{
output.Add(stack.Pop().Name);
}
@@ -182,7 +180,7 @@ IEnumerable GetReversePolishNotation(string expression)
}
}
- stack.Push((value, @operator.Precedence));
+ stack.Push((value, mathOperator.Precedence));
}
else if (value is "(")
{
@@ -217,7 +215,7 @@ IEnumerable GetReversePolishNotation(string expression)
{
while (stack.Count > 0)
{
- var (name, precedence) = stack.Peek();
+ var (_, precedence) = stack.Peek();
if (precedence >= MathOperatorPrecedence.Low)
{
output.Add(stack.Pop().Name);
@@ -232,7 +230,7 @@ IEnumerable GetReversePolishNotation(string expression)
for (var i = stack.Count - 1; i >= 0; i--)
{
- var (name, precedence) = stack.Pop();
+ var (name, _) = stack.Pop();
if (name is "(")
{
throw new ArgumentException("Invalid math expression.");
diff --git a/src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs
index 26c7b5baec..1e3735506f 100644
--- a/src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/MultiConverter.shared.cs
@@ -3,7 +3,7 @@
namespace CommunityToolkit.Maui.Converters;
///
-/// Converts an incoming value using all of the incoming converters in sequence.
+/// Converts an incoming value using all the incoming converters in sequence.
///
[AcceptEmptyServiceProvider]
public partial class MultiConverter : List, ICommunityToolkitValueConverter
@@ -25,7 +25,7 @@ public partial class MultiConverter : List, ICo
///
/// Value to convert.
/// The type of the binding target property.
- /// Parameter to pass into subsequent converters.
+ /// Parameter to pass into all converters.
/// The culture to use in the converter.
/// The converted value.
public object? Convert(object? value, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type targetType, object? parameter, System.Globalization.CultureInfo? culture)
diff --git a/src/CommunityToolkit.Maui/Converters/MultiConverterParameter.shared.cs b/src/CommunityToolkit.Maui/Converters/MultiConverterParameter.shared.cs
index 05899411d8..fb1575e5e6 100644
--- a/src/CommunityToolkit.Maui/Converters/MultiConverterParameter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/MultiConverterParameter.shared.cs
@@ -7,7 +7,7 @@
public partial class MultiConverterParameter : BindableObject
{
///
- /// The type of object of this parameter.
+ /// The object type of this parameter.
///
public Type? ConverterType { get; set; }
diff --git a/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs
index 3733760503..86cd3537ce 100644
--- a/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/StateToBooleanConverter.shared.cs
@@ -60,8 +60,6 @@ public LayoutState StateToCompare
/// True if the provided s match, otherwise False if they don't match.
public override bool ConvertFrom(LayoutState value, LayoutState? parameter = null, CultureInfo? culture = null)
{
- ArgumentNullException.ThrowIfNull(value);
-
if (parameter is not null)
{
if (!Enum.IsDefined(typeof(LayoutState), parameter))
diff --git a/src/CommunityToolkit.Maui/Converters/StringToListConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/StringToListConverter.shared.cs
index 1af4c97ec7..da539b5aec 100644
--- a/src/CommunityToolkit.Maui/Converters/StringToListConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/StringToListConverter.shared.cs
@@ -10,7 +10,7 @@ namespace CommunityToolkit.Maui.Converters;
public partial class StringToListConverter : BaseConverterOneWay
{
string separator = " ";
- IList separators = Array.Empty();
+ IList separators = [];
///
public override IEnumerable DefaultConvertReturnValue { get; set; } = Array.Empty();
@@ -74,7 +74,7 @@ public override IEnumerable ConvertFrom(string? value, object? parameter
{
if (value is null)
{
- return Array.Empty();
+ return [];
}
switch (parameter)
diff --git a/src/CommunityToolkit.Maui/Converters/TextCaseConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/TextCaseConverter.shared.cs
index 15132bdb5e..9709768209 100644
--- a/src/CommunityToolkit.Maui/Converters/TextCaseConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/TextCaseConverter.shared.cs
@@ -23,7 +23,7 @@ public enum TextCaseType
}
///
-/// Converts text (string, char) to certain case as specified with or the parameter of the Convert method.
+/// Converts text (string, char) to a certain case as specified with or the parameter of the Convert method.
///
[ContentProperty(nameof(Type)), AcceptEmptyServiceProvider]
public partial class TextCaseConverter : BaseConverterOneWay
@@ -51,7 +51,7 @@ public TextCaseType Type
}
///
- /// Converts text (string, char) to certain case.
+ /// Converts text (string, char) to a certain case.
///
/// The text to convert.
/// The desired text case that the text should be converted to. Must match enum value.
diff --git a/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs
index 2b8098d2c6..c68e46eb6b 100644
--- a/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/TimeSpanToSecondsConverter.shared.cs
@@ -22,7 +22,6 @@ public partial class TimeSpanToSecondsConverter : BaseConverterA value expressed in seconds.
public override double ConvertFrom(TimeSpan value, CultureInfo? culture = null)
{
- ArgumentNullException.ThrowIfNull(value);
return value.TotalSeconds;
}
@@ -34,7 +33,6 @@ public override double ConvertFrom(TimeSpan value, CultureInfo? culture = null)
/// The value representing the converted value.
public override TimeSpan ConvertBackTo(double value, CultureInfo? culture = null)
{
- ArgumentNullException.ThrowIfNull(value);
return TimeSpan.FromSeconds(value);
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/Converters/VariableMultiValueConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/VariableMultiValueConverter.shared.cs
index 003ee539aa..d7f94fcffd 100644
--- a/src/CommunityToolkit.Maui/Converters/VariableMultiValueConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/VariableMultiValueConverter.shared.cs
@@ -87,6 +87,6 @@ public object Convert(object[]? values, Type targetType, object? parameter = nul
return null;
}
- return boolValue ? targetTypes?.Select(t => ConditionType == MultiBindingCondition.All).OfType().ToArray() : null;
+ return boolValue ? targetTypes?.Select(_ => ConditionType is MultiBindingCondition.All).OfType().ToArray() : null;
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/Extensions/AppThemeResourceExtension.shared.cs b/src/CommunityToolkit.Maui/Extensions/AppThemeResourceExtension.shared.cs
index 70466804ac..19c42ded00 100644
--- a/src/CommunityToolkit.Maui/Extensions/AppThemeResourceExtension.shared.cs
+++ b/src/CommunityToolkit.Maui/Extensions/AppThemeResourceExtension.shared.cs
@@ -7,7 +7,7 @@
public sealed class AppThemeResourceExtension : IMarkupExtension
{
///
- /// Gets or sets the key that is used to access the or from the .
+ /// Gets or sets the key used to access the or from the .
///
public string? Key { get; set; }
diff --git a/src/CommunityToolkit.Maui/Extensions/ColorAnimationExtensions.shared.cs b/src/CommunityToolkit.Maui/Extensions/ColorAnimationExtensions.shared.cs
index f56454ef1e..09b6f56402 100644
--- a/src/CommunityToolkit.Maui/Extensions/ColorAnimationExtensions.shared.cs
+++ b/src/CommunityToolkit.Maui/Extensions/ColorAnimationExtensions.shared.cs
@@ -3,7 +3,7 @@
namespace CommunityToolkit.Maui.Extensions;
///
-/// Extension methods for Microsoft.Maui.Graphics.Color animations
+/// Extension methods for animations
///
public static partial class ColorAnimationExtensions
{
@@ -41,7 +41,7 @@ public static Task BackgroundColorTo(this VisualElement element, Color col
}
catch (ArgumentException aex)
{
- //When creating an Animation too early in the lifecycle of the Page, i.e. in the OnAppearing method,
+ //When creating an Animation too early in the lifecycle of the Page, i.e., in the OnAppearing method,
//the Page might not have an 'IAnimationManager' yet, resulting in an ArgumentException.
System.Diagnostics.Trace.WriteLine($"{aex.GetType().Name} thrown in {typeof(ColorAnimationExtensions).FullName}: {aex.Message}");
animationCompletionSource.SetResult(false);
diff --git a/src/CommunityToolkit.Maui/Extensions/CryptographyExtensions.shared.cs b/src/CommunityToolkit.Maui/Extensions/CryptographyExtensions.shared.cs
index 765b4f5d3c..5ee8d9325a 100644
--- a/src/CommunityToolkit.Maui/Extensions/CryptographyExtensions.shared.cs
+++ b/src/CommunityToolkit.Maui/Extensions/CryptographyExtensions.shared.cs
@@ -13,7 +13,7 @@ static class CryptographyExtensions
public static string GetMd5Hash(this string source, string separator = "-")
{
using var md5 = MD5.Create();
- var hash = md5.ComputeHash(Encoding.UTF8.GetBytes(source.AsSpan().ToArray())).AsSpan();
+ var hash = MD5.HashData(Encoding.UTF8.GetBytes([.. source])).AsSpan();
return BitConverter.ToString(hash.ToArray(), 0, hash.Length).Replace("-", separator, StringComparison.OrdinalIgnoreCase);
}
diff --git a/src/CommunityToolkit.Maui/Extensions/PropertyChangedEventArgsExtensions.shared.cs b/src/CommunityToolkit.Maui/Extensions/PropertyChangedEventArgsExtensions.shared.cs
index d26092b67d..4d4929512b 100644
--- a/src/CommunityToolkit.Maui/Extensions/PropertyChangedEventArgsExtensions.shared.cs
+++ b/src/CommunityToolkit.Maui/Extensions/PropertyChangedEventArgsExtensions.shared.cs
@@ -13,34 +13,34 @@ public static bool Is(this string propertyName, BindableProperty property) =>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsOneOf(this string propertyName, BindableProperty p0, BindableProperty p1)
{
- return propertyName == p0.PropertyName ||
- propertyName == p1.PropertyName;
+ return propertyName == p0.PropertyName
+ || propertyName == p1.PropertyName;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsOneOf(this string propertyName, BindableProperty p0, BindableProperty p1, BindableProperty p2)
{
- return propertyName == p0.PropertyName ||
- propertyName == p1.PropertyName ||
- propertyName == p2.PropertyName;
+ return propertyName == p0.PropertyName
+ || propertyName == p1.PropertyName
+ || propertyName == p2.PropertyName;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsOneOf(this string propertyName, BindableProperty p0, BindableProperty p1, BindableProperty p2, BindableProperty p3)
{
- return propertyName == p0.PropertyName ||
- propertyName == p1.PropertyName ||
- propertyName == p2.PropertyName ||
- propertyName == p3.PropertyName;
+ return propertyName == p0.PropertyName
+ || propertyName == p1.PropertyName
+ || propertyName == p2.PropertyName
+ || propertyName == p3.PropertyName;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsOneOf(this string propertyName, BindableProperty p0, BindableProperty p1, BindableProperty p2, BindableProperty p3, BindableProperty p4)
{
- return propertyName == p0.PropertyName ||
- propertyName == p1.PropertyName ||
- propertyName == p2.PropertyName ||
- propertyName == p3.PropertyName ||
- propertyName == p4.PropertyName;
+ return propertyName == p0.PropertyName
+ || propertyName == p1.PropertyName
+ || propertyName == p2.PropertyName
+ || propertyName == p3.PropertyName
+ || propertyName == p4.PropertyName;
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/Extensions/ServiceCollectionExtensions.shared.cs b/src/CommunityToolkit.Maui/Extensions/ServiceCollectionExtensions.shared.cs
index e8822b68f7..b1a3369bc6 100644
--- a/src/CommunityToolkit.Maui/Extensions/ServiceCollectionExtensions.shared.cs
+++ b/src/CommunityToolkit.Maui/Extensions/ServiceCollectionExtensions.shared.cs
@@ -171,7 +171,7 @@ public static class ServiceCollectionExtensions
}
///
- /// Registers routes in in for Views registered using WithShellRouting methods.
+ /// Registers routes in for Views registered using WithShellRouting methods.
///
/// The type of the View to add. Constrained to
/// Route at which this page will be registered within Shell routing.
diff --git a/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs b/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs
index 439bb0c758..811b010e9a 100644
--- a/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs
+++ b/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs
@@ -24,7 +24,11 @@ static PageHandler CreatePageHandler(IPopup virtualView)
{
var mauiContext = virtualView.Handler?.MauiContext ?? throw new NullReferenceException(nameof(IMauiContext));
var view = (View?)virtualView.Content ?? throw new InvalidOperationException($"{nameof(IPopup.Content)} can't be null here.");
- view.SetBinding(BindingContextProperty, new Binding { Source = virtualView, Path = BindingContextProperty.PropertyName });
+ view.SetBinding(BindingContextProperty, new Binding
+ {
+ Source = virtualView,
+ Path = BindingContextProperty.PropertyName
+ });
var contentPage = new ContentPage
{
Content = view
@@ -46,20 +50,16 @@ public static void MapOnClosed(PopupHandler handler, IPopup view, object? result
{
PopupHandler.MapOnClosed(handler, view, result);
- var parent = view.Parent as Element;
- if (parent is not null)
+ if (view.Parent is not Element parent || handler.VirtualView is not Popup popup)
{
- if (handler.VirtualView is Popup popup)
- {
- if (popup.Content is not null)
- {
- if (popup.Content.Parent is ContentPage contentPage)
- {
- parent.RemoveLogicalChild(contentPage);
- }
- }
- parent.RemoveLogicalChild(popup);
- }
+ return;
}
+
+ if (popup.Content?.Parent is ContentPage contentPage)
+ {
+ parent.RemoveLogicalChild(contentPage);
+ }
+
+ parent.RemoveLogicalChild(popup);
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs b/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs
index 996238c430..3e2ea070af 100644
--- a/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs
+++ b/src/CommunityToolkit.Maui/ImageSources/GravatarImageSource.shared.cs
@@ -1,10 +1,6 @@
-using Microsoft.Maui.Controls.Internals;
-
+using CommunityToolkit.Maui.Extensions;
namespace CommunityToolkit.Maui.ImageSources;
-using CommunityToolkit.Maui.Extensions;
-using Microsoft.Maui.Controls;
-
/// Gravatar image source.
/// Note that is sealed and can't be used as a parent!
public partial class GravatarImageSource : StreamImageSource, IDisposable
@@ -79,7 +75,7 @@ public DefaultImage Image
}
/// Gets or sets the URI for the image to get.
- [System.ComponentModel.TypeConverter(typeof(UriTypeConverter))]
+ [System.ComponentModel.TypeConverter(typeof(Microsoft.Maui.Controls.UriTypeConverter))]
public Uri Uri { get; set; }
/// Gets the parent height.
@@ -234,7 +230,7 @@ public enum DefaultImage
/// A geometric pattern based on an email hash.
Identicon,
- /// A generated 'monster' with different colours, faces, etc.
+ /// A generated 'monster' with different colors, faces, etc.
MonsterId,
/// Generated faces with differing features and backgrounds.
@@ -243,7 +239,7 @@ public enum DefaultImage
/// Awesome generated, 8-bit arcade-style pixilated faces.
Retro,
- /// A generated robot with different colours, faces, etc.
+ /// A generated robot with different colors, faces, etc.
Robohash,
/// A transparent PNG image.
diff --git a/src/CommunityToolkit.Maui/Layouts/StateContainer/StateContainerController.shared.cs b/src/CommunityToolkit.Maui/Layouts/StateContainer/StateContainerController.shared.cs
index 3fdcc19753..ef1216e30b 100644
--- a/src/CommunityToolkit.Maui/Layouts/StateContainer/StateContainerController.shared.cs
+++ b/src/CommunityToolkit.Maui/Layouts/StateContainer/StateContainerController.shared.cs
@@ -56,7 +56,7 @@ public void SwitchToState(string state)
// If the layout we're applying StateContainer to is a Grid,
// we want to have the StateContainer span the entire Grid surface.
- // Otherwise it would just end up in row 0 : column 0.
+ // Otherwise, it would just end up in row 0 : column 0.
if (layout is IGridLayout grid)
{
if (grid.RowDefinitions.Count > 0)
diff --git a/src/CommunityToolkit.Maui/Options.cs b/src/CommunityToolkit.Maui/Options.cs
index 6199182544..4ce0199647 100644
--- a/src/CommunityToolkit.Maui/Options.cs
+++ b/src/CommunityToolkit.Maui/Options.cs
@@ -22,7 +22,7 @@ internal Options(in MauiAppBuilder builder) : this()
internal static bool ShouldEnableSnackbarOnWindows { get; private set; }
///
- /// Allows to return default value instead of throwing an exception when using .
+ /// Will return the default value instead of throwing an exception when using .
///
///
/// Default value is false.
@@ -30,7 +30,7 @@ internal Options(in MauiAppBuilder builder) : this()
public void SetShouldSuppressExceptionsInConverters(bool value) => ShouldSuppressExceptionsInConverters = value;
///
- /// Allows to return default value instead of throwing an exception when using .
+ /// Catches exceptions thrown when using and reports it to .
///
///
/// Default value is false.
@@ -38,7 +38,7 @@ internal Options(in MauiAppBuilder builder) : this()
public void SetShouldSuppressExceptionsInAnimations(bool value) => ShouldSuppressExceptionsInAnimations = value;
///
- /// Allows to return default value instead of throwing an exception when using .
+ /// Catches exceptions thrown when using and reports it to .
///
///
/// Default value is false.
diff --git a/src/CommunityToolkit.Maui/PlatformConfiguration/AndroidSpecific/NavigationBar.Impl.android.cs b/src/CommunityToolkit.Maui/PlatformConfiguration/AndroidSpecific/NavigationBar.Impl.android.cs
index e3db680e9c..3451e0339d 100644
--- a/src/CommunityToolkit.Maui/PlatformConfiguration/AndroidSpecific/NavigationBar.Impl.android.cs
+++ b/src/CommunityToolkit.Maui/PlatformConfiguration/AndroidSpecific/NavigationBar.Impl.android.cs
@@ -1,5 +1,4 @@
using Android.App;
-using Android.OS;
using AndroidX.Core.View;
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Core.Extensions;
@@ -17,7 +16,7 @@ static partial class NavigationBar
return true;
}
- System.Diagnostics.Trace.WriteLine($"{nameof(NavigationBar)} {nameof(Style)} + {nameof(Color)} functionality is not supported on this version of the Android operating system. Minimum supported Android API is {BuildVersionCodes.M}");
+ System.Diagnostics.Trace.WriteLine($"{nameof(NavigationBar)} {nameof(Style)} + {nameof(Color)} functionality is not supported on this version of the Android operating system. Minimum supported Android API is 23.0");
return false;
});
@@ -93,7 +92,18 @@ public static void MapNavigationColorProperty(IPageHandler handler, IContentView
var color = GetColor(page).ToPlatform();
- window.SetNavigationBarColor(color);
+ if (OperatingSystem.IsAndroidVersionAtLeast(35))
+ {
+
+ }
+ else if (OperatingSystem.IsAndroidVersionAtLeast(21))
+ {
+ window.SetNavigationBarColor(color);
+ }
+ else
+ {
+ System.Diagnostics.Trace.WriteLine($"{nameof(NavigationBar)} {nameof(Style)} + {nameof(Color)} functionality is not supported on this version of the Android operating system. Minimum supported Android API is 23");
+ }
}
internal static partial void RemapForControls()
diff --git a/src/CommunityToolkit.Maui/PlatformConfiguration/AndroidSpecific/NavigationBar.Properties.cs b/src/CommunityToolkit.Maui/PlatformConfiguration/AndroidSpecific/NavigationBar.Properties.cs
index 10c5a85b7c..db95defbc6 100644
--- a/src/CommunityToolkit.Maui/PlatformConfiguration/AndroidSpecific/NavigationBar.Properties.cs
+++ b/src/CommunityToolkit.Maui/PlatformConfiguration/AndroidSpecific/NavigationBar.Properties.cs
@@ -1,4 +1,5 @@
-using CommunityToolkit.Maui.Core;
+using System.Runtime.Versioning;
+using CommunityToolkit.Maui.Core;
using MAndroid = Microsoft.Maui.Controls.PlatformConfiguration.Android;
using MauiElement = Microsoft.Maui.Controls.Page;
@@ -7,6 +8,7 @@ namespace CommunityToolkit.Maui.PlatformConfiguration.AndroidSpecific;
///
/// Provides platform-specific configuration properties for the Android navigation bar.
///
+[SupportedOSPlatform("Android21.0")]
public static partial class NavigationBar
{
///
diff --git a/src/CommunityToolkit.Maui/Popup/PopupLifecycleController.cs b/src/CommunityToolkit.Maui/Popup/PopupLifecycleController.cs
index 4d7de9cdca..1d804b8883 100644
--- a/src/CommunityToolkit.Maui/Popup/PopupLifecycleController.cs
+++ b/src/CommunityToolkit.Maui/Popup/PopupLifecycleController.cs
@@ -4,7 +4,7 @@
namespace CommunityToolkit.Maui;
///
-/// List based implementation that manages the presentation of popups which will return the last item as the current popup.
+/// List-based implementation that manages the presentation of popups which will return the last item as the current popup.
///
public class PopupLifecycleController : IPopupLifecycleController
{
diff --git a/src/CommunityToolkit.Maui/Views/DrawingView/DrawingView.shared.cs b/src/CommunityToolkit.Maui/Views/DrawingView/DrawingView.shared.cs
index 64bab80133..e02e774ed2 100644
--- a/src/CommunityToolkit.Maui/Views/DrawingView/DrawingView.shared.cs
+++ b/src/CommunityToolkit.Maui/Views/DrawingView/DrawingView.shared.cs
@@ -95,7 +95,7 @@ public event EventHandler DrawingLineStarted
}
///
- /// Event occurred when drawing line cancelled.
+ /// Event occurred when drawing line canceled.
///
public event EventHandler DrawingLineCancelled
{
@@ -152,7 +152,7 @@ public ICommand? DrawingLineStartedCommand
}
///
- /// This command is invoked whenever the drawing of a line on has cancelled.
+ /// This command is invoked whenever the drawing of a line on has canceled.
///
public ICommand? DrawingLineCancelledCommand
{
@@ -202,7 +202,7 @@ public bool ShouldClearOnFinish
}
///
- /// Allows to draw on the .
+ /// Allows drawing on the .
/// This is a bindable property.
///
public Action? DrawAction
@@ -214,7 +214,7 @@ public Action? DrawAction
///
/// Retrieves a containing an image of the collection of that is provided as a parameter.
///
- /// A collection of that a image is generated from.
+ /// A collection of that an image is generated from.
/// The desired dimensions of the generated image. The image will be resized proportionally.
/// Background of the generated image. If color is null, default background color is used.
///
@@ -228,7 +228,7 @@ public static ValueTask GetImageStream(IEnumerable lines,
///
/// Retrieves a containing an image of the that are currently drawn on the .
///
- /// Desired width of the image that is returned. The image will be resized proportionally.
+ /// The desired width of the image that is returned. The image will be resized proportionally.
/// Desired height of the image that is returned. The image will be resized proportionally.
///
/// containing the data of the requested image with data that's currently on the .
diff --git a/src/CommunityToolkit.Maui/Views/Expander/Expander.shared.cs b/src/CommunityToolkit.Maui/Views/Expander/Expander.shared.cs
index e4e04c0cdf..84ec9bb6d9 100644
--- a/src/CommunityToolkit.Maui/Views/Expander/Expander.shared.cs
+++ b/src/CommunityToolkit.Maui/Views/Expander/Expander.shared.cs
@@ -55,7 +55,7 @@ public event EventHandler ExpandedChanged
/// By default, this runs .
///
///
- /// Warning: Overriding this may cause to work improperly when placed inside of a and placed inside of a .
+ /// Warning: Overriding this may cause to work improperly when placed inside a and placed inside a .
///
public Action? HandleHeaderTapped { get; set; }
diff --git a/src/CommunityToolkit.Maui/Views/LazyView/LazyView.shared.cs b/src/CommunityToolkit.Maui/Views/LazyView/LazyView.shared.cs
index 0d81e08eb8..b8ef4b8b03 100644
--- a/src/CommunityToolkit.Maui/Views/LazyView/LazyView.shared.cs
+++ b/src/CommunityToolkit.Maui/Views/LazyView/LazyView.shared.cs
@@ -55,7 +55,7 @@ protected override void OnBindingContextChanged()
}
///
- /// This method change the value of the property.
+ /// This method changes the value of the property.
///
///
protected void SetHasLazyViewLoaded(bool hasLoaded) => SetValue(HasLazyViewLoadedPropertyKey, hasLoaded);
diff --git a/src/CommunityToolkit.Maui/Views/Popup/Popup.shared.cs b/src/CommunityToolkit.Maui/Views/Popup/Popup.shared.cs
index e0291d9429..c9a440a478 100644
--- a/src/CommunityToolkit.Maui/Views/Popup/Popup.shared.cs
+++ b/src/CommunityToolkit.Maui/Views/Popup/Popup.shared.cs
@@ -49,7 +49,6 @@ public partial class Popup : Element, IPopup, IWindowController, IPropertyPropag
readonly WeakEventManager dismissWeakEventManager = new();
readonly WeakEventManager openedWeakEventManager = new();
- readonly Lazy> platformConfigurationRegistry;
readonly MergedStyle mergedStyle;
TaskCompletionSource popupDismissedTaskCompletionSource = new();
@@ -62,7 +61,6 @@ public partial class Popup : Element, IPopup, IWindowController, IPropertyPropag
///
public Popup()
{
- platformConfigurationRegistry = new Lazy>(() => new(this));
((IResourceDictionary)resources).ValuesChanged += OnResourcesChanged;
VerticalOptions = HorizontalOptions = LayoutAlignment.Center;
@@ -153,10 +151,10 @@ public Size Size
}
///
- /// Gets or sets a value indicating whether the popup can be dismissed by tapping outside of the Popup.
+ /// Gets or sets a value indicating whether the popup can be dismissed by tapping outside the Popup.
///
///
- /// When true and the user taps outside of the popup it will dismiss.
+ /// When true and the user taps outside the popup, it will dismiss.
/// On Android - when false the hardware back button is disabled.
///
public bool CanBeDismissedByTappingOutsideOfPopup
@@ -178,7 +176,7 @@ public Style Style
/// Gets or sets the anchor.
///
///
- /// The Anchor is where the Popup will render closest to. When an Anchor is configured
+ /// The Anchor is where the Popup will render closest to. When an Anchor is configured,
/// the popup will appear centered over that control or as close as possible.
///
public View? Anchor { get; set; }
@@ -201,7 +199,7 @@ public Window Window
}
///
- /// Property that represent Resources of Popup.
+ /// Property that represents Resources of Popup.
///
public ResourceDictionary Resources
{
@@ -228,7 +226,7 @@ public ResourceDictionary Resources
}
///
- /// Property that represent Style Class of Popup.
+ /// Property that represents Style Class of Popup.
///
[System.ComponentModel.TypeConverter(typeof(ListStringTypeConverter))]
public IList StyleClass
@@ -238,7 +236,7 @@ public IList StyleClass
}
///
- /// Gets or sets the result that will return when user taps outside of the Popup.
+ /// Gets or sets the result that will return when the user taps outside the Popup.
///
protected object? ResultWhenUserTapsOutsideOfPopup { get; set; }
@@ -366,7 +364,7 @@ protected virtual async Task OnClosed(object? result, bool wasDismissedByTapping
}
///
- /// Invoked when the popup is dismissed by tapping outside of the popup.
+ /// Invoked when the popup is dismissed by tapping outside the popup.
///
protected internal virtual async Task OnDismissedByTappingOutsideOfPopup(CancellationToken token = default)
{
From 928b19ffc32c9defa74df9eef01a2f652aaf6d24 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Tue, 5 Nov 2024 15:40:01 -0800
Subject: [PATCH 081/171] `dotnet format`
---
.../Animations/BaseAnimation.shared.cs | 8 ++++----
.../IconTintColor/IconTintColorBehavior.macios.cs | 2 +-
.../Touch/TouchBehavior.methods.shared.cs | 2 +-
.../Converters/IsListNullOrEmptyConverter.shared.cs | 2 +-
.../HandlerImplementation/Popup/Popup.macios.cs | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/CommunityToolkit.Maui/Animations/BaseAnimation.shared.cs b/src/CommunityToolkit.Maui/Animations/BaseAnimation.shared.cs
index 4b406308c9..c5cee89798 100644
--- a/src/CommunityToolkit.Maui/Animations/BaseAnimation.shared.cs
+++ b/src/CommunityToolkit.Maui/Animations/BaseAnimation.shared.cs
@@ -24,10 +24,10 @@ public abstract class BaseAnimation(uint defaultLength = 250u) : Bi
public static readonly BindableProperty EasingProperty =
BindableProperty.Create(nameof(Easing), typeof(Easing), typeof(BaseAnimation), Easing.Linear, BindingMode.OneWay);
- ///
- /// The time, in milliseconds, over which to animate the transition.
- ///
- public uint Length
+ ///
+ /// The time, in milliseconds, over which to animate the transition.
+ ///
+ public uint Length
{
get => (uint)GetValue(LengthProperty);
set => SetValue(LengthProperty, value);
diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.macios.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.macios.cs
index e20bf61fac..295f517791 100644
--- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.macios.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.macios.cs
@@ -122,4 +122,4 @@ static void SetUIImageViewTintColor(UIImageView imageView, View element, Color c
imageView.Image = imageView.Image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
imageView.TintColor = color.ToPlatform();
}
-}
+}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.methods.shared.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.methods.shared.cs
index 6c8c27b6bf..dfec3980ef 100644
--- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.methods.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.methods.shared.cs
@@ -71,7 +71,7 @@ internal void HandleTouch(TouchStatus status)
{
ObjectDisposedException.ThrowIf(isDisposed, this);
- GestureManager.HandleTouch(this, status);
+ GestureManager.HandleTouch(this, status);
}
internal void HandleUserInteraction(TouchInteractionStatus interactionStatus)
diff --git a/src/CommunityToolkit.Maui/Converters/IsListNullOrEmptyConverter.shared.cs b/src/CommunityToolkit.Maui/Converters/IsListNullOrEmptyConverter.shared.cs
index f97168de9f..e39b247785 100644
--- a/src/CommunityToolkit.Maui/Converters/IsListNullOrEmptyConverter.shared.cs
+++ b/src/CommunityToolkit.Maui/Converters/IsListNullOrEmptyConverter.shared.cs
@@ -28,7 +28,7 @@ internal static bool IsListNullOrEmpty(IEnumerable? value)
}
var enumerator = value.GetEnumerator();
- bool result = !enumerator.MoveNext();
+ bool result = !enumerator.MoveNext();
((IDisposable)enumerator).Dispose();
return result;
diff --git a/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs b/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs
index 811b010e9a..7463afce8b 100644
--- a/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs
+++ b/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs
@@ -54,7 +54,7 @@ public static void MapOnClosed(PopupHandler handler, IPopup view, object? result
{
return;
}
-
+
if (popup.Content?.Parent is ContentPage contentPage)
{
parent.RemoveLogicalChild(contentPage);
From 4284967eb891b1d4edcb31308f76a3dbce4a789b Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Tue, 5 Nov 2024 15:46:56 -0800
Subject: [PATCH 082/171] Remove unused using directives
---
samples/CommunityToolkit.Maui.Sample/MauiProgram.cs | 1 -
.../Pages/Behaviors/CharactersValidationBehaviorPage.xaml.cs | 3 +--
.../Converters/ByteArrayToImageSourceConverterPage.xaml.cs | 1 -
.../Pages/Views/CameraView/CameraViewPage.xaml.cs | 1 -
.../Pages/Views/Expander/ExpanderPageCS.cs | 3 +--
.../Platforms/Android/MainActivity.cs | 1 -
.../ViewModels/Behaviors/EventToCommandBehaviorViewModel.cs | 3 +--
.../Behaviors/MaxLengthReachedBehaviorViewModel.cs | 3 +--
.../Behaviors/UserStoppedTypingBehaviorViewModel.cs | 3 +--
.../Converters/StateToBooleanConverterViewModel.cs | 3 +--
.../ViewModels/Layouts/UniformItemsLayoutViewModel.cs | 1 -
.../ViewModels/Views/MediaElement/MediaElementViewModel.cs | 4 +---
...eCommunityToolkitInitializationAnalyzerCodeFixProvider.cs | 5 -----
.../Essentials/FileSaver/FileSaverImplementation.android.cs | 2 --
.../Interfaces/IUniformItemsLayout.shared.cs | 4 +---
.../Platform/StatusBar/StatusBar.macos.cs | 3 +--
.../DrawingView/PlatformView/MauiDrawingView.android.cs | 4 ----
.../Views/DrawingView/PlatformView/MauiDrawingView.net.cs | 3 +--
.../Views/DrawingView/Service/DrawingViewService.macios.cs | 3 +--
.../Views/Popup/PopupExtensions.macios.cs | 1 -
.../Views/Snackbar/PlatformSnackbar.macios.cs | 2 --
.../Views/Toast/PlatformToast.macios.cs | 3 +--
.../AppBuilderExtensions.shared.cs | 1 -
.../Extensions/ElementExtensions.shared.cs | 1 -
.../Primitives/Metadata.macios.cs | 1 -
.../Services/MediaControlsService.android.cs | 1 -
.../Extensions/NamespaceSymbolExtensions.cs | 4 +---
.../Generators/TextColorToGenerator.cs | 3 ---
.../Behaviors/EmailValidationBehaviorTests.cs | 1 -
.../Behaviors/ImageTouchBehaviorTests.cs | 1 -
src/CommunityToolkit.Maui.UnitTests/Mocks/MockApplication.cs | 3 +--
src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs | 1 -
.../Views/AvatarView/AvatarViewInterfaceTests.cs | 1 -
.../Views/AvatarView/AvatarViewTests.cs | 1 -
.../Views/DrawingView/DrawingLineAdapterTests.cs | 3 +--
.../Views/DrawingView/DrawingLineTests.cs | 3 +--
.../Views/DrawingView/DrawingViewTests.cs | 3 +--
.../Views/Expander/ExpandedChangedEventArgsTests.cs | 4 +---
.../Views/MediaElement/ParentWindowTests.cs | 1 -
src/CommunityToolkit.Maui/AppBuilderExtensions.shared.cs | 4 +---
src/CommunityToolkit.Maui/Behaviors/MaskedBehavior.shared.cs | 1 -
.../IconTintColor/IconTintColorBehavior.android.cs | 1 -
.../Behaviors/Validators/MultiValidationBehavior.shared.cs | 2 --
.../HandlerImplementation/Popup/Popup.macios.cs | 1 -
src/CommunityToolkit.Maui/Options.cs | 1 -
src/CommunityToolkit.Maui/Views/Expander/Expander.macios.cs | 1 -
46 files changed, 19 insertions(+), 82 deletions(-)
diff --git a/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs b/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs
index 282571d41f..3dfa5ba83e 100644
--- a/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs
+++ b/samples/CommunityToolkit.Maui.Sample/MauiProgram.cs
@@ -29,7 +29,6 @@
using CommunityToolkit.Maui.Sample.Views.Popups;
using CommunityToolkit.Maui.Storage;
using Microsoft.Extensions.Http.Resilience;
-using Microsoft.Extensions.Logging;
using Microsoft.Maui.LifecycleEvents;
using Polly;
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/CharactersValidationBehaviorPage.xaml.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/CharactersValidationBehaviorPage.xaml.cs
index 32be9e1d29..d778f83b9d 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/CharactersValidationBehaviorPage.xaml.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/CharactersValidationBehaviorPage.xaml.cs
@@ -1,5 +1,4 @@
-using CommunityToolkit.Maui.Behaviors;
-using CommunityToolkit.Maui.Sample.ViewModels.Behaviors;
+using CommunityToolkit.Maui.Sample.ViewModels.Behaviors;
namespace CommunityToolkit.Maui.Sample.Pages.Behaviors;
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Converters/ByteArrayToImageSourceConverterPage.xaml.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Converters/ByteArrayToImageSourceConverterPage.xaml.cs
index 17f1d9bc9e..4be9cf458c 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Converters/ByteArrayToImageSourceConverterPage.xaml.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Converters/ByteArrayToImageSourceConverterPage.xaml.cs
@@ -1,5 +1,4 @@
using CommunityToolkit.Maui.Sample.ViewModels.Converters;
-using Microsoft.Maui.Dispatching;
namespace CommunityToolkit.Maui.Sample.Pages.Converters;
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/CameraView/CameraViewPage.xaml.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Views/CameraView/CameraViewPage.xaml.cs
index 8fa569addc..2dfe6e4165 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/CameraView/CameraViewPage.xaml.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/CameraView/CameraViewPage.xaml.cs
@@ -1,5 +1,4 @@
using System.Diagnostics;
-using CommunityToolkit.Maui.Core.Primitives;
using CommunityToolkit.Maui.Sample.ViewModels.Views;
using CommunityToolkit.Maui.Views;
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs
index 6003f2fec6..2b734abe23 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPageCS.cs
@@ -1,5 +1,4 @@
-using CommunityToolkit.Maui.Alerts;
-using CommunityToolkit.Maui.Core;
+using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Markup;
using CommunityToolkit.Maui.Views;
diff --git a/samples/CommunityToolkit.Maui.Sample/Platforms/Android/MainActivity.cs b/samples/CommunityToolkit.Maui.Sample/Platforms/Android/MainActivity.cs
index eec38ae6e0..246d9e7a3f 100644
--- a/samples/CommunityToolkit.Maui.Sample/Platforms/Android/MainActivity.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Platforms/Android/MainActivity.cs
@@ -1,6 +1,5 @@
using Android.App;
using Android.Content.PM;
-using Android.OS;
namespace CommunityToolkit.Maui.Sample;
diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/EventToCommandBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/EventToCommandBehaviorViewModel.cs
index 864c18db17..89ad4b9e59 100644
--- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/EventToCommandBehaviorViewModel.cs
+++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/EventToCommandBehaviorViewModel.cs
@@ -1,5 +1,4 @@
-using System.Windows.Input;
-using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors;
diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/MaxLengthReachedBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/MaxLengthReachedBehaviorViewModel.cs
index 369ed5d7ae..8d21b8007f 100644
--- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/MaxLengthReachedBehaviorViewModel.cs
+++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/MaxLengthReachedBehaviorViewModel.cs
@@ -1,5 +1,4 @@
-using System.Windows.Input;
-using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors;
diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/UserStoppedTypingBehaviorViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/UserStoppedTypingBehaviorViewModel.cs
index 3bf2c13dc2..9db438ef72 100644
--- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/UserStoppedTypingBehaviorViewModel.cs
+++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/UserStoppedTypingBehaviorViewModel.cs
@@ -1,5 +1,4 @@
-using System.Windows.Input;
-using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors;
diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/StateToBooleanConverterViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/StateToBooleanConverterViewModel.cs
index 3f202f76fd..c9900a5594 100644
--- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/StateToBooleanConverterViewModel.cs
+++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Converters/StateToBooleanConverterViewModel.cs
@@ -1,5 +1,4 @@
-using System.Windows.Input;
-using CommunityToolkit.Maui.Converters;
+using CommunityToolkit.Maui.Converters;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Layouts/UniformItemsLayoutViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Layouts/UniformItemsLayoutViewModel.cs
index 3f6ca30a81..bf649cd4ca 100644
--- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Layouts/UniformItemsLayoutViewModel.cs
+++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Layouts/UniformItemsLayoutViewModel.cs
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
-using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace CommunityToolkit.Maui.Sample.ViewModels.Layouts;
diff --git a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/MediaElement/MediaElementViewModel.cs b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/MediaElement/MediaElementViewModel.cs
index 3e5ee7e0ca..d119bfbb6b 100644
--- a/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/MediaElement/MediaElementViewModel.cs
+++ b/samples/CommunityToolkit.Maui.Sample/ViewModels/Views/MediaElement/MediaElementViewModel.cs
@@ -1,6 +1,4 @@
-using CommunityToolkit.Mvvm.ComponentModel;
-
-namespace CommunityToolkit.Maui.Sample.ViewModels.Views;
+namespace CommunityToolkit.Maui.Sample.ViewModels.Views;
public partial class MediaElementViewModel : BaseViewModel
{
diff --git a/src/CommunityToolkit.Maui.Analyzers.CodeFixes/UseCommunityToolkitInitializationAnalyzerCodeFixProvider.cs b/src/CommunityToolkit.Maui.Analyzers.CodeFixes/UseCommunityToolkitInitializationAnalyzerCodeFixProvider.cs
index cc3c1e443c..4a71e60dc9 100644
--- a/src/CommunityToolkit.Maui.Analyzers.CodeFixes/UseCommunityToolkitInitializationAnalyzerCodeFixProvider.cs
+++ b/src/CommunityToolkit.Maui.Analyzers.CodeFixes/UseCommunityToolkitInitializationAnalyzerCodeFixProvider.cs
@@ -1,15 +1,10 @@
using System.Collections.Immutable;
using System.Composition;
-using System.Linq.Expressions;
-using System.Reflection.Metadata.Ecma335;
-using System.Runtime.InteropServices.ComTypes;
-using CommunityToolkit.Maui.Analyzers;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
-using Microsoft.CodeAnalysis.Rename;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
namespace CommunityToolkit.Maui.Analyzers;
diff --git a/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs b/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs
index 51cf2bd437..80de8e2073 100644
--- a/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs
+++ b/src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs
@@ -1,5 +1,4 @@
using System.Buffers;
-using System.Runtime.Versioning;
using System.Web;
using Android.Content;
using Android.OS;
@@ -7,7 +6,6 @@
using Android.Webkit;
using CommunityToolkit.Maui.Core.Essentials;
using CommunityToolkit.Maui.Core.Extensions;
-using Java.IO;
using Microsoft.Maui.ApplicationModel;
using AndroidUri = Android.Net.Uri;
using Trace = System.Diagnostics.Trace;
diff --git a/src/CommunityToolkit.Maui.Core/Interfaces/IUniformItemsLayout.shared.cs b/src/CommunityToolkit.Maui.Core/Interfaces/IUniformItemsLayout.shared.cs
index e2916a9808..63807f64d6 100644
--- a/src/CommunityToolkit.Maui.Core/Interfaces/IUniformItemsLayout.shared.cs
+++ b/src/CommunityToolkit.Maui.Core/Interfaces/IUniformItemsLayout.shared.cs
@@ -1,6 +1,4 @@
-using Microsoft.Maui.Layouts;
-
-namespace CommunityToolkit.Maui.Core;
+namespace CommunityToolkit.Maui.Core;
///
/// Uniform Items Layout Control
diff --git a/src/CommunityToolkit.Maui.Core/Platform/StatusBar/StatusBar.macos.cs b/src/CommunityToolkit.Maui.Core/Platform/StatusBar/StatusBar.macos.cs
index 0d5e88e4fd..b11d4eac28 100644
--- a/src/CommunityToolkit.Maui.Core/Platform/StatusBar/StatusBar.macos.cs
+++ b/src/CommunityToolkit.Maui.Core/Platform/StatusBar/StatusBar.macos.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Runtime.Versioning;
+using System.Runtime.Versioning;
namespace CommunityToolkit.Maui.Core.Platform;
diff --git a/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.android.cs b/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.android.cs
index e61696edc8..4f3c66f639 100644
--- a/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.android.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.android.cs
@@ -3,10 +3,6 @@
using Android.Views;
using CommunityToolkit.Maui.Core.Extensions;
using Microsoft.Maui.Platform;
-using AColor = Android.Graphics.Color;
-using APaint = Android.Graphics.Paint;
-using APath = Android.Graphics.Path;
-using AView = Android.Views.View;
namespace CommunityToolkit.Maui.Core.Views;
diff --git a/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.net.cs b/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.net.cs
index fb304615f9..ce216111f0 100644
--- a/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.net.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/DrawingView/PlatformView/MauiDrawingView.net.cs
@@ -1,5 +1,4 @@
-using System;
-namespace CommunityToolkit.Maui.Core.Views;
+namespace CommunityToolkit.Maui.Core.Views;
public partial class MauiDrawingView : IDisposable
{
diff --git a/src/CommunityToolkit.Maui.Core/Views/DrawingView/Service/DrawingViewService.macios.cs b/src/CommunityToolkit.Maui.Core/Views/DrawingView/Service/DrawingViewService.macios.cs
index 968b4b7746..059fa4340c 100644
--- a/src/CommunityToolkit.Maui.Core/Views/DrawingView/Service/DrawingViewService.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/DrawingView/Service/DrawingViewService.macios.cs
@@ -1,5 +1,4 @@
-using System.Runtime.InteropServices;
-using Microsoft.Maui.Graphics.Platform;
+using Microsoft.Maui.Graphics.Platform;
using Microsoft.Maui.Platform;
namespace CommunityToolkit.Maui.Core.Views;
diff --git a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.macios.cs b/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.macios.cs
index 4079f4ba04..b314449730 100644
--- a/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.macios.cs
@@ -1,4 +1,3 @@
-using System.Runtime.InteropServices;
using Microsoft.Maui.Platform;
using ObjCRuntime;
diff --git a/src/CommunityToolkit.Maui.Core/Views/Snackbar/PlatformSnackbar.macios.cs b/src/CommunityToolkit.Maui.Core/Views/Snackbar/PlatformSnackbar.macios.cs
index f877678d20..dd27551754 100644
--- a/src/CommunityToolkit.Maui.Core/Views/Snackbar/PlatformSnackbar.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/Snackbar/PlatformSnackbar.macios.cs
@@ -1,5 +1,3 @@
-using System.Runtime.InteropServices;
-
namespace CommunityToolkit.Maui.Core.Views;
///
diff --git a/src/CommunityToolkit.Maui.Core/Views/Toast/PlatformToast.macios.cs b/src/CommunityToolkit.Maui.Core/Views/Toast/PlatformToast.macios.cs
index 015ba554cb..702ff17af6 100644
--- a/src/CommunityToolkit.Maui.Core/Views/Toast/PlatformToast.macios.cs
+++ b/src/CommunityToolkit.Maui.Core/Views/Toast/PlatformToast.macios.cs
@@ -1,5 +1,4 @@
-using System.Runtime.InteropServices;
-using CoreText;
+using CoreText;
using Microsoft.Maui.Platform;
namespace CommunityToolkit.Maui.Core.Views;
diff --git a/src/CommunityToolkit.Maui.MediaElement/AppBuilderExtensions.shared.cs b/src/CommunityToolkit.Maui.MediaElement/AppBuilderExtensions.shared.cs
index 48e82df15d..6d1cd023ac 100644
--- a/src/CommunityToolkit.Maui.MediaElement/AppBuilderExtensions.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/AppBuilderExtensions.shared.cs
@@ -1,5 +1,4 @@
using CommunityToolkit.Maui.Core.Handlers;
-using CommunityToolkit.Maui.Core.Views;
using CommunityToolkit.Maui.Views;
namespace CommunityToolkit.Maui;
diff --git a/src/CommunityToolkit.Maui.MediaElement/Extensions/ElementExtensions.shared.cs b/src/CommunityToolkit.Maui.MediaElement/Extensions/ElementExtensions.shared.cs
index da7d88180c..8d285d3610 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Extensions/ElementExtensions.shared.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Extensions/ElementExtensions.shared.cs
@@ -1,5 +1,4 @@
using System.Diagnostics.CodeAnalysis;
-using Microsoft.Maui.Platform;
namespace CommunityToolkit.Maui.Extensions;
static class ElementExtensions
diff --git a/src/CommunityToolkit.Maui.MediaElement/Primitives/Metadata.macios.cs b/src/CommunityToolkit.Maui.MediaElement/Primitives/Metadata.macios.cs
index 6642b03ada..0b7e127730 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Primitives/Metadata.macios.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Primitives/Metadata.macios.cs
@@ -1,5 +1,4 @@
using AVFoundation;
-using CommunityToolkit.Maui.Core;
using CoreMedia;
using Foundation;
using MediaPlayer;
diff --git a/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs b/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
index ccf78b2621..745e96f63c 100644
--- a/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
+++ b/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs
@@ -5,7 +5,6 @@
using Android.App;
using Android.Content;
using Android.Content.PM;
-using Android.Graphics;
using Android.Media;
using Android.OS;
using Android.Support.V4.Media.Session;
diff --git a/src/CommunityToolkit.Maui.SourceGenerators/Extensions/NamespaceSymbolExtensions.cs b/src/CommunityToolkit.Maui.SourceGenerators/Extensions/NamespaceSymbolExtensions.cs
index 015789b0f9..65b47751aa 100644
--- a/src/CommunityToolkit.Maui.SourceGenerators/Extensions/NamespaceSymbolExtensions.cs
+++ b/src/CommunityToolkit.Maui.SourceGenerators/Extensions/NamespaceSymbolExtensions.cs
@@ -1,6 +1,4 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+using System.Text;
using Microsoft.CodeAnalysis;
namespace CommunityToolkit.Maui.SourceGenerators.Extensions;
diff --git a/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs b/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs
index ea7734a5dc..14d79f7322 100644
--- a/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs
+++ b/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs
@@ -1,11 +1,8 @@
-using System.Collections.Generic;
using System.Collections.Immutable;
-using System.Linq;
using System.Text;
using CommunityToolkit.Maui.SourceGenerators.Extensions;
using CommunityToolkit.Maui.SourceGenerators.Helpers;
using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/EmailValidationBehaviorTests.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/EmailValidationBehaviorTests.cs
index 2fe78bad6d..a33c979349 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/EmailValidationBehaviorTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/EmailValidationBehaviorTests.cs
@@ -1,6 +1,5 @@
using System.Text.RegularExpressions;
using CommunityToolkit.Maui.Behaviors;
-using Microsoft.Maui.Platform;
using Xunit;
namespace CommunityToolkit.Maui.UnitTests.Behaviors;
diff --git a/src/CommunityToolkit.Maui.UnitTests/Behaviors/ImageTouchBehaviorTests.cs b/src/CommunityToolkit.Maui.UnitTests/Behaviors/ImageTouchBehaviorTests.cs
index 65f1f63705..104532e3c4 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Behaviors/ImageTouchBehaviorTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Behaviors/ImageTouchBehaviorTests.cs
@@ -2,7 +2,6 @@
using CommunityToolkit.Maui.Core;
using Nito.AsyncEx;
using Xunit;
-using IImage = Microsoft.Maui.IImage;
using View = Microsoft.Maui.Controls.View;
namespace CommunityToolkit.Maui.UnitTests.Behaviors;
diff --git a/src/CommunityToolkit.Maui.UnitTests/Mocks/MockApplication.cs b/src/CommunityToolkit.Maui.UnitTests/Mocks/MockApplication.cs
index 7a339440b9..61cc2f786e 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Mocks/MockApplication.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Mocks/MockApplication.cs
@@ -1,5 +1,4 @@
-using System.Reflection;
-using Microsoft.Maui.Controls.Internals;
+using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Handlers;
namespace CommunityToolkit.Maui.UnitTests.Mocks;
diff --git a/src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs b/src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs
index 5d9b629d28..f9dc26c96f 100644
--- a/src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/PopupServiceTests.cs
@@ -1,5 +1,4 @@
using System.ComponentModel;
-using System.Runtime.CompilerServices;
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.UnitTests.Mocks;
using CommunityToolkit.Maui.Views;
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewInterfaceTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewInterfaceTests.cs
index cdf97fd512..4966710ef3 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewInterfaceTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewInterfaceTests.cs
@@ -1,5 +1,4 @@
using CommunityToolkit.Maui.Core;
-using CommunityToolkit.Maui.UnitTests.Mocks;
using FluentAssertions;
using Xunit;
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs
index 6067c1b6ac..517d1887d9 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/AvatarView/AvatarViewTests.cs
@@ -1,7 +1,6 @@
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.UnitTests.Mocks;
using FluentAssertions;
-using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Controls.Shapes;
using Xunit;
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/DrawingView/DrawingLineAdapterTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/DrawingView/DrawingLineAdapterTests.cs
index 4cee6c76cc..789a7b38da 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/DrawingView/DrawingLineAdapterTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/DrawingView/DrawingLineAdapterTests.cs
@@ -1,5 +1,4 @@
-using System.Collections.ObjectModel;
-using CommunityToolkit.Maui.Core.Handlers;
+using CommunityToolkit.Maui.Core.Handlers;
using CommunityToolkit.Maui.Core.Views;
using FluentAssertions;
using Xunit;
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/DrawingView/DrawingLineTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/DrawingView/DrawingLineTests.cs
index d9c1cf84e2..5a29ab68da 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/DrawingView/DrawingLineTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/DrawingView/DrawingLineTests.cs
@@ -1,5 +1,4 @@
-using System.Collections.ObjectModel;
-using CommunityToolkit.Maui.Core;
+using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Core.Views;
using FluentAssertions;
using Xunit;
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/DrawingView/DrawingViewTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/DrawingView/DrawingViewTests.cs
index b473743b43..9901b68673 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/DrawingView/DrawingViewTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/DrawingView/DrawingViewTests.cs
@@ -1,5 +1,4 @@
-using System.Collections.ObjectModel;
-using CommunityToolkit.Maui.Core;
+using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Core.Handlers;
using CommunityToolkit.Maui.Core.Views;
using CommunityToolkit.Maui.UnitTests.Mocks;
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/Expander/ExpandedChangedEventArgsTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/Expander/ExpandedChangedEventArgsTests.cs
index 7a9db4026d..589c34b6c4 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/Expander/ExpandedChangedEventArgsTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/Expander/ExpandedChangedEventArgsTests.cs
@@ -1,6 +1,4 @@
-using System.Collections.ObjectModel;
-using CommunityToolkit.Maui.Core;
-using CommunityToolkit.Maui.Core.Views;
+using CommunityToolkit.Maui.Core;
using FluentAssertions;
using Xunit;
diff --git a/src/CommunityToolkit.Maui.UnitTests/Views/MediaElement/ParentWindowTests.cs b/src/CommunityToolkit.Maui.UnitTests/Views/MediaElement/ParentWindowTests.cs
index 7770c2261a..3b83a587fc 100644
--- a/src/CommunityToolkit.Maui.UnitTests/Views/MediaElement/ParentWindowTests.cs
+++ b/src/CommunityToolkit.Maui.UnitTests/Views/MediaElement/ParentWindowTests.cs
@@ -1,5 +1,4 @@
using CommunityToolkit.Maui.UnitTests.Mocks;
-using Microsoft.Extensions.DependencyInjection;
using Xunit;
using ParentWindow = CommunityToolkit.Maui.Extensions.PageExtensions.ParentWindow;
diff --git a/src/CommunityToolkit.Maui/AppBuilderExtensions.shared.cs b/src/CommunityToolkit.Maui/AppBuilderExtensions.shared.cs
index 56003290bf..404f8719c5 100644
--- a/src/CommunityToolkit.Maui/AppBuilderExtensions.shared.cs
+++ b/src/CommunityToolkit.Maui/AppBuilderExtensions.shared.cs
@@ -1,9 +1,7 @@
-using CommunityToolkit.Maui.Alerts;
-using CommunityToolkit.Maui.Core;
+using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Core.Handlers;
using CommunityToolkit.Maui.PlatformConfiguration.AndroidSpecific;
using CommunityToolkit.Maui.Views;
-using Microsoft.Maui.LifecycleEvents;
namespace CommunityToolkit.Maui;
diff --git a/src/CommunityToolkit.Maui/Behaviors/MaskedBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/MaskedBehavior.shared.cs
index 7e2d8175b1..a9a9bde807 100644
--- a/src/CommunityToolkit.Maui/Behaviors/MaskedBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/MaskedBehavior.shared.cs
@@ -1,6 +1,5 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
-using System.Runtime.InteropServices;
namespace CommunityToolkit.Maui.Behaviors;
diff --git a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.android.cs b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.android.cs
index 9845a43c12..633b2b05f8 100644
--- a/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.android.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/IconTintColor/IconTintColorBehavior.android.cs
@@ -1,5 +1,4 @@
using System.ComponentModel;
-using System.Diagnostics;
using Android.Graphics;
using Android.Widget;
using Microsoft.Maui.Platform;
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs
index f5d79c4a30..005bd8c69e 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/MultiValidationBehavior.shared.cs
@@ -1,6 +1,4 @@
using System.Collections.ObjectModel;
-using System.Collections.Specialized;
-using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
namespace CommunityToolkit.Maui.Behaviors;
diff --git a/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs b/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs
index 7463afce8b..a0896f2757 100644
--- a/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs
+++ b/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs
@@ -1,6 +1,5 @@
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Core.Handlers;
-using Microsoft.Maui.Controls;
using Microsoft.Maui.Handlers;
using Microsoft.Maui.Platform;
diff --git a/src/CommunityToolkit.Maui/Options.cs b/src/CommunityToolkit.Maui/Options.cs
index 4ce0199647..32cd5a376a 100644
--- a/src/CommunityToolkit.Maui/Options.cs
+++ b/src/CommunityToolkit.Maui/Options.cs
@@ -1,6 +1,5 @@
using CommunityToolkit.Maui.Behaviors;
using CommunityToolkit.Maui.Converters;
-using Microsoft.Maui.LifecycleEvents;
namespace CommunityToolkit.Maui;
diff --git a/src/CommunityToolkit.Maui/Views/Expander/Expander.macios.cs b/src/CommunityToolkit.Maui/Views/Expander/Expander.macios.cs
index 2f4de89d11..22b06b644a 100644
--- a/src/CommunityToolkit.Maui/Views/Expander/Expander.macios.cs
+++ b/src/CommunityToolkit.Maui/Views/Expander/Expander.macios.cs
@@ -1,4 +1,3 @@
-using System.Reflection;
using CoreGraphics;
using UIKit;
From 3ef7ef9981e65573b82fa76f3577d4e96d6fa7fb Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Tue, 5 Nov 2024 15:56:00 -0800
Subject: [PATCH 083/171] Add `[EditorBrowsable(EditorBrowsableState.Never)]`
---
.../Behaviors/AnimationBehavior.shared.cs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/CommunityToolkit.Maui/Behaviors/AnimationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/AnimationBehavior.shared.cs
index 9ecd06b0e8..7d01f0918f 100644
--- a/src/CommunityToolkit.Maui/Behaviors/AnimationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/AnimationBehavior.shared.cs
@@ -1,4 +1,5 @@
-using System.Diagnostics;
+using System.ComponentModel;
+using System.Diagnostics;
using CommunityToolkit.Maui.Animations;
namespace CommunityToolkit.Maui.Behaviors;
@@ -45,7 +46,8 @@ public partial class AnimationBehavior : EventToCommandBehavior
public Command AnimateCommand
{
get => (Command)GetValue(AnimateCommandProperty);
- [Obsolete(animateCommandSetterWarning)]
+
+ [Obsolete(animateCommandSetterWarning), EditorBrowsable(EditorBrowsableState.Never)]
set
{
Trace.WriteLine(animateCommandSetterWarning);
From a983d5689e8db2c10dc02191647276eace92a6b1 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Tue, 5 Nov 2024 16:25:41 -0800
Subject: [PATCH 084/171] Use `BindingBase.Create`
---
.../Popup/Popup.macios.cs | 22 ++++++++++++-------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs b/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs
index a0896f2757..98875981bb 100644
--- a/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs
+++ b/src/CommunityToolkit.Maui/HandlerImplementation/Popup/Popup.macios.cs
@@ -1,4 +1,5 @@
-using CommunityToolkit.Maui.Core;
+using System.Diagnostics;
+using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Core.Handlers;
using Microsoft.Maui.Handlers;
using Microsoft.Maui.Platform;
@@ -21,16 +22,21 @@ public static void MapOnOpened(PopupHandler handler, IPopup view, object? result
static PageHandler CreatePageHandler(IPopup virtualView)
{
- var mauiContext = virtualView.Handler?.MauiContext ?? throw new NullReferenceException(nameof(IMauiContext));
- var view = (View?)virtualView.Content ?? throw new InvalidOperationException($"{nameof(IPopup.Content)} can't be null here.");
- view.SetBinding(BindingContextProperty, new Binding
+ var mauiContext = virtualView.Handler?.MauiContext ?? throw new InvalidOperationException($"Unable to retrieve {nameof(IMauiContext)}");
+ var popupContent = (View)(virtualView.Content ?? throw new InvalidOperationException($"{nameof(IPopup.Content)} cannot be null."));
+
+ if (virtualView is BindableObject bindableObject)
+ {
+ popupContent.SetBinding(BindingContextProperty, BindingBase.Create(static bindable => bindable.BindingContext, source: bindableObject));
+ }
+ else
{
- Source = virtualView,
- Path = BindingContextProperty.PropertyName
- });
+ Trace.TraceInformation($"Unable to set {nameof(BindableObject.BindingContext)} for {nameof(IPopup)}.{nameof(IPopup.Content)} because {nameof(IPopup)} implementation does not inherit from {nameof(BindableObject)}");
+ }
+
var contentPage = new ContentPage
{
- Content = view
+ Content = popupContent
};
var parent = virtualView.Parent as Element;
parent?.AddLogicalChild(contentPage);
From 8e00d1c061526ca588d4d3ca5b94e2d80488b5c2 Mon Sep 17 00:00:00 2001
From: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Date: Wed, 6 Nov 2024 09:11:39 -0800
Subject: [PATCH 085/171] Update Options.cs
---
src/CommunityToolkit.Maui/Options.cs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/CommunityToolkit.Maui/Options.cs b/src/CommunityToolkit.Maui/Options.cs
index 32cd5a376a..36efa638fe 100644
--- a/src/CommunityToolkit.Maui/Options.cs
+++ b/src/CommunityToolkit.Maui/Options.cs
@@ -1,5 +1,8 @@
using CommunityToolkit.Maui.Behaviors;
using CommunityToolkit.Maui.Converters;
+#if WINDOWS
+using Microsoft.Maui.LifecycleEvents;
+#endif
namespace CommunityToolkit.Maui;
From e066f175d9a95e0b5862180dd13429b32d782db5 Mon Sep 17 00:00:00 2001
From: CliffAgius
Date: Thu, 7 Nov 2024 21:03:27 +0000
Subject: [PATCH 086/171] Renaming and changing ValidationFlags.ValidateOnFocus
and ValidateOnUnfocus to ValidateOnUnfocusED as the naming makes more sense.
This was from the MCT november standup...
---
.../Behaviors/Validators/ValidationBehavior.shared.cs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs
index 74d1882f43..757589ce1b 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/ValidationBehavior.shared.cs
@@ -14,9 +14,9 @@ public enum ValidationFlags
/// Validate on attaching
ValidateOnAttaching = 1,
/// Validate on focusing
- ValidateOnFocus = 2,
+ ValidateOnFocused = 2,
/// Validate on unfocus
- ValidateOnUnfocus = 4,
+ ValidateOnUnfocused = 4,
/// Validate upon value changed
ValidateOnValueChanged = 8,
/// Force make valid when focused
@@ -73,7 +73,7 @@ public abstract class ValidationBehavior : BaseBehavior, IDisposa
/// Backing BindableProperty for the property.
///
public static readonly BindableProperty FlagsProperty =
- BindableProperty.Create(nameof(Flags), typeof(ValidationFlags), typeof(ValidationBehavior), ValidationFlags.ValidateOnUnfocus | ValidationFlags.ForceMakeValidWhenFocused, propertyChanged: OnValidationPropertyChanged);
+ BindableProperty.Create(nameof(Flags), typeof(ValidationFlags), typeof(ValidationBehavior), ValidationFlags.ValidateOnUnfocused | ValidationFlags.ForceMakeValidWhenFocused, propertyChanged: OnValidationPropertyChanged);
///
/// Backing BindableProperty for the property.
@@ -292,8 +292,8 @@ protected override async void OnViewPropertyChanged(VisualElement sender, Proper
{
currentStatus = sender.IsFocused switch
{
- true => ValidationFlags.ValidateOnFocus,
- false => ValidationFlags.ValidateOnUnfocus
+ true => ValidationFlags.ValidateOnFocused,
+ false => ValidationFlags.ValidateOnUnfocused
};
await UpdateStateAsync(View, Flags, false).ConfigureAwait(false);
From 7713aab19081a9132113a49d2e09646fbf14af6c Mon Sep 17 00:00:00 2001
From: James Crutchley
Date: Thu, 7 Nov 2024 23:40:57 -0800
Subject: [PATCH 087/171] Fix compiled bindings For MediaElement
---
.../Views/MediaElement/MediaElementPage.xaml | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementPage.xaml
index d8d7bbfdae..609ce11a3e 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementPage.xaml
@@ -40,7 +40,7 @@
StateChanged="OnStateChanged"
SeekCompleted="OnSeekCompleted"/>
-