Skip to content

Reassigning ItemsLayout in .NET MAUI CollectionView Prevents Dynamic Span Change #24345

Open

Description

Description

When using a CollectionView in a .NET MAUI Windows application, reassigning the ItemsLayout to a new GridItemsLayout prevents the span from being dynamically changed.

Behavior observed from public reproducer app:

  • Initially, clicking the "Increase Span" button successfully increases the span of the grid layout.
  • Reassigning the ItemsLayout to a new GridItemsLayout with the same initial span of 3.
  • After reassignment, clicking the "Increase Span" button no longer changes the span of the grid layout.

Steps to Reproduce

To create a barebone reproducer,

  1. Create MAUI application and Configure a CollectionView with dummy data.
  2. Initialize CollectionView's ItemsLayout to new GridItemsLayout(2, ItemsLayoutOrientation.Vertical).
  3. Now reinitialize same ItemsLayout to new GridItemsLayout(3, ItemsLayoutOrientation.Vertical)
  4. Observe span of the Grid in CollectionView.

Expected Outcome: Column Span changes from 2 to 3
Observed Outcome: Column Span does not changes.

Link to public reproduction project repository

https://github.com/prathameshnarkhede/collectionviewitemslayoutbug.git

Version with bug

9.0.0-preview.7.24407.4

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

Instead of reinitializing ItemsLayout, Added increment to GridItemsLayout.Span Property

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area-controls-collectionviewCollectionView, CarouselView, IndicatorViewplatform/windows 🪟s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions