I am new to Blazor and MudBlazor. I am using a and I want to call an event when the selection changes. The documentation show there is a EventCallback method but there are no syntax examples. I have been searching a good part of the day but cannot find an example. Can anyone please share some simple code? I know I can bind to a variable, and I initially did that. What I want is to call code and do some different code based on the selected value. Seems to be easier to do in Blazor syntax vs MudBlazor.
<MudRadioGroup T="string" SelectedOption="@SelectedOption" SelectedOptionChanged="OnSelectedOptionChanged">
<MudRadio Option="@("Radio 1")" Color="Color.Primary">Primary</MudRadio>
<MudRadio Option="@("Radio 2")" Color="Color.Secondary">Secondary</MudRadio>
<MudRadio Option="@("Radio 3")">Default</MudRadio>
<MudRadio Option="@("Radio 4")" Color="Color.Primary" Disabled="true">Disabled</MudRadio>
</MudRadioGroup>
@code {
public string SelectedOption { get; set; }
private void OnSelectedOptionChanged(string selectedOption)
{
SelectedOption = selectedOption;
// call your stuff
}
}