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

[MacOS, iOS] ListView and CollectionView on the fly changes don't change the size of the layout #7967

Open
NonameMissingNo opened this issue Jun 12, 2022 · 18 comments
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@NonameMissingNo
Copy link

Description

We have an application that requires elements inside the listview / collectionview to open if it's the selected one, and close when it's not.

It works perfectly fine on Windows, and Android, but the Apple ecosystem does not handle it well.

ForceUpdateSize in ListViews doesn't seem to effect things
CollectionView:
CollectionView
ListView:
ListView
.

Expected (Windows):
image

Steps to Reproduce

Create a new app.
Put a ListView in it, with a Button.
Set a Clicked event to the Button.
Change the HeightRequest, or in the case of a Grid, the RowDefinitions with the Clicked event.
Run the app.
Click on an element.
CollectionView: The selected element expands behind the other elements
ListView: The selected element expans in front of the other elements.

Version with bug

6.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

iOS 15, MacOS 14

Did you find any workaround?

No response

Relevant log output

No response

@NonameMissingNo NonameMissingNo added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Jun 12, 2022
@jfversluis jfversluis added platform/macOS 🍏 macOS / Mac Catalyst area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter platform/iOS 🍎 and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Jun 13, 2022
@kristinx0211
Copy link

@NonameMissingNo could you mind share the repro project to help us repro this issue?

@kristinx0211 kristinx0211 added the s/needs-repro Attach a solution or code which reproduces the issue label Jun 14, 2022
@ghost
Copy link

ghost commented Jun 14, 2022

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

@NonameMissingNo
Copy link
Author

Hey there @kristinx0211, sorry for the delay.
Here's the repro file:
MauiApp10 (2).zip

@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 Jun 14, 2022
@kristinx0211 kristinx0211 added the s/verified Verified / Reproducible Issue ready for Engineering Triage label Jun 15, 2022
@kristinx0211
Copy link

verified repro on IOS 15.4 as above describe.

@PureWeen PureWeen removed the s/needs-attention Issue has more information and needs another look label Jun 28, 2022
@PureWeen PureWeen added this to the 6.0-servicing milestone Jun 28, 2022
@Redth Redth modified the milestones: 6.0-servicing, Backlog Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@LennoxP90
Copy link

This item should be declared as pretty high priority, since this is not an issue in Android it clearly is an issue with the native control used in iOS for the collectionview. This makes any chat based application that support rich messaging completely useless in iOS. There must be a better control to use under the hood that supports dynamic resizing. Personally I would sacrifice speed to have the UI do what I want.

@mlancione
Copy link

I agree that this should be a high priority issue. It seems like a basic functionality for a very common control.

@petrakritzinger
Copy link

Agreed, we are also experiencing the same issue and it is causing our app functionality to fail on iOS when trying to expand an item in the ListView. Is there any workaround?

@WebGoose
Copy link

WebGoose commented Nov 8, 2022

I'm having the same issue. Should definitely be a higher priority for a control that's used as much as Listview / collectionview

@NonameMissingNo
Copy link
Author

NonameMissingNo commented Nov 8, 2022

#if IOS || MACCATALYST
if ((levelcollection.Handler.PlatformView as UIView).Subviews[0] is UICollectionView Table) {
if (Table.CollectionViewLayout is UICollectionViewFlowLayout Layout) {
Layout.InvalidateLayout();
}
}
#endif
Where the name of levelcollection is your CollectionView
(Add it to where you're expanding it)

@petrakritzinger
Copy link

NonameMissingNo's workaround unfortunately does not work for me. Also tried the workaround suggested by EPS-Lac in #8820. This works in a very simple scenario, but not on mine where I have a listview within another listview.

@LennoxP90
Copy link

Is there any progress on this Microsoft?

@danielftz
Copy link

Any updates?

@samhouts samhouts removed the s/verified Verified / Reproducible Issue ready for Engineering Triage label Apr 5, 2023
@darrylayers
Copy link

Disappointed this had been pushed back so long ;(

@jinxinjuan jinxinjuan added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage labels Jun 29, 2023
@jinxinjuan
Copy link
Collaborator

jinxinjuan commented Jun 29, 2023

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 2.0. Can repro on iOS platform with above project MauiApp10 (2).zip

@stefanpirkl
Copy link

We've finally found a workaround for this issue!

Instead of ListView/CollectionView, use a (Vertical/Horizontal)StackLayout with BindableLayout attached properties.

If you need scrolling, wrap the StackLayout in an additional ScrollView.

@johbake
Copy link

johbake commented Jan 13, 2024

This issue makes me doubt MAUI as a platform. It's core functionality to have a working ListView and the iOS implementation sucks. The title is slightly wrong, the size does change, the user just has to turn their phone sideways to get it to redraw the layout and then turn it back to the original orientation - then it looks like it's supposed to. It's absolutely ridiculous that this bug has not been fixed for 1.5 years.

@MohammedBen
Copy link

This workaround worked for me as follows:

Whether you choose to use code behind or MVVM, calling the RefreshData() on the collectionview every time you need your item to change or redraw.
Also, it might be more efficient to call RefreshItem method on the CollectionView.

Here's my sample:
private void Expander_ExpandedChanged(object sender, CommunityToolkit.Maui.Core.ExpandedChangedEventArgs e)
{
notesCollectionView.RefreshData();
}

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 platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst 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