Table of Contents

Class WholeNumberBoxes

Namespace
McServerLauncher.Views
Assembly
McServerLauncher.dll

What every Avalonia.Controls.NumericUpDown in the app is: a box for a whole number, typed in any language, that never ends up empty or showing something it did not save.

public static class WholeNumberBoxes
Inheritance
WholeNumberBoxes
Inherited Members

Remarks

Whole numbers only. A box parses with Any unless told otherwise, which takes the culture's thousands separator — in Spanish, the dot. Typing 1.5 for the RAM saved 15 GB. Every setting behind these boxes is an int, so they read Integer, and a decimal is simply not a number they accept.

Never empty. Deleting the number left Value null, and every setting behind these boxes is a plain int: the binding could not write a null into it and showed InvalidCastException: Could not convert '(null)' to System.Int32 under the box, in red. While somebody is typing, an empty box is fine — they are about to put a number in, and WholeNumberConverter simply writes nothing until they do. Once the box loses focus still empty, the number it had comes back.

Never showing what it did not take. Text that is not a whole number (abc, 1.5) never becomes the value, so once the box loses focus the value it holds is written back over it.

Installed once for every box in the app, including the ones a view fills by hand.

Methods

Install()

public static void Install()