-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Description
Description
Bind a property or field on other DOM events by including an @bind:event="{EVENT}" attribute with a DOM event for the {EVENT} placeholder. The following example binds the InputValue property to the <input> element's value when the element's oninput event ([input](https://developer.mozilla.org/docs/Web/API/HTMLElement/input_event)) is triggered. Unlike the onchange event ([change](https://developer.mozilla.org/docs/Web/API/HTMLElement/change_event)), which fires when the element loses focus, oninput ([input](https://developer.mozilla.org/docs/Web/API/HTMLElement/input_event)) fires when the value of the text box changes.
This sections makes it seem like you can use any DOM EVENT as the trigger for binding. It only works with oninput and onchange as far as I can tell. onkeydown doesn't work for example. Internally it looks like the DOM EVENT must be mapped to the ChangeEventArgs class for the event to work.
It also doesn't call out that the "on" prefix is needed before the DOM EVENT name.
Thanks
George
Page URL
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/components/data-binding.md
Document ID
3f912dfc-5ba5-6c6c-ba93-1ae78508a5cc
Platform Id
ad2f661d-d520-a055-4a4e-26b9520e6ce3
Article author
Metadata
- ID: b211df59-e1c9-86c0-c904-31fa3c361e6d
- PlatformId: ad2f661d-d520-a055-4a4e-26b9520e6ce3
- Service: aspnet-core
- Sub-service: blazor
Metadata
Metadata
Assignees
Labels
Type
Projects
Status