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

Disapearing controls in CollectionView on scrolling (on Android) #17508

Closed
damiand2 opened this issue Sep 20, 2023 · 4 comments
Closed

Disapearing controls in CollectionView on scrolling (on Android) #17508

damiand2 opened this issue Sep 20, 2023 · 4 comments
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working

Comments

@damiand2
Copy link

Description

This is migration of project from Xamarin.Forms where following code works. Problem is only on Android (on iOS it works fine). When scrolling CollectonView and loading more data some controls for newly loaded data are not shown and upon scrolling back you discover that they also disapear for previously loaded data.
Initial data (notice 2 last rows for each card view - activity and images):
image
After scrolling and loading more data, 2 last rows are empty, even for previously loaded rows (some random rows do show loaded data still):
image

Steps to Reproduce

  1. clone repo https://github.com/damiand2/MauiBugDisapearingControls
  2. spin up VS, start debugging
  3. on main page, scroll down collection view untill it loads more data (untill you stop seeing data in 2 last rows for each card view)
  4. scroll back up to see initial cards - notice that they also no longer display data for 2 last rows

Link to public reproduction project repository

https://github.com/damiand2/MauiBugDisapearingControls

Version with bug

7.0.92

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

Workaround that seems to be working is to remove BindableLayout.ItemTemplate for stacklayouts inside scrollview inside collectionview and manually construct control tree for each item inside CollectionView.ChildAdded event

Relevant log output

No response

@damiand2 damiand2 added the t/bug Something isn't working label Sep 20, 2023
@Eilon Eilon added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Sep 20, 2023
@PureWeen PureWeen added the migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert label Sep 20, 2023
@XamlTest
Copy link

Verified this on Visual Studio Enterprise 17.8.0 Preview 2.0. This issue repro on Android 13.0-API33 .NET 7, but not repro on Android 13.0-API33**(8.0.0-rc.1.9171)**, iOS 16.4 with below Project:
MauiBugDisapearingControls.zip

Loading

@XamlTest XamlTest added s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version labels Sep 25, 2023
@ghost
Copy link

ghost commented Sep 25, 2023

Hi @damiand2. 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.

@nsood9
Copy link

nsood9 commented Sep 27, 2023

I'm also facing similar issue. I've implemented a CollectionView with nested list binding. When I set the BindingContext of a Stacklayout inside the CollectionView DataTemplate with TwoWay binding mode, then the CollectView loads the data only for the first time and then all the data disappears when CollectionView is scrolled or page is changed. I'm doing something like this:

<CollectionView.ItemTemplate> <DataTemplate > <StackLayout Margin="0" BindingContext="{Binding MobileLeg, Mode=TwoWay}" > <Label Text="{Binding ETA} /> . . . . . . </StackLayout> </DataTemplate > </CollectionView.ItemTemplate>

If I don't use Mode=TwoWay, then the data binding doesn't work at all. The binding works only when two way binding is set. However, as soon as CollectionView is scrolled or interacted with, all the data disappears and only UI elements with no data is visible on iOS. Everything is working fine on Android, but on iOS I'm not able to bind the data with CollectionView.

Right now I'm testing only with 4 records for the CollectionView and it's still not loading the data, but in real time data the records will be much more. I couldn't find any workaround yet.

@ghost ghost closed this as completed Oct 4, 2023
@nsood9
Copy link

nsood9 commented Oct 5, 2023

This issue is not yet resolved, so it cannot be closed. We haven't found the solution yet.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 4, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants