I have the following Blazor component:
@using System.Linq.Expressions@typeparam T@switch(Value){ case bool boolValue:<InputCheckbox @bind-Value=boolValue @bind-Value:after=ChangeValue /> break; case string stringValue:<InputText @bind-Value=stringValue @bind-Value:after=ChangeValue /> break;}@code { [Parameter] public T Value { get; set; } [Parameter] public EventCallback<T> ValueChanged { get; set; } [Parameter] public Expression<Func<T>>? ValueExpression { get; set; } = default; private async Task ChangeValue() { await ValueChanged.InvokeAsync(Value); }}I am not clear how to bind the updated boolValue in InputCheckbox or stringValue in InputText back to Value and how to effectively coerce a bool or string into T.
If there is a better pattern for templating an editor such as this, then I am all for it, but I am going to be doing additional things within this editor once I get the basics working.