locked
Xamarin Forms on ios CollectionView inside CarouselView doestnt work on ios RRS feed

  • Question

  • User392050 posted

    Hi guys, I have following code:

      <CarouselView
                        x:Name="CalendarMonth"
                        Grid.Column="1"
                        BackgroundColor="Red"
                        HeightRequest="248"
                        IsScrollAnimated="False"
                        IsSwipeEnabled="True"
                        ItemsSource="{Binding CalendarMonths}"
                        Loop="False"
                        PeekAreaInsets="0"
                        VerticalOptions="Start">
                        <CarouselView.ItemsLayout>
                            <LinearItemsLayout
                                Orientation="Horizontal"
                                SnapPointsAlignment="Center"
                                SnapPointsType="MandatorySingle" />
                        </CarouselView.ItemsLayout>
                        <CarouselView.ItemTemplate>
                            <DataTemplate>
                                <Grid
                                    Margin="0"
                                    Padding="0"
                                    BackgroundColor="Yellow"
                                    RowSpacing="0">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <StackLayout
                                        Grid.Row="0"
                                        Margin="0"
                                        Padding="0"
                                        BackgroundColor="Green"
                                        HeightRequest="20"
                                        HorizontalOptions="FillAndExpand"
                                        Orientation="Horizontal"
                                        Spacing="0">
                                        <Label
                                            Margin="0"
                                            Padding="0"
                                            FontSize="12"
                                            HorizontalOptions="CenterAndExpand"
                                            Text="{i18n:Translate Common_Monday_Short}"
                                            TextColor="White" />
                                        <Label
                                            Margin="0"
                                            Padding="0"
                                            FontSize="12"
                                            HorizontalOptions="CenterAndExpand"
                                            Text="{i18n:Translate Common_Tuesday_Short}"
                                            TextColor="White" />
                                        <Label
                                            Margin="0"
                                            Padding="0"
                                            FontSize="12"
                                            HorizontalOptions="CenterAndExpand"
                                            Text="{i18n:Translate Common_Wednesday_Short}"
                                            TextColor="White" />
                                        <Label
                                            Margin="0"
                                            Padding="0"
                                            FontSize="12"
                                            HorizontalOptions="CenterAndExpand"
                                            Text="{i18n:Translate Common_Thursday_Short}"
                                            TextColor="White" />
                                        <Label
                                            Margin="0"
                                            Padding="0"
                                            FontSize="12"
                                            HorizontalOptions="CenterAndExpand"
                                            Text="{i18n:Translate Common_Friday_Short}"
                                            TextColor="White" />
                                        <Label
                                            Margin="0"
                                            Padding="0"
                                            FontSize="12"
                                            HorizontalOptions="CenterAndExpand"
                                            Text="{i18n:Translate Common_Saturday_Short}"
                                            TextColor="White" />
                                        <Label
                                            Margin="0"
                                            Padding="0"
                                            FontSize="12"
                                            HorizontalOptions="CenterAndExpand"
                                            Text="{i18n:Translate Common_Sunday_Short}"
                                            TextColor="White" />
                                    </StackLayout>
                                    <CollectionView Grid.Row="1" ItemsSource="{Binding MonthDaysWithPlaceholders}">
                                        <CollectionView.ItemsLayout>
                                            <GridItemsLayout Orientation="Vertical" Span="7" />
                                        </CollectionView.ItemsLayout>
                                        <CollectionView.ItemTemplate>
                                            <DataTemplate>
                                                <StackLayout
                                                    Margin="0"
                                                    Padding="0"
                                                    HorizontalOptions="Start"
                                                    IsVisible="{Binding IsMonthPlaceholder, Converter={StaticResource inverseBool}}"
                                                    Opacity="{Binding Opacity}">
                                                    <Frame
                                                        Margin="10,2"
                                                        Padding="0"
                                                        BackgroundColor="{Binding FrameColor}"
                                                        BorderColor="{Binding BorderColor}"
                                                        CornerRadius="10"
                                                        HasShadow="False"
                                                        HeightRequest="{Binding Height}"
                                                        VerticalOptions="Center">
                                                        <StackLayout
                                                            Margin="0"
                                                            Padding="0"
                                                            HorizontalOptions="Center"
                                                            Spacing="2"
                                                            VerticalOptions="Center">
                                                            <Label
                                                                Margin="0"
                                                                Padding="0"
                                                                FontFamily="{StaticResource RoboMediumFont}"
                                                                FontSize="14"
                                                                HorizontalTextAlignment="Center"
                                                                Text="{Binding Day}"
                                                                TextColor="White" />
                                                            <StackLayout
                                                                HorizontalOptions="Center"
                                                                Orientation="Horizontal"
                                                                Spacing="2">
                                                                <Frame
                                                                    Margin="0"
                                                                    Padding="0"
                                                                    BackgroundColor="#FF4343"
                                                                    CornerRadius="3"
                                                                    HasShadow="False"
                                                                    HeightRequest="6"
                                                                    HorizontalOptions="Center"
                                                                    IsVisible="{Binding ContainsRejected}"
                                                                    WidthRequest="6" />
                                                                <Frame
                                                                    Margin="0"
                                                                    Padding="0"
                                                                    BackgroundColor="#FFB143"
                                                                    CornerRadius="3"
                                                                    HasShadow="False"
                                                                    HeightRequest="6"
                                                                    HorizontalOptions="Center"
                                                                    IsVisible="{Binding ContainsTo_Approved}"
                                                                    WidthRequest="6" />
                                                                <Frame
                                                                    Margin="0"
                                                                    Padding="0"
                                                                    BackgroundColor="#1CCC04"
                                                                    CornerRadius="3"
                                                                    HasShadow="False"
                                                                    HeightRequest="6"
                                                                    HorizontalOptions="Center"
                                                                    IsVisible="{Binding ContainsApproved}"
                                                                    WidthRequest="6" />
                                                            </StackLayout>
                                                        </StackLayout>
                                                    </Frame>
                                                    <StackLayout.GestureRecognizers>
                                                        <TapGestureRecognizer
                                                            Command="{Binding BindingContext.GetMeetingFromDayCommand, Source={x:Reference Name=calendarPage}}"
                                                            CommandParameter="{Binding EntireDate}"
                                                            Tapped="OnItemClicked" />
                                                    </StackLayout.GestureRecognizers>
                                                </StackLayout>
                                            </DataTemplate>
                                        </CollectionView.ItemTemplate>
                                    </CollectionView>
                                </Grid>
                            </DataTemplate>
                        </CarouselView.ItemTemplate>
                    </CarouselView>
    

    and as a result on android I get properly sorted from green to yellow from start, and on ios I get everything in the center? How to solve this ?

    Thursday, January 28, 2021 1:12 PM

All replies

  • User377758 posted

    Uploading a simple demo will help us to help you find the problem.

    Friday, January 29, 2021 9:40 AM