locked
Integrating moving common background image for carousel page RRS feed

  • Question

  • User399317 posted

    I'm trying to integrate a common wide background image for Xamarin Forms Carousel page. As the requirement I need to smoothly change the visible part of the image according to changes of child pages (Ex. moving the visible part of the theme background image of a mobile phone when moving the menu pages). Is there any way to accomplish this approach.

    Thursday, February 4, 2021 3:12 PM

All replies

  • User2148 posted

    https://www.youtube.com/watch?v=uu2xGUOWoX8 this?

    Thursday, February 4, 2021 3:16 PM
  • User371688 posted

    Do you want to show a background for the child content page,right?

    Then we need to set the child content page's background color to transparent to display the parent carousel page's image:

    <?xml version="1.0" encoding="UTF-8"?> <CarouselPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" BackgroundImageSource="scenery.png" x:Class="CarouselPageNavigation.MainPage"> <ContentPage BackgroundColor="Transparent"> <ContentPage.Padding > <OnPlatform x:TypeArguments="Thickness"> <On Platform="iOS, Android" Value="0,40,0,0" /> </OnPlatform> </ContentPage.Padding> <StackLayout> <Label Text="Red" FontSize="Medium" HorizontalOptions="Center" /> <BoxView Color="Red" WidthRequest="200" HeightRequest="200" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" /> </StackLayout> </ContentPage> <ContentPage BackgroundColor="Transparent"> <ContentPage.Padding> <OnPlatform x:TypeArguments="Thickness"> <On Platform="iOS, Android" Value="0,40,0,0" /> </OnPlatform> </ContentPage.Padding> <StackLayout> <Label Text="Green" FontSize="Medium" HorizontalOptions="Center" /> <BoxView Color="Green" WidthRequest="200" HeightRequest="200" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" /> </StackLayout> </ContentPage> <ContentPage BackgroundColor="Transparent"> <ContentPage.Padding> <OnPlatform x:TypeArguments="Thickness"> <On Platform="iOS, Android" Value="0,40,0,0" /> </OnPlatform> </ContentPage.Padding> <StackLayout> <Label Text="Blue" FontSize="Medium" HorizontalOptions="Center" /> <BoxView Color="Blue" WidthRequest="200" HeightRequest="200" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" /> </StackLayout> </ContentPage> </CarouselPage>

    The result is:


    Xamarin forums are migrating to a new home on Microsoft Q&A! We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A! For more information, please refer to this sticky post.

    Friday, February 5, 2021 3:12 AM
  • User371688 posted

    Hi @vijitha , have you resolved your problem? If my reply is useful for you, could you please mark my reply as answered? Thanks in advance.

    Tuesday, March 9, 2021 8:06 AM