-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add method to indicate an event handler should enforce value consistency #17281
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
Comments
The namespace Microsoft.AspNetCore.Components
{
//
// Summary:
// Supplies information about an change event that is being raised.
public class ChangeEventArgs : EventArgs
{
public ChangeEventArgs();
//
// Summary:
// Gets or sets the new value.
public object Value { get; set; }
}
} Can't we use the public void ChangeEvent(ChangeEventArgs args)
{
args.Value = "new value";
} |
Could you also look into a scenario where the value is modified elsewhere, for example in a form submit method. The change in MyValue won't be related to the |
I'm looking for a workaround.
|
@hultqvist I know its a little late, but you can do a get and set with a private variable like this illustrates |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Looking forward to this one! |
@SteveSandersonMS Do we still need this now that we have get/set/after? |
@SteveSandersonMS I believe this is handled, if not, feel free to reopen |
In other words, a way to tell Blazor that a given event handler is part of a two-way binding even if you're not using
@bind
.It would probably look like this:
... or maybe
@onchange:sync
or@onchange:twoWay
. The implementation is simply to emit abuilder.SetUpdatesAttributeName
call for whatever is the "value" attribute for this element type (e.g., on<input type=checkbox>
it would callbuilder.SetUpdatesAttributeName("checked");
).For more details about the scenario and justification for this design, see #17099 (comment)
The text was updated successfully, but these errors were encountered: