Carousel is not working on windows platform ?

Sami 966 Reputation points
2024-07-02T00:34:46.56+00:00

I have created carousel is working well on android platform. But it is not working on windows platform.

How to fix it or another solution for windows platform.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,502 questions
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 31,561 Reputation points Microsoft Vendor
    2024-07-05T06:45:18.8533333+00:00

    Hello, I tested a CarouselView in a new page, and set Orientation to Vertical, it works as excepted on Windows platform.

    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 x:Class="CarouselSample.NewPage1"
                 Title="NewPage1">
    <CarouselView  ItemsSource="{Binding Monkeys}">
    <CarouselView.ItemsLayout>
    <LinearItemsLayout Orientation="Vertical"></LinearItemsLayout>
    </CarouselView.ItemsLayout>
    <CarouselView.ItemTemplate>
    <DataTemplate>
    <StackLayout>
    <Frame HasShadow="True"
                           BorderColor="DarkGray"
                           CornerRadius="5"
                           Margin="20"
                           HeightRequest="300"
                           HorizontalOptions="Center"
                           VerticalOptions="CenterAndExpand">
    <StackLayout>
    <Label Text="{Binding Name}"
                                   FontAttributes="Bold"
                                   FontSize="18"
                                   HorizontalOptions="Center"
                                   VerticalOptions="Center" />
    <Image BackgroundColor="Yellow"
                                   Aspect="AspectFill"
                                   HeightRequest="150"
                                   WidthRequest="150"
                                   HorizontalOptions="Center" />
    <Label Text="{Binding Location}"
                                   HorizontalOptions="Center" />
    <Label Text="{Binding Details}"
                                   FontAttributes="Italic"
                                   HorizontalOptions="Center"
                                   MaxLines="5"
                                   LineBreakMode="TailTruncation" />
    </StackLayout>
    </Frame>
    </StackLayout>
    </DataTemplate>
    </CarouselView.ItemTemplate>
     
            </CarouselView>
     
    </ContentPage>
    

    Best Regards, Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.