Question MudTextField OnKeyPress event handler Signature (parameters)

Pablo

Well-known member
Joined
Aug 12, 2021
Messages
62
Programming Experience
10+
Hi,
Can I handle OnKeyPress on MudTextField getting the char before writting it, like in WinForms? How? How would the C# method parameters be? And how to add it inside the MudTextField tag?
I have something like this, and tried searching but found nothing, and think I'm missing something.
Trying to handle OnKeyPress correctly:
@page "/calc"

<PageTitle>Calculator</PageTitle>

<h3>Calculator</h3>

<MudTextField @bind-Value="input" @onkeypress="OnKeyPress"></MudTextField>
<MudButton @onclick="Calculate">=</MudButton>

@code {
    private string input = string.Empty;

    private void OnKeyPress()
    {
        
    }

    private void Calculate()
    {
        
    }
}
Thank you.
Pablo
PS: I managed to create a MudBlazor project, as cjard suggested me.
 

Latest posts

Back
Top Bottom