Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to get inputs from a mobile virtual keyboard in MAUI?

$
0
0

I would like to be able to know which key is pressed on a mobile keypad, but @onkeyup only triggers when the mobile equivalent of enter is pressed, with KeyboardEventArgs.Code equaling an empty string. I have tried looking up any information on a mobile equivalent of KeyboardEventArgs, or even just why @onkeyup doesn't trigger when every key is pressed despite onkeyup="this.value = this.value.toUpperCase()" working on each key stroke just fine. I'm frankly bamboozled.

HTML code that works:

<input @bind="StringInput" id="textInput" onkeyup="this.value = this.value.toUpperCase()" />

Blazor code I've tried:

<input @bind="StringInput" id="textInput" @onkeyup="InputReceivedInput" />@code {    private string StringInput = string.Empty;    private void InputReceivedInput(KeyboardEventArgs Args)    {        if (Args.Code == "Enter" || Args.Code == "NumpadEnter")        {            //call another function        }        else        {            StringInput = StringInput.ToUpper();        }    }}

Second Attempt (only changed HTML portion):

<input @bind="StringInput" id="textInput" onkeyup="@InputReceivedInput" />

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>