You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I find myself writing a lot of boilerplate code when doing two-way bindings in Blazor like below. (It adds up if you have multiple parameters..)
@code {
[Parameter]
public TValue Value { get; set; }
[Parameter]
public EventCallback<TValue> ValueChanged { get; set; }
}
I think it would be nice to introduce another attribute that would generate the same source by only declaring one property.
Describe the solution you'd like
I would like it to look something like below (attribute semantics up for discussion)
@code {
[BindableParameter]
public TValue Value { get; set; }
}
Which would generate exactly the same source as
@code {
[Parameter]
public TValue Value { get; set; }
[Parameter]
public EventCallback<TValue> ValueChanged { get; set; }
}
Additional context
If I haven't missed anything obvious here I think this is a very clean and non-intrusive solution. I always write my bindable properties like this and have not yet encountered any situation that breaks that rule. Therefor I think this added attribute makes sense.
Please give feedback on this and let me know if I should take a look at it or if you want to do it yourselves!
The text was updated successfully, but these errors were encountered:
Thanks for contacting us.
We plan to implement source generators for Razor in .NET 6. Once that work is done, you'll be able to implement your own source generator which would do what you want.
Is your feature request related to a problem? Please describe.
I find myself writing a lot of boilerplate code when doing two-way bindings in Blazor like below. (It adds up if you have multiple parameters..)
I think it would be nice to introduce another attribute that would generate the same source by only declaring one property.
Describe the solution you'd like
I would like it to look something like below (attribute semantics up for discussion)
Which would generate exactly the same source as
Additional context
If I haven't missed anything obvious here I think this is a very clean and non-intrusive solution. I always write my bindable properties like this and have not yet encountered any situation that breaks that rule. Therefor I think this added attribute makes sense.
Please give feedback on this and let me know if I should take a look at it or if you want to do it yourselves!
The text was updated successfully, but these errors were encountered: