Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] CollectionView + Expander: Expanding one item makes every other X item expand too #10993

Closed
ericlira opened this issue Jun 9, 2020 · 7 comments

Comments

@ericlira
Copy link

ericlira commented Jun 9, 2020

Description

Expanding a item inside a CollectionView makes every X number of item to expand too.

Doing some tests I could identify the problem is not Expander itself but CollectionView because I tested using the same layout with Syncfusion expander and the same problem happens, however replacing the CollectionView by a ListView with default caching strategy works fine, but changing ListView caching strategy to RecycleElement or RecycleElementAndDataTemplate causes the same issue as the CollectionView.

PS.: Test done only on Android. I haven't tried the same code on iOS.

Steps to Reproduce

  1. Download attached code
  2. Run on a Android device or simulator
  3. Expand any item then scroll down until you see other item expanded. Keep scrolling and you will see other item expanded after the same number of items.

Expected Behavior

Only tapped item to be expanded

Actual Behavior

Every X number of items expanded

Basic Information

  • Version with issue: 4.6 and above
  • Last known good version: none
  • IDE: VS Community 2019
  • Platform Target Frameworks:
    • Android: 10.0
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Screenshots

collectionview+expander

Reproduction Link

Test.zip

@ericlira ericlira added s/unverified New report that has yet to be verified t/bug 🐛 labels Jun 9, 2020
@pauldipietro pauldipietro added this to New in Triage Jun 9, 2020
@hartez
Copy link
Contributor

hartez commented Jun 12, 2020

This is a duplicate of #9200.

@hartez hartez added a/collectionview e/5 🕔 5 and removed s/unverified New report that has yet to be verified labels Jun 12, 2020
@hartez hartez self-assigned this Jun 12, 2020
@hartez hartez added this to Backlog in CollectionView via automation Jun 12, 2020
@hartez hartez removed this from New in Triage Jun 12, 2020
@hartez
Copy link
Contributor

hartez commented Jun 14, 2020

@ericlira

You need to maintain the IsExpanded property's state somewhere in your bound data. For example, you could update your CollectionItem class to:

public class CollectionItem
{
	public string Name { get; set; }
	public string Description { get; set; }
	public bool Expanded { get; set; }
}

and in your DataTemplate, bind the IsExpanded property to the value of Expanded:

	<Expander Padding="10" IsExpanded="{Binding Expanded}">

For a more detailed explanation, see #9200 (comment)

@hartez hartez closed this as completed Jun 14, 2020
CollectionView automation moved this from Backlog to Done Jun 14, 2020
@ericlira
Copy link
Author

@hartez Thanks for the explanation. Reading #9200 it all makes sense!

@amiraelsayedbadwy
Copy link

amiraelsayedbadwy commented Jul 4, 2020

ios still has this issue when press on expander a space between items in collection view appear
expander
@hartez

@jonkas2211
Copy link
Contributor

Hallo @hartez,
do you have any suggestion on how do update the expanded state?
Maybe in the view, when the item leaves the screen?

@hartez
Copy link
Contributor

hartez commented Aug 24, 2020

ios still has this issue when press on expander a space between items in collection view appear
expander
@hartez

@amiraelsayedbadwy If you're still experiencing this problem please open a new issue and we will take a look. Thanks!

@SmatchyLaPaglia
Copy link

Having this problem too, can't use expander if there's no way around it. Am storing expanded state in the bound item as suggested, doesn't work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants