Skip to content

CollectionView does not update column when changing ItemsLayout span #23266

Closed as not planned

Description

Description

I have a CollectionView with several items and I want to make a 2 or more columns layout on wide screens and a 1 column layout on tall screens.

I tried setting a GridItemsLayout and changing the Span in sizechanged event and set the same in button click event, but that did not work and then I tried changing the entire ItemsLayout, but still no updates in the app.

Restarting the app works, so this is just the result of changing at runtime.

Steps to Reproduce

Add a CollectionView with items, and then say write this code to toggle the layout on page size changes:

private void OnSizeChanged(object? sender, EventArgs e) =>
collectionView.ItemsLayout = Width > 600
? new GridItemsLayout(2, ItemsLayoutOrientation.Vertical)
: new LinearItemsLayout(ItemsLayoutOrientation.Vertical);

Link to public reproduction project repository

No response

Version with bug

8.0.3 GA

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

All

Did you find any workaround?

No response

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions