AndreiMisiukevich / CardView

CardsView | CarouselView | CoverflowView | CubeView for Xamarin.Forms
MIT License
711 stars 114 forks source link

CarouselView with ContentPage does not show content #415

Closed daltzctr closed 2 years ago

daltzctr commented 2 years ago

Whenever I set CarouselView ItemSource to a list of ContentPage, the CarouselView does not show anything.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="my_app.Views.DeviceViewRootPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:cards="clr-namespace:PanCardView;assembly=PanCardView"
    xmlns:pages="clr-namespace:my_app.Views"
    xmlns:vm="clr-namespace:my_app.ViewModels">

    <ContentPage.BindingContext>
        <vm:DeviceViewRootPageModel />
    </ContentPage.BindingContext>

    <cards:CarouselView x:Name="CarouselPageRoot">
        <cards:CarouselView.ItemsSource>
            <x:Array Type="{x:Type ContentPage}">
                <pages:ContentPage0 />
                <pages:ContentPage1 />
                <pages:ContentPage2  />
                <pages:ContentPage3 />
                <pages:ContentPage4  />
            </x:Array>
        </cards:CarouselView.ItemsSource>
    </cards:CarouselView>

</ContentPage>

image

AndreiMisiukevich commented 2 years ago

Hello, yes, because it's not supposed to work with pages. Can I ask you, why do you use ContentPage instead ContentView?

daltzctr commented 2 years ago

I have a multiple of actual ContentPage items which each have their own binding and drastic different layouts. I wish to use CardView as a successor to CarouselPage because current CarouselView also does not support ContentPage. As far as I'm aware, there is no way to get swipe style navigation on Xamarin without CarouselPage, or Maui at all.

Thanks. Dalton.

AndreiMisiukevich commented 2 years ago

Hm, jsut put content from ContentPage to ContentView

daltzctr commented 2 years ago

I will try that and report back. Thank you.

daltzctr commented 2 years ago

Works