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

CarouselView not displaying data

$
0
0

Hey, I already posted this on Stackoverflow, but maybe you guys can help me too :)

I am trying to display a CarouselView inside a TabbedPage. I already added the (prerelease-)packages to the Project. Here is my xaml file:

        <control:CarouselView x:Name="CVMain"
                              HeightRequest="150" >
            <control:CarouselView.ItemTemplate>
                <DataTemplate>
                        <Label HorizontalOptions="Center"
                               Text="Just a test :)"
                               VerticalOptions="Center" />
                </DataTemplate>
            </control:CarouselView.ItemTemplate>
        </control:CarouselView>

(control: xmlns:control="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.CarouselView")

The label doesn't show up when I launch my app. The carousel still exists tho, I can confirm that by adding the BackgroundColor="Green"attribute to the CarouselView.

What am I missing?

Edit: As suggested, I placed the Label inside a Grid, but without any success (I also added an Image):

    <control:CarouselView x:Name="CVMain" HeightRequest="150">
        <control:CarouselView.ItemTemplate>
            <DataTemplate>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Image Grid.RowSpan="2"
                           Aspect="AspectFill"
                           Source="{Binding ImageBase64,
                                            Converter={StaticResource Base64ToImageConverter}}" />
                    <StackLayout Grid.Row="1">
                        <Label Text="Test123" />
                    </StackLayout>
                </Grid>
            </DataTemplate>
        </control:CarouselView.ItemTemplate>
    </control:CarouselView>

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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