Skip to content

More explanation and explicit guidelines needed #34075

@ialbert-AUT

Description

@ialbert-AUT

Description

The documentation says:
"Two-way binding to a property with get/set accessors requires discarding the Task returned by EventCallback.InvokeAsync. For two-way data binding, we recommend using @Bind:get/@Bind:set modifiers. For more information, see the @Bind:get/@Bind:set guidance in the earlier in this article."

It is not clear where the Task and InvokeAsync is also not clear about supported c# property usage. The beginning of the article explicitly says you can bind to a c# property.

I would need more explicit guidlines for the scenarios like:

  • binding to field -> no validation, no logic --> no need for event:oninput
  • :after -> async operation (debounce problem, Rx etc)
  • :get / :set -> use then validation logic needed, value can be modified in the setter, event:oninput is ok to use here.
  • C# property get-set -> don't use with event:oninput? don't modify value in the setter? only for formatting and type conversion with onchange?

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/components/data-binding?view=aspnetcore-8.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/components/data-binding.md

Document ID

3f912dfc-5ba5-6c6c-ba93-1ae78508a5cc

Article author

@guardrex

Related Issues

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions