Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 79144

XAML based CarouselPage child template how-to

$
0
0

Hello Xaramin Devs. I'm a complete Xamarin/XAML newbie.

Is it possible to use a template XAML file for the children of a CarouselPage? For example, suppose I want to create a slide show. The only difference between the pages in the slide show is the actual image that is displayed.

I cannot figure out how to change the image name for the children from within the CarouselPage XAML. Here's my starting point (which doesn't work):

For the slide show template pages (CarouselPage children):

<?xml version="1.0" encoding="UTF-8"?>

<Image x:Name="SlideImage" />

Code behind file:

namespace HelloWorld
{
public partial class SlidshowPage : ContentPage
{
public Image ImageControl
{
get { return SlideImage; }
set { SlideImage = value; }
}
}
}

For the CarouselPage:

<?xml version="1.0" encoding="UTF-8"?>

<CarouselPage.Children>

    <local:SlideshowPage>
        <local:SlideShowPage.ImageControl Source="image_one.png" />
    </local:SlideshowPage>

    <local:SlideshowPage>
        <local:SlideshowPage.ImageControl Source="image_two.png" />
    </local:SlideshowPage>

</CarouselPage.Children>

Thanks for any help and advice.


Viewing all articles
Browse latest Browse all 79144

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>