Using the Code Generator, add the {ParameterName}Changed Parameter to all current non-EventCallback parameters. This exposes 2-way binding to end users, who can then use @bind-ParameterName="_localVariable" to bind.
Example:
public class DistanceMeasurement2DWidget: Widget
{
...
// existing parameter
[Parameter]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DistanceMeasurement2DViewModel? ViewModel { get; set; }
// new parameter
[Parameter]
[JsonIgnore]
public EventCallback<DistanceMeasurement2DViewModel> ViewModelChanged { get; set; }
}
Usage:
<MapView>
<Map>
</Map>
<DistanceMeasurement2DWidget @ref="_distanceWidget"
Visible="false"
Position="OverlayPosition.BottomRight"
@bind-ViewModel="_distanceWidgetViewModel"
@bind-ViewModel:after="StateHasChanged" />
</MapView>
Using the Code Generator, add the
{ParameterName}ChangedParameter to all current non-EventCallbackparameters. This exposes 2-way binding to end users, who can then use@bind-ParameterName="_localVariable"to bind.Example:
Usage: