Share via

How do I access Shell PresentationMode in code?

EasyGoingPat 261 Reputation points
2021-12-14T09:57:44.047+00:00

When the Xamarin.Shell begins navigation, the Navigating event is fired. Inside here, is there any way to access the following property that I set in the constructor for the ContentPage being displayed (i.e. the one from which the navigation is initiated)?

public MyContentPage()
{
     Shell.SetPresentationMode( this, PresentationMode.Modal );
}

I've dug through just about everything in the debugger and can't find it anywhere.

  • Patrick
Developer technologies | .NET | Xamarin
0 comments No comments

Answer accepted by question author

JarvanZhang 23,971 Reputation points
2021-12-15T01:56:43.5+00:00

Hello PatrickRyder,​

Welcome to our Microsoft Q&A platform!

is there any way to access the following property that I set in the constructor for the ContentPage being displayed

To access the presentation mode of the page, try using Shell.GetPresentationMode method.

Here is the sample code, you could refer to it.

   var mode = Shell.GetPresentationMode(this);  

Best Regards,

Jarvan Zhang


If the response is helpful, 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.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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