Add implicit zero for decimal numbers
MODIFY
WalletWasabi.Fluent/Controls/CurrencyEntryBox.axaml.cs
WalletWasabi.Fluent/Controls/CurrencyEntryBox.axaml.cs
@@ -128,6 +128,12 @@ public class CurrencyEntryBox : TextBox
protected override void OnTextInput(TextInputEventArgs e)
{
+ if (Text.Trim() == "" && e.Text == ".")
+ {
+ InsertImplicitZeroForDecimal(e);
+ return;
+ }
+
var input = e.Text ?? "";
// Reject space char input when there's no text.
if (string.IsNullOrWhiteSpace(Text) && string.IsNullOrWhiteSpace(input))
@@ -152,6 +158,13 @@ public class CurrencyEntryBox : TextBox
base.OnTextInput(e);
}
+ private void InsertImplicitZeroForDecimal(TextInputEventArgs e)
+ {
+ e.Text = "0.";
+ CaretIndex = e.Text.Length;
+ base.OnTextInput(e);
+ }
+
private bool ValidateEntryText(string preComposedText)
{
// Check if it has a decimal separator.

Add implicit zero for decimal numbers