0

So when I push an Page over the other:

Shell.Current.Navigation.PushAsync(new XampelPage());

is it possible in the new Page to see the Page that pushed it there? For example if the Background is transparent, is there an way to show it in the Background?

Silver Sky
  • 113
  • 1
  • 7
  • I highly doubt it. I guess that you could achieve that using a page with a Grid or absolute layout and then put the new page as a children like different layers. It would be like a dialog inside a page – Juan Sturla Sep 24 '21 at 17:44
  • mhm maybe i could do an screenshot and set the background of the new page to it @JuanSturla (thx for answering) – Silver Sky Sep 24 '21 at 17:51
  • I never thought of that idea. That could work too. Whatever is best for you :) – Juan Sturla Sep 24 '21 at 18:08

3 Answers3

1

I highly doubt that you could see the other page if you push another and set it's background color to Transparent.

You could achieve that using a page with a Grid or absolute layout.These layouts allow you "stack" components

Then you add the new view as a children and start forming the different layers. It would be like a dialog inside a page.

Juan Sturla
  • 1,254
  • 1
  • 4
  • 18
1

First, for the Shell Stack, when a route from the Shell visual hierarchy is navigated to, a navigation stack isn't created. However, when a page that's not in the Shell visual hierarchy is navigated to, a navigation stack is created.

is it possible in the new Page to see the Page that pushed it there? For example if the Background is transparent, is there an way to show it in the Background?

You could try to use CarouselView to simulate. For more information about the CarouselView, please refer to the link below. https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/carouselview/interaction

Wendy Zang - MSFT
  • 10,509
  • 1
  • 7
  • 17
1

You could use a Modal page to accomplish this. In the page you are navigating to, set the property Shell.PressentationMode="ModalAnimated". Here's an example of setting that property in the style:


<Style TargetType="base:BaseModalPage" ApplyToDerivedTypes="True"> <!-- Just a custom Page Type I created -->
    <Setter Property="BackgroundColor" Value="{StaticResource BackgroundTranslucentColor}" />
    <Setter Property="Padding" Value="{StaticResource ModalPaddingThickness}" />
    <Setter Property="Shell.PresentationMode" Value="ModalAnimated" />
</Style>

When you navigate with Shell.Current.GoToAsync(...), it will push on the stack modally, which will show the previous page behind it if the page is translucent.

Here's a blog post about navigating modally with shell: https://devblogs.microsoft.com/xamarin/xamarin-forms-shell-quick-tip-modal-navigation/

Sonic1015
  • 55
  • 1
  • 16