Forum General
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

CarouselPage ItemsSource with local ContentPages

PatrickJelittoPatrickJelitto Member ✭✭✭

Hi Guys,

i have this siutation:
I want to have a CarouselPage containing Images.
I have 3 types of images which i all want to be displayed in the same CarouselPage.

I have ImagePage, DamageImagePage and AdditionalImagePage.
DamageImagePage and AdditionalImagePage inherits from ImagePage and extend it a bit more.

Now i have my CarouselPage:

    >     >         <CarouselPage xmlns=""
>         >                  xmlns:x=""
>         >                  x:Class="RabbitMobile.Pages.ImageGalerieCarouselPage"
>         >                  xmlns:local="clr-namespace:RabbitMobile.Pages"
>         >                  ItemsSource="{Binding Images}">
>         >         <CarouselPage.ItemTemplate>
>         >             <DataTemplate>
>         >                 <local:ImagePage></local:ImagePage>
>         >             </DataTemplate>
>         >         </CarouselPage.ItemTemplate>
>         >     </CarouselPage>

The ItemsSource is the following:
new ObservableCollection<ImagePageModel>(ImagesForCarousel.Select(i => new ImagePageModel(i))

The code above leads to the Exception: The given key was not present in the dictionary.

How do i render a existing Page like my correctly?

Is it possible to differentiate between rendering a ImagePage/DamageImagePage or AdditionalImagePage in my xaml ?

Thank you, Gelatto


Sign In or Register to comment.