Skip to content

[CV2][CollectionView] Changing CollectionView's ItemsSource in runtime removes elements' parent seemingly random #29491

@Vetle444

Description

@Vetle444

Description

The elements in a CollectionView that uses CollectionViewHandler2 will get its parent removed if the ItemsSource changes. Thus, Source bindings is not usable anymore.

Image

Steps to Reproduce

  1. Clone https://github.com/Vetle444/MauiTestApp/tree/collectionView2ParentBug/MauiTestApp
  2. Make sure you are on branch: collectionView2ParentBug
  3. Run app
  4. Click Bug button
  5. Click the Reverse button, observe that the Parent of some elements will get nullified.

Link to public reproduction project repository

https://github.com/Vetle444/MauiTestApp/tree/collectionView2ParentBug/MauiTestApp

Version with bug

9.0.70 SR7

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

protected override void OnParentChanged()
{
    base.OnParentChanged();

    if (Parent is not null)
    {
        m_parent = Parent;
    }
    
    Parent = m_parent;
}

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-collectionviewCollectionView, CarouselView, IndicatorViewcollectionview-cv2i/regressionThis issue described a confirmed regression on a currently supported versionpartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/iosregressed-in-9.0.0s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions