Hiding MudText dynamically in blazor

221 Views Asked by At

I am using Mudtext binded to a property:

<MudTextField Value="@MyClass.Age" Label="Age"  />

I can't find way to hide this textbox dynamically based on some property.

1

There are 1 best solutions below

2
On BEST ANSWER

Usually if you don't want to display something based on a value of a variable you use in your Razor page:

@if(shown)
{
    <MudTextField Value="@MyClass.Age" Label="Age"  />
}

@code
{
   bool shown = true;
   private void SomeFunction()
   {
       shown = false;
   }
}