An "extra compact" mode for NumberBox #548
PremekTill
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm porting some of our older WPF-based industrial apps to Avalonia and I often run into problems with the space needed for both Avalonia's NumericUpDown and FluentAvalonia's NumberBox. In WPF, I had my own hand-rolled numeric input fields (since there are none out fo the box), which had the spinner buttons inline one above the other. This meant the field could be fairly small, which is quite useful when trying to fit dozens or hundreds of numeric parameters into a single view, often used on smaller, embedded or portable screens. In comparison, Avalonia's NumericUp requires a lot more horizontal space to fit the large Up and Down buttons alngoside each other.
I was very happy to find the Compact SpinButtonPlacementMode in FluentAvalonia, which seemed to achieve exactly this, but even the Compact mode turns out to require quite a bit of horizontal space. When triggering the popup, both the Popup and the Clear glyph take up a lot of space, meaning that for NumberBoxes below approximately 95 px, the text gets pushed out of view, hiding the edited value. A Width of 95 is quite a bit of space, especially when entering smaller integers - in the collapsed state, there is a huge box, of which more than 1/2 is taken up by empty space, which is only there for the opened state to be usable.
Opened NumberBox with Width = 70 (number is hidden)
Opened NumberBox with Width = 95 (number is visible)
As such, I would like to have another mode for the NumberBox, which would look similar to the Compact variant, but allow editing directly by clicking on the Up/Down glyphs, instead of opening a popup - something like the DefaultSpinButton example here. Obviously, this could be done fairly easily just by re-theming the control in user code. However, I believe that something like this could be useful to quite a few other people, and as such, might be nice to have in the library out of the box. If you were interested in adding such a mode, I could try implementing it and opening a pull request, though it might take me a while to find the time for it.
Beta Was this translation helpful? Give feedback.
All reactions