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="http://xamarin.com/schemas/2014/forms"
>         >                  xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
>         >                  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

Answers

Sign In or Register to comment.