Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid height "*" not working inside of nested collection views in iOS #22356

Open
Baraiboapex opened this issue May 12, 2024 · 2 comments
Open
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter layout-grid platform/iOS 🍎 t/bug Something isn't working

Comments

@Baraiboapex
Copy link

Baraiboapex commented May 12, 2024

Description

I have a list item in .net MAUI for IOS that is not working as expected. It appears that the issues lie in the fact that the grid visual elements within each individual item in the collection view are not expanding to the full height of the list item's content when their grid rows are set to have a grid row height of "*"

Steps to Reproduce

1.) Add a grid inside of a nested collection view as showin in the code below:

<Grid RowDefinitions="10000" BackgroundColor="BlanchedAlmond">
....
    <VerticalStackLayout Grid.Row="0" Grid.Column="0" BackgroundColor="Aquamarine">
        <VerticalStackLayout IsVisible="{Binding ShowBusyOverlay, Converter={StaticResource not}}" HeightRequest="10000">
<CollectionView x:Name="sessionSummaryList" ItemsSource="{Binding DataSections}" HeightRequest="10000">
    <CollectionView.ItemTemplate>
        <DataTemplate x:DataType="datacollection:DataSection">
            <Grid>
                <!--Here is where the issue lies with the grid star "*" height in the collection view list item-->
                <Grid.RowDefinitions>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="10"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <HorizontalStackLayout Margin="10, 5" Grid.Row="0" Grid.Column="0">
                    <HorizontalStackLayout.GestureRecognizers>
                        <TapGestureRecognizer Command="{Binding BindingContext.SectionTapped, Source={x:Reference Form} }" CommandParameter="{Binding .}" />
                    </HorizontalStackLayout.GestureRecognizers>
                    <Label Text="{Binding Title}" Style="{StaticResource label}" MinimumHeightRequest="40" VerticalTextAlignment="Center" TextColor="{StaticResource normalText}" FontAttributes="Bold" />
                    <Image  Source="{Binding Expanded, Converter={StaticResource expandedImageConverter}}" HorizontalOptions="End" HeightRequest="20" WidthRequest="20" Aspect="AspectFit" />
                </HorizontalStackLayout>
                <BoxView Grid.Row="1" Grid.Column="0" Color="#b9b9b9"/>
                <!--This is where the expansion boolean is that I mentioned earlier "{Binding Expanded}"-->
                <CollectionView Grid.Row="2" Grid.Column="0" IsVisible="{Binding Expanded}" ItemsSource="{Binding SectionItems}" ItemTemplate="{StaticResource SectionSelector}" EmptyView="No items to display" BackgroundColor="White"/>
            </Grid>
        </DataTemplate>
    </CollectionView.ItemTemplate>
</CollectionView>
....
</VerticalStackLayout>
....
</VerticalStackLayout>
....
</Grid>
.......
</ContentPage>

2.) Add an event handler on the MVVM view model that causes the nested collection view inside aforementioned grid to be visible after setting this grid row to a height of "*":

//......
private void OnSectionTapped(SessionSummarySection sessionSummarySection)
{
    sessionSummarySection.Expanded = !sessionSummarySection.Expanded;

}

3.) Click the parent collection view item. The expected results are that the parent collection view automatically adjusts its height to the content in the child collection view, like it does in android, however, the following issue occurs as shown on the image below:

fix

NOTE: Let me know as soon as possible if a repo is needed for the reproduction of this issue. I will get one up as soon as I can.
Thanks.

Link to public reproduction project repository

No response

Version with bug

9.0.0-preview.3.10457

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 17.2

Did you find any workaround?

No

Relevant log output

No response

@Baraiboapex Baraiboapex added the t/bug Something isn't working label May 12, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@jsuarezruiz jsuarezruiz added area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/iOS 🍎 layout-grid labels May 13, 2024
@Baraiboapex
Copy link
Author

Baraiboapex commented May 13, 2024

Hi Javier, Just to keep you informed.

I do apologize for my misunderstanding into the grid "*" RowHeight property. This does not mean fill and expand the remaining area in the grid and adjust its height to the content, it just simply means fill and expand the area of what is left in the grid. But still even with this property filled out this way, it does work on android because, correct me if I'm wrong, the CollectionView is suppose to expand to the height of its overall content, correct? Thanks for noticing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter layout-grid platform/iOS 🍎 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants