maui
maui copied to clipboard
CollectionView doesn't update the item size when content in ItemTemplate is resized
Description
The issue is described at #3643, but marked as fixed. However, it still occurs on iOS. We checked it in .NET MAUI 7.0.59. Would you please clarify if you specified the "fixed-in" version correctly?
Steps to Reproduce
Create a MAUI app
- Put Button and CollectionView into StackLayout on the MainPage.xaml
- Set ItemTemplate for CollectionView, put into ItemTemplate Grid with Label
- In the Button.Clicked event handler change Label.Text
- Deploy to iOS simulator and click the Button
Link to public reproduction project repository
https://github.com/dotnet/maui/files/8130080/3643.zip
Version with bug
7.0.59
Last version that worked well
Affected platforms
iOS
Affected platform versions
iPhone 14 Pro Max
Did you find any workaround?
Call the PlatformSizeChanged method for the element used as the ItemTemplate root
Relevant log output
No response
Are you using 6.0.312?. The issue have been backported to net7 https://github.com/dotnet/maui/pull/12457
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
Hi @Alexgoon. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. 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.
I apologize for the misleading information. The issue occurs in 7.0.59, not in 6.0.312. I've corrected my initial post
I have the same issue. Does anyone know a workaround?
Verified this on Visual Studio Enterprise 17.7.0 Preview 2.0. This issue repro on iOS 16.4, not repro on Windows 11 and 13.0-API33 with below Project: MauiApp14.zip
@rmarinho @hartez you guys know why the supposed fix from #12457 is no longer working?
Verified the issue on .NET 8, VS 2022 Version 17.9.0, iOS 17.3
Just tried using CollectionView since ListView has this problem also... our items have dynamic content, we update the item contents based on user interaction and when data changes. For some scenarios we can do fixed heights, but we'd have to redesign them... but some are such that we can't always do a fixed height design...
Here are a couple for ListView, there are probably more reported. #7967 #8239 #15053
Not to be negative, but it feels like I'm spending more time trying to work around these types of issues than actually building our app.
HI
Any workaround or solution for this.
If you don't mind a hacky workaround, ListView does resize if you call ObservableCollection.Move(...)
from the current index to the same value. Somehow, it triggers the resizing for me.
(Unfortunately, I have already moved to CollectionView, still stuck with this problem.)