diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/NumericValidationBehaviorPage.xaml.cs b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/NumericValidationBehaviorPage.xaml.cs
index 62dd5603a8..03aa561cde 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/NumericValidationBehaviorPage.xaml.cs
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/NumericValidationBehaviorPage.xaml.cs
@@ -1,4 +1,5 @@
using CommunityToolkit.Maui.Alerts;
+using CommunityToolkit.Maui.Behaviors;
using CommunityToolkit.Maui.Sample.ViewModels.Behaviors;
namespace CommunityToolkit.Maui.Sample.Pages.Behaviors;
@@ -11,14 +12,15 @@ public NumericValidationBehaviorPage(NumericValidationBehaviorViewModel numericV
InitializeComponent();
}
-#if !DEBUG
- void SetEntryValue(object? sender, EventArgs e)
- {
-#else
async void SetEntryValue(object? sender, EventArgs e)
{
- await Toast.Make($"The app will crash because {nameof(Options.SetShouldSuppressExceptionsInBehaviors)} is false", Core.ToastDuration.Long).Show();
-#endif
+ var toastVisibilityTimeSpan = TimeSpan.FromSeconds(5);
+ var cts = new CancellationTokenSource(toastVisibilityTimeSpan);
+
+ await Toast.Make($"The app will crash because `null` is an invalid value for {nameof(NumericValidationBehavior)}.\nOptionally, {nameof(Options)}.{nameof(Options.SetShouldSuppressExceptionsInBehaviors)} can be set to true", Core.ToastDuration.Long).Show(cts.Token);
+
+ await Task.Delay(toastVisibilityTimeSpan, cts.Token);
+
SafeEntry.Text = null;
}
}
\ No newline at end of file
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/SelectAllTextBehaviorPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/SelectAllTextBehaviorPage.xaml
index 28aa52abcd..c1d8e00a96 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/SelectAllTextBehaviorPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Behaviors/SelectAllTextBehaviorPage.xaml
@@ -19,13 +19,8 @@
-
-
-
-
+
+
-
-
+
+
+
-
-
-
+
+
-
+
+
-
+
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/Converters/VariableMultiValueConverterPage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/Converters/VariableMultiValueConverterPage.xaml
index eea6b3b473..66b9af179f 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/Converters/VariableMultiValueConverterPage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/Converters/VariableMultiValueConverterPage.xaml
@@ -28,7 +28,7 @@
@@ -72,7 +72,7 @@
@@ -116,7 +116,7 @@
diff --git a/samples/CommunityToolkit.Maui.Sample/Pages/ImageSources/GravatarImageSourcePage.xaml b/samples/CommunityToolkit.Maui.Sample/Pages/ImageSources/GravatarImageSourcePage.xaml
index eea3a9aaa0..742daf7ebd 100644
--- a/samples/CommunityToolkit.Maui.Sample/Pages/ImageSources/GravatarImageSourcePage.xaml
+++ b/samples/CommunityToolkit.Maui.Sample/Pages/ImageSources/GravatarImageSourcePage.xaml
@@ -98,7 +98,7 @@
CornerRadius="32,0,0,32"
HeightRequest="128"
WidthRequest="128"
- SemanticProperties.Description="GravatarImageSourse used with AvatarView.">
+ SemanticProperties.Description="GravatarImageSource used with AvatarView.">
@@ -115,19 +115,16 @@
diff --git a/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs b/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs
index bc99b03ec0..a5ec82e75c 100644
--- a/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs
+++ b/src/CommunityToolkit.Maui/Behaviors/Validators/NumericValidationBehavior.shared.cs
@@ -69,7 +69,7 @@ public int MaximumDecimalPlaces
///
protected override string? Decorate(string? value)
- => base.Decorate(value)?.ToString()?.Trim();
+ => base.Decorate(value)?.Trim();
///
protected override ValueTask ValidateAsync(string? value, CancellationToken token)
@@ -83,17 +83,17 @@ protected override ValueTask ValidateAsync(string? value, CancellationToke
return new ValueTask(false);
}
- var decimalDelimeterIndex = value.IndexOf(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);
- var hasDecimalDelimeter = decimalDelimeterIndex >= 0;
+ var decimalDelimiterIndex = value.IndexOf(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);
+ var hasDecimalDelimiter = decimalDelimiterIndex >= 0;
// If MaximumDecimalPlaces equals zero, ".5" or "14." should be considered as invalid inputs.
- if (hasDecimalDelimeter && MaximumDecimalPlaces == 0)
+ if (hasDecimalDelimiter && MaximumDecimalPlaces == 0)
{
return new ValueTask(false);
}
- var decimalPlaces = hasDecimalDelimeter
- ? value.Substring(decimalDelimeterIndex + 1, value.Length - decimalDelimeterIndex - 1).Length
+ var decimalPlaces = hasDecimalDelimiter
+ ? value.Substring(decimalDelimiterIndex + 1, value.Length - decimalDelimiterIndex - 1).Length
: 0;
return new ValueTask(decimalPlaces >= MinimumDecimalPlaces && decimalPlaces <= MaximumDecimalPlaces);