NumericTextBox

0

Описание

A custom Avalonia control designed for numeric input only. It supports various number formats and automatically blocks invalid input from both keyboard and clipboard.

Языки

  • C#100%
README.md

NumericTextBox for Avalonia

A custom Avalonia control designed for numeric input only. It supports various number formats and automatically blocks invalid input from both keyboard and clipboard.

Features

  • Restricts input to numeric values (integer or decimal);
  • Supports multiple number styles (e.g., thousand separators, currency formats);
  • Automatically filters non-numeric characters during clipboard paste.

Get NumericTextBox

dotnet add package NumericTextBoxForAvalonia

Or add a package reference to your project file:

Include the NumericTextBox control theme

After installing the package, add the following to your

App.axaml
file:


NumericTextBox
looks like
TextBox
and has the same behaviour. You can examine the sample here. If the input text becomes invalid after changing
NumberStyle
or
NumberFormatInfo
, the control applies the
:incorrecttext
class and sets
HasIncorrectValue
to true. Subscribe to the
IncorrectInputOccurred
event to receive notifications when invalid input is detected.