Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] CarouselView is always taking full vertical space of the page #8993

Closed
Mikilll94 opened this issue Dec 20, 2019 · 1 comment
Closed
Labels
s/unverified New report that has yet to be verified t/bug 🐛

Comments

@Mikilll94
Copy link

Description

CarouselView is always taking full vertical space of the page even if it has not set

VerticalOptions = "FillAndExpand"

or something like that

Look at this GIF
carousel_view_full_space

As you can see CarouselView is taking full height of the page. Here is the code for this page:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:viewModels="clr-namespace:CarouselViewTest.ViewModels"
             mc:Ignorable="d"
             x:Class="CarouselViewTest.MainPage">
    <ContentPage.BindingContext>
        <viewModels:MainPageVM/>
    </ContentPage.BindingContext>

    <StackLayout Margin="10">
        <Label Text="Products" FontSize="Large" />
        <CarouselView x:Name="carouselView" ItemsSource="{Binding Products}">
            <CarouselView.ItemTemplate>
                <DataTemplate>
                    <StackLayout VerticalOptions="Center">
                        <Frame HasShadow="True" CornerRadius="5" BorderColor="DarkGray">
                            <StackLayout>
                                <Image Source="{Binding Image}"/>
                                <Label Text="{Binding Title}" FontAttributes="Bold" FontSize="Title"/>
                                <Label Text="{Binding Description}" FontSize="Subtitle"/>
                            </StackLayout>
                        </Frame>
                    </StackLayout>
                </DataTemplate>
            </CarouselView.ItemTemplate>
        </CarouselView>
        <IndicatorView ItemsSourceBy="carouselView" IndicatorColor="LightGray" SelectedIndicatorColor="DarkGray"
                   HorizontalOptions="Center" />
        <Button Text="Submit"/>
    </StackLayout>

</ContentPage>

As you can see CarouselView has no VerticalOptions set so it should have the default value

VerticalOptions = "FillAndExpand"

thus it should take a minimum amount of vertical space but instead, it takes full vertical space of the page.

Right now there is no way to make CarouselView to take only the space what it needs

Steps to Reproduce

  1. Run this project on Android
    CarouselViewTest.zip

  2. As you can see CarouselView is taking full vertical space of the page.

Expected Behavior

CarouselView should take only the minimum vertical space which it needs

Actual Behavior

CarouselView is taking full vertical space of the page even though

VerticalOptions = "FillAndExpand"

is not set

Basic Information

  • Version with issue: 4.4.0.991265
  • Last known good version: 16.4.2
  • IDE:
  • Platform Target Frameworks:
    • Android: Android: 9.0 (Pie)
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:
@Mikilll94 Mikilll94 added s/unverified New report that has yet to be verified t/bug 🐛 labels Dec 20, 2019
@Mikilll94 Mikilll94 changed the title [Bug] CarouselView is always taking full vertical space [Bug] CarouselView is always taking full vertical space of the page Dec 20, 2019
@jfversluis
Copy link
Member

Duplicate of #8640

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

2 participants