Net Maui How to show or hide ( collapsed ) content in stacklayout or grid ?

Sami 966 Reputation points
2023-01-15T00:02:06.5266667+00:00

<StackLayout ZIndex="1" x:Name="Page" IsVisible="true" ></StackLayout>

<StackLayout x:Name="Page2" IsVisible="false" ></StackLayout>

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,904 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sami 966 Reputation points
    2023-01-26T08:43:50.54+00:00
     private void OnCounterClicked(object sender, EventArgs e)
          {
                Page.IsVisible=!Page.IsVisible; (Page has to be false - hide this content first)
    
        Page2.IsVisible = !Page2.IsVisible; (Page2 has to be true - show this content)
    }
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.