Bind:after not calling assigned method in server side blazor – c# – mudblazor

  Kiến thức lập trình

I am trying to use the @bind-Value and @bind-Value:after to call a method after the bind has happened, but i am either getting an error in my code or the call to the method won’t happen.

With this i get error Compiler Error CS0407 ‘return-type method’ has the wrong return type

<MudCheckBox Label="@R["Show title"]" Disabled="(!MayEdit && !MayDelete)" @bind-Value="@OptionsModel.Title_Visible" T="bool" @bind-Value:after="IsDirty"></MudCheckBox>

If I add brackets to the method it complains about Compiler Error CS1503
Argument ‘1’ cannot convert from “bool” to “System.Action”

If i put it in a lambda it will compile but won’t call the method when the checkbox changes
<MudCheckBox Label="@R["Show title"]" Disabled="(!MayEdit && !MayDelete)" @bind-Value="@OptionsModel.Title_Visible" T="bool" @bind-Value:after="(() => IsDirty())"></MudCheckBox>

The method is in the class file ChartPropertyView.razor.cs, the Checkbox is in ChartPropertyView.cs
public override bool IsDirty()

IsDirty() doesn’t get colored yellow in VS Professional 2022 V. 17.7.7 and can’t be hovered for infos as normally

New contributor

KimVerona is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.