Description
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!