maui – Expander with CollectionView doesn’t work correctly with iOS


In my .Web MAUI app with CommunityToolkit.mvvm and CommunityToolkit.maui, I’ve an expander with a CollectionView in it:

                <toolkit:Expander Margin="0,25">
                    <toolkit:Expander.Header>
                        <StackLayout Orientation="Horizontal">
                            <Label Textual content="{Binding LabelSelectTimeText}" FontFamily = "FontAwesome" Margin="0,0,25,0" VerticalTextAlignment="Heart" />
                            <Label Textual content="{Binding SelectedTimeDisplay, Mode=TwoWay, StringFormat="{0:hh:mm tt}"}" FontSize="Medium" VerticalTextAlignment="Heart" />
                        </StackLayout>
                    </toolkit:Expander.Header>
                    <CollectionView 
                        SelectionChanged="CollectionView_SelectionChanged"
                        Margin="5,5,5,15"
                        ItemSizingStrategy="MeasureAllItems"
                        ItemsSource="{Binding Instances}"
                        SelectedItem="{Binding SelectedTime, Mode=TwoWay}"
                        SelectionMode="Single">
                        <CollectionView.ItemsLayout>
                            <GridItemsLayout Orientation="Vertical" Span="3" />
                        </CollectionView.ItemsLayout>
                        <CollectionView.ItemTemplate>
                            <DataTemplate>
                                <ContentView Padding="5" IsEnabled="{Binding IsAvailable}" >
                                    <Border
                                        StrokeThickness="1"
                                        StrokeShape="RoundRectangle 10">
                                        <Label 
                                            Textual content="{Binding Time, StringFormat="{0:hh:mm tt}"}"
                                            Padding="10"
                                            FontAttributes="Daring"
                                            HorizontalTextAlignment="Heart"
                                            BackgroundColor="{Binding IsAvailable, Converter={StaticResource BooleanToTimeColorConverter}}"
                                            TextColor="Black" />
                                    </Border>
                                </ContentView>
                            </DataTemplate>
                        </CollectionView.ItemTemplate>
                    </CollectionView>
                </toolkit:Expander>

On Android it really works as anticipated, however on iOS the contents exhibits up when expanded first time, and after that no extra. When the expander is collapsed, after which expanded subsequent time, it’s empty. How can this be mounted?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles