NumericUpDown looks broken when disabled #16939
-
|
I am currently building my first Avalonia application and I am using a lot of NumericUpDown controls. To me the control looks broken when "IsEnabled" is set to false (top enabled, bottom disabled): I would have expected that either both the text edit and the spinner have the border visible or not, not this strange mixture. Is this the expected behavior or am I doing it wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
It looks ok here. (Fluent Theme, 11.1.0 and nightly) The image looks like you're constricting the control's Height and the |
Beta Was this translation helpful? Give feedback.
-
|
I am using the "Dense" Density Style of the Fluent Theme, but switching back to normal still looks the same. There are no constraint on the height of the NumericUpDown. I am using the latest Avalonia and Fluent Theme versions 11.1.3. Switching to 11.1.0 gives the same results. I just tried the "Light" Theme Variant and that one looks ok. As it turns out the Color Palette I created for the "Dark" Theme Variant is the culprit, if I remove it, the Dark Theme is also ok. |
Beta Was this translation helpful? Give feedback.
-
|
This seems to be an issue with the Theme Editor: https://theme.xaml.live/ Simply using the default settings, clicking "Export" and using those in my application reproduces the issue. Edit: Removing the line for the "BaseLow" color fixes the issue. No idea why though. Edit 2: Instead of #ff333333 I am now using the (I think original Fluent Theme) value #33ffffff which works fine. If I understand this correctly this should be the same color, just using alpha instead of reducing the RGB components. I still think this should get fixed in the Theme Editor. Where should I report this? |
Beta Was this translation helpful? Give feedback.


After investigating, this isn't the Theme Editor. There's an error (IMO) in the
NumericUpDownControlThemewhich took some work to track down. There's a negative margin in itsTextBoxwhich I believe spills it out on top of the border we expect to be drawn.Avalonia/src/Avalonia.Themes.Fluent/Controls/NumericUpDown.xaml
Lines 77 to 80 in 77fe040
A bit fortuitous that it only happens in
:disabledas theMarginwill haveControlTemplatepriority from the local set value. A conditional activator like:disabledwill bump the setter priority up so you can successfully ov…