maui
maui copied to clipboard
CollectionView items layout is not changed when GridItemsLayout.Span is changed on iOS and Windows
Description
CollectionView items layout is not changed when GridItemsLayout.Span is changed on iOS and Windows - columns number remains the same. Works fine on Android.
Additional problem: trying to change the span without Dispatcher causes crash on iOS (!)
Reproduced on: Visual Studio 17.3.4 Windows 11 desktop iPhone device with iOS 15.6.1
Attached: MauiApp1 source code that demonstrates the bug MauiApp1.zip
Steps to Reproduce
Bug 1
- Open MauiApp1 application
- Click the button to change layout span
- Items layout is not changed on iOS and Windows
Bug 2
- Go to OnButtonClicked implementation, eliminate dispatching and try to change span directly.
- Recompile
- Open MauiApp1 on iOS
- Click the button to change layout span
- Application is crashing
Link to public reproduction project repository
https://github.com/dotnet/maui/files/9574398/MauiApp1.zip
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS, Windows
Affected platform versions
iOS 15.6.1, Windows SDK 10.0.22000.194
Did you find any workaround?
No response
Relevant log output
No response
Please, add label for Windows too
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.
I can confirm this. It works as expected on Android, but not on Windows. My repro:
https://github.com/pekspro/MauiIssues/tree/10144_CollectionView_items_layout_is_not_changed
Span (set in Xaml) was working on .net 6 Windows for me. Broken with .net 7
Span (set in Xaml) was working on .net 6 Windows for me. Broken with .net 7
Span CHANGING is not working. With .net 6 too.
Span (set in Xaml) was working on .net 6 Windows for me. Broken with .net 7
I played around with CenterAndExpand on a few elements and replaced some FillAndExpand's and one of those changes actually made Span 2 work. But I'll need span changes too - as @vg12345 noted: this, and many other layout issues with collectionview are not working. Example: A little off topic, but the width doesn't stay fully expanded with window resizes. This also used to work in .net 6. Might be able to get a workaround now that .net7 can do this:
protected override Window CreateWindow(IActivationState activationState)
{
Window window = base.CreateWindow(activationState);
#if NET7_0_OR_GREATER
window.MinimumWidth = 500;
window.MinimumHeight = 500;
window.Width = 800;
window.Height = 1024;
window.SizeChanged += (s, e) =>
{
};
#endif
return window;
}
My project also got affected
#13137 is a fix fo Windows. Is this issue fixed for iOS?