-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Windows] - CarouselView reverts to displaying 1st item in collection when collection modified #25991
Comments
We've found some similar issues:
If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.
|
Here is a page demonstrating the issue - instructions are included on the page:
|
Just as an aside, if you omit setting the Loop property to false, clicking the "Scroll to Person 2" button causes the CarouselView to continuously scroll.... another issue...?! Thankfully I don't want it to loop in my use case. |
@Mark-NC001 can you upload a project to github that we can reproduce this with? |
I have added a new repository, found here: https://github.com/Mark-NC001/CarouselViewIssue I have never used GitHub repositories before, I am crossing fingers I've done it correctly! |
Description
I have a CarouselView which uses an ObservableCollection<> as it's ItemSource. The CarouselView appears to behave correctly when scrolling through the collection - but if an item gets added to the collection, the CarouselView reverts to showing the first item in the ItemSource collection.
I would have expected the CarouselView to stay on the item that was displayed (unless of course if it gets removed from the underlying collection in ItemSource, in which case I guess showing the first item is valid?).
Android appears to function correctly.
Steps to Reproduce
Create a data type to store. As an example I'm using a Person class:
And a TestPage:
And the code behind:
When showing the page, initially Person 1 is shown, click Next which will move to Person 2. Then click Add - this adds a person called "Another Person". I would have expected Person 2 to still be displayed, but instead Person 1 gets shown.
Link to public reproduction project repository
https://github.com/Mark-NC001/CarouselViewIssue
Version with bug
8.0.93 SR9.3
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows 10.0.19041.0
Did you find any workaround?
No response
Relevant log output
The text was updated successfully, but these errors were encountered: