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

[Feature requested] ListView do not ScrollTo a group when there is no child of this group. #8279

Open
jessiezh0320 opened this issue Oct 29, 2019 · 6 comments · Fixed by #8310
Labels
a/listview Problems with the ListView/TableView in-progress This issue has an associated pull request that may resolve it! p/tablet t/enhancement ➕

Comments

@jessiezh0320
Copy link

jessiezh0320 commented Oct 29, 2019

Description

At present, we must special a item object as the first parameter of method : ScrollTo .
https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.listview.scrollto?view=xamarin-forms

When a group of listview has no child, the function ScrollTo cannot scroll to the corresponding group.

Many customers think it is not reasonable, and it should have this feature.

Expected Behavior

When a group of listview has no child, the function ScrollTo should scroll to the corresponding group.

Actual Behavior

When a group of listview has no child, the function ScrollTo cannot scroll to the corresponding group.

Basic Information

@jessiezh0320 jessiezh0320 added s/unverified New report that has yet to be verified t/bug 🐛 labels Oct 29, 2019
@jsuarezruiz jsuarezruiz added a/listview Problems with the ListView/TableView t/enhancement ➕ labels Oct 29, 2019
@techduggu
Copy link
Contributor

I'd like to pick this up. Currently trying to reproduce it and I also noticed that it doesn't Scroll if list item (first parameter) is passed as null (in-case I'd like to scroll to a group only). For e.g.

List.ScrollTo(null, mygroupitem, ScrollToPosition.MakeVisible, true);

@jsuarezruiz @jfversluis Is it expected behavior or should I fix this too?

Thanks!

@jfversluis
Copy link
Member

Makes sense to me to scroll to the group whenever the item is not found but the group is. I guess the cases for the different parameter values would be:

  • No item, do have a group: go to the group
  • Do have an item, no group: find the first item throughout all the groups and scroll there
  • Have an item and have a group: find the item in the specified group and scroll there. If the item isn't found, scroll to the group
  • No item, no group: doesn't make any sense, do nothing

Right?

@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Nov 2, 2019
@Rajeswari06
Copy link

We are facing the same issue in iPad-iOS 12.4.1. with grouped listView.

We have used a grouped listview, when we try to expand and collapse an item in bottom of the screen scroll position is changing to top and unable to see the selected item.

Listview.scroll is not working in grouped listview if it don't have items.

@jfversluis
Copy link
Member

There is a PR for the Android side of things @Rajeswari06 if you're brave enough you could add the iOS implementation? 😉

@techduggu
Copy link
Contributor

@Rajeswari06 When I fixed for Android, I had seen the existing implementation for iOS too as it also uses the TemplatedItemsList.cs from Core library and it requires little tweaks at the iOS ListViewRenderer.cs at the following LOC:

if (results.Item1 == -1 || (results.Item1 == -1 && results.Item2 == -1))
return;

You can refer the PR #8310 for more details. I couldn't complete the iOS as I don't have mac/iOS but if you'd like to pick this up, I'm happy to help should you have any further questions.

@samhouts samhouts removed s/unverified New report that has yet to be verified t/bug 🐛 labels Feb 27, 2020
rmarinho pushed a commit that referenced this issue Sep 10, 2020
… ixes #8279

* Fixed - 8279 - [Enhancement] ListView ScrollTo with empty groups

* Added UI Tests for 8279

* Update Issue8279.cs

* Fixed build error - finally

* Added reset button to fix UI test

* Added meaningful local variables for better code readability

* Added meaningful names to local variables and removed unused condition

Co-authored-by: Durgesh Khandal <durgesh.khandal@southernphone.net.au>
@samhouts
Copy link
Member

closed by #8310

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/listview Problems with the ListView/TableView in-progress This issue has an associated pull request that may resolve it! p/tablet t/enhancement ➕
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants