A Microsoft framework for building cross-platform mobile apps using .NET and C# with native performance and user interfaces.
Hello,
Welcome to our Microsoft Q&A platform!
System.InvalidOperationException: Cannot remove root page when it is also the currently displayed page
The page cannot be removed when it's currently displayed page. You could remove the 'MyPage11' in the OnDisAppearing() method of the 'MyPage22'. Or set the 'MyPage22' as the root page directly, which will remove the 'MyPage11' in the navigation stack.
async void Button_Clicked(System.Object sender, System.EventArgs e)
{
App.Current.MainPage = new MyPage22();
}
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
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.