Hello,
Please try the following code and check if it works for you.
<ContentPage ...
xmlns:local ="clr-namespace:XXX"
Shell.NavBarIsVisible="{Binding IsHidden}"// It works if IsHidden is true or false when the Page is loaded
>
<ContentPage.BindingContext>
<local:ShellViewModel></local:ShellViewModel>
</ContentPage.BindingContext>
private void OnCounterClicked(object sender, EventArgs e)
{// click button
ShellViewModel viewModel = this.BindingContext as ShellViewModel;
viewModel.IsHidden = !viewModel.IsHidden;
Shell.SetNavBarIsVisible(this, viewModel.IsHidden);// If you want to change the value in the Page, you have to call SetNavBarIsVisible method
}
Best Regards, Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.