Is there any way to make @bind-... a property readonly in blazor?

Asked

Viewed 29 times

1

Is there any way to make @bind-... a property readonly in blazor?

<MyComponent @bind-Property="@ReadOnlyProperty"  />

@code{

 public readonly bool ReadOnlyProperty= true;
}

Severity Code Description Project File Line Suppression State Error CS0191 A readonly field cannot be Assigned to (except in a constructor a variable initializer)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.