Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More explanation and explicit guidelines needed #34075

Open
ialbert-AUT opened this issue Nov 11, 2024 · 2 comments
Open

More explanation and explicit guidelines needed #34075

ialbert-AUT opened this issue Nov 11, 2024 · 2 comments

Comments

@ialbert-AUT
Copy link

ialbert-AUT commented Nov 11, 2024

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

Copy link
Contributor

🍂🎃🏮 Autumn Skies and Pumpkin Pies! 🥧☕🍂

Stand by! A green dinosaur 🦖 will arrive shortly to assist.

@guardrex
Copy link
Collaborator

Hello @ialbert-AUT ...

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.

It was leftover from the <7.0 era before binding with :get/:set appeared. I'll adjust that remark when I work #33994.

To learn more about the prior approach for two-way binding with a property and discarding the Task, see the 6.0 version of that section ...

https://learn.microsoft.com/en-us/aspnet/core/blazor/components/data-binding?view=aspnetcore-6.0#bind-across-more-than-two-components

With regard to the other scenarios that you mentioned, I'd like to discuss them with one of the product unit engineers. .NET 9 is releasing this week, and I'm working on some high priority security coverage at the moment. We'll circle back around to this issue shortly. Let's get past the current workload and .NET 9 release first ⛰⛏😅.

@guardrex guardrex moved this from Triage to P2 - Medium Priority in Blazor.Docs Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: P2 - Medium Priority
Development

No branches or pull requests

2 participants