AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
24.69k stars 2.14k forks source link

NumericUpDown not showing numeric-only keyboard on android #15850

Open MaxwellDAssistek opened 1 month ago

MaxwellDAssistek commented 1 month ago

Describe the bug

When using a NumericUpDown control, Avalonia incorrectly shows the full virtual keyboard instead of showing a numeric only virtual keyboard.

Screenshot ![image](https://github.com/AvaloniaUI/Avalonia/assets/61429558/70f797c4-f680-4faa-905f-4dff542308d2)

To Reproduce

<NumericUpDown />

Expected behavior

Tapping the NumericUpDown control should present the numeric-only virtual keyboard.

Avalonia version

11.0.10

OS

Android

Additional context

No response

stevemonaco commented 1 month ago

Do either of the following work?

<NumericUpDown TextInputOptions.ContentType="Numeric" />

Or

<Style Selector="NumericUpDown /template/ TextBox#PART_TextBox">
    <Setter Property="(TextInputOptions.ContentType)" Value="Numeric" />
</Style>

This seems like it should be default behavior, so leave the issue open for maintainers to evaluate unless it's fixed in nightly.

maxkatz6 commented 1 month ago

Yes. Current behavior is expected. You need to set TextInputOptions.ContentType if you want to make an effect on a keyboard type.

But it also makes sense to override default value on the NumericUpDown.

MaxwellDAssistek commented 1 month ago

TextInputOptions.ContentType="Numeric" does work, but it would be nice if NumericUpDown had a sensible default.

timunie commented 1 month ago

@MaxwellDAssistek as Max said we are open for a change here of the default. In case you want to file a PR for it.

MaxwellDAssistek commented 1 month ago

I'd like to also note that TextInputOptions does not show up in the attribute autocomplete (at least in Rider). So it is very challenging to figure this out.

stevemonaco commented 1 month ago

TextInputOptions sets attached properties, so the tooling autocomplete is more difficult than it is with dependency properties. It's somewhat analogous to extension methods where any class could "add" members (methods or metadata properties) to another.