Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ public enum ValidationType
/// <summary>
/// Phone number validation
/// </summary>
PhoneNumber
PhoneNumber,

/// <summary>
/// Currency validation
/// </summary>
Currency
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using System.Diagnostics;
using System.Globalization;
using System.Text.RegularExpressions;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
Expand Down Expand Up @@ -82,6 +83,9 @@ private static void ValidateTextBox(TextBox textBox, bool force = true)
case ValidationType.Characters:
regexMatch = textBox.Text.IsCharacterString();
break;
case ValidationType.Currency:
regexMatch = decimal.TryParse(textBox.Text, NumberStyles.Currency, CultureInfo.CurrentCulture, out _);
break;
}

if (!regexMatch && force)
Expand Down