Quantcast
Channel: User Liyun Zhang - MSFT - Stack Overflow
Viewing all articles
Browse latest Browse all 444

Answer by Liyun Zhang - MSFT for .NET MAUI Navigation - Back to mainpage/home page

$
0
0

You can use the Shell.TitleView to show the back button. And handle the button's clicked event to go back to MainPage:

<Shell.TitleView><Grid ColumnDefinitions="2*,8*"><Button Text="Back" Clicked="Button_Clicked" HorizontalOptions="Start" Grid.Column="0"/></Grid></Shell.TitleView>

And in the code behind:

 private void Button_Clicked(object sender, EventArgs e) {     Shell.Current.GoToAsync("///MainPage"); }

And you can show or hide the button by checking if the current page is rootpage or not.


Viewing all articles
Browse latest Browse all 444

Trending Articles