question

David-7465 avatar image
0 Votes"
David-7465 asked David-7465 commented

How to open modal page from ShellContent Tab?

Is it possible to open a modal page from the TabBar?

For instance using this snipped code:

     <TabBar>
         <ShellContent Title="About" Icon="icon_about.png" Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" />        
         <ShellContent Title="Browse" Icon="icon_feed.png" ContentTemplate="{DataTemplate local:ItemsPage}" />        
     </TabBar>

If I wanted to open ItemsPage as modal and the content page has got Shell.PresentationMode="ModalAnimated", how could I do it?


dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JarvanZhang-MSFT avatar image
1 Vote"
JarvanZhang-MSFT answered David-7465 commented

Hello,​

Welcome to our Microsoft Q&A platform!

How to open modal page from ShellContent Tab

ShellContent represents the ContentPage objects for each tab. It dosn't support to use a model page as the shellContent directly. Because the shellContents are displayed inside the shell template, using a model page will jump outside the shell which may bring bad user experience.

The mode page should be used in the scenarios like clicking the close button or completing registration.

Check the doc: https://devblogs.microsoft.com/xamarin/xamarin-forms-shell-quick-tip-modal-navigation/

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.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you. I will think about my design in a different way.

0 Votes 0 ·