Visibility button

Hello, how are you?
Is that possible to set up a button to change visibility of a label for example?
If it is, how can i do this?

Kind regards,
Lucas

1 Like

Hi @Lucas_Lopez,

Just set the Visible property of the label to some boolean property. Then toggle that property in the Click event of the button.

<RadzenLabel Visible="@labelIsVisible" />
<RadzenButton Click="@(args => ButtonClick())" />
@code {
   bool buttonIsVisible = true;

   void ButtonClick()
   {
      labelIsVisible = !labelIsVisible;
   }
}

If you are using Radzen you can do it like this:

  1. Create the boolean property
  2. Data-bind the Visible property of the Label to it
  3. Toggle the boolean property in the Click event
2 Likes