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

[iOS] BindableLayout or a CollectionView in a CollectionView display bug #18557

Open
jeffgoku opened this issue Nov 7, 2023 · 10 comments
Open
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter delighter-sc platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@jeffgoku
Copy link

jeffgoku commented Nov 7, 2023

Description

After modified(add or remove) items in the inner ItemsSource the inner Layout WONT update the bounds or just display for first item.

When the outter CollectionView is long enough to be scrolled, the inner CollectionView will be updated incorrectly, all the inner CollectionView will only display the first item

Only for iOS, android is ok

Steps to Reproduce

// outter CollectionView
<CollectionView ItemsSource="{Binding Items}">
    <CollectionView.ItemTemplate>
        <DataTemplate>
             <local:InnerView BindingContext="{Binding}" />
        </DataTempalte>
   </CollectionView.ItemTemplate>
</CollectionView>

// InnerView
<Border>
   // no matter this is BindableLayout or CollectionView, the same result
    <VerticalStackLayout BindableLayout.ItemsSource="{Binding Items}">
      <BindableLayout.ItemTemplate>
         <DataTemplate>
             <SwipeView>
                    <Grid ColumnDefinitions="*" Padding="6, 2">
                        <VerticalStackLayout Spacing="1">
                            <Label Text="{Binding Title}"/>
                            <Label FontSize="10" Padding="2,0,0,0" TextColor="Gray" Text="{Binding Time}"/>
                        </VerticalStackLayout>
                    </Grid>
             </SwipeView>
         </DataTemplate>
      </BindableLayout.ItemTemplate>
    </VerticalStackLayout>
</Border>
  1. Use above UI
  2. Add enough items to InnerView and OutterView for the outter view to be able to scroll
  3. Scroll the OutterView

Expected Result: every item is displayed
Actual Result: only the first item of the inner view will be displayed

Link to public reproduction project repository

CollectionView bug

Version with bug

7.0.100

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 17 simulator

Did you find any workaround?

No response

Relevant log output

No response

@jeffgoku jeffgoku added the t/bug Something isn't working label Nov 7, 2023
@drasticactions
Copy link
Contributor

Can you create a sample repro showing this? Having the actual code implemented into a deployable project would make this easier to debug and for everyone to verify.

@drasticactions drasticactions added the s/needs-repro Attach a solution or code which reproduces the issue label Nov 7, 2023
@ghost
Copy link

ghost commented Nov 7, 2023

Hi @jeffgoku. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@jeffgoku
Copy link
Author

jeffgoku commented Nov 7, 2023

Repro added, CollectionView and scroll both not working as expected.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Nov 7, 2023
@jsuarezruiz jsuarezruiz added platform/iOS 🍎 area-controls-collectionview CollectionView, CarouselView, IndicatorView labels Nov 7, 2023
@PureWeen PureWeen added the s/try-latest-version Please try to reproduce the potential issue on the latest public version label Nov 7, 2023
@ghost
Copy link

ghost commented Nov 7, 2023

Hi @jeffgoku. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@PureWeen PureWeen removed the s/needs-attention Issue has more information and needs another look label Nov 7, 2023
@jeffgoku
Copy link
Author

jeffgoku commented Nov 8, 2023

I am using VS mac, how can I install the latest version?

@ghost ghost removed the s/try-latest-version Please try to reproduce the potential issue on the latest public version label Nov 8, 2023
@Yokaichan
Copy link

Yokaichan commented Nov 12, 2023

Hello,

I meet the same issue with a build on Azure Pipeline:

  • Installed SDK Version: 8.0.100-rc.2.23502.2
  • microsoft.net.sdk.ios version 17.0.8477-net8-rc2.2
  • Installed Microsoft.Maui.Sdk.net7 version 7.0.101

(Build on .net7)

The CollectionView doesn't work as expected on iOS (but works on Android). The layout is not updated, and there is an issue with the virtualization (some data won't display when scrolling)

@Yokaichan
Copy link

Hi,

Someone knows a workaround about this bug ?
I didn't find a wayt to refresh the layout by my side.

@cat0363
Copy link
Contributor

cat0363 commented Dec 28, 2023

I'm also having a similar problem.
The size of the CollectionView does not change when the number of elements in the BindableLayout inside the CollectionView changes.

@Yokaichan
Copy link

I've finally found a workaround by:

  • Add a property in my viewmodel to the CollectionView
  • Populate this property when the control is loaded (with Loaded callback)
  • In my command that add / remove an item, I "manually" change the ItemSizingStrategy to force an update:

MainThread.BeginInvokeOnMainThread(() =>
{
TransportsCollectionView.ItemSizingStrategy = ItemSizingStrategy.MeasureFirstItem;
TransportsCollectionView.ItemSizingStrategy = ItemSizingStrategy.MeasureAllItems;
});

@kevinxufei
Copy link

Verified this issue with Visual Studio 17.10.0 Preview 3 (8.0.20). Can repro it with sample project

@kevinxufei kevinxufei added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Apr 12, 2024
@jsuarezruiz jsuarezruiz added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Jun 5, 2024
@jsuarezruiz jsuarezruiz added this to the Backlog milestone Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter delighter-sc platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants