Horizontal List View Snap Behavior

Is there a way to configure the Syncfusion ListView to Snap to Start, Center, or End of an item?
Thanks in advanced.

5 Replies

RS Rawoof Sharief Muthuja Sherif Syncfusion Team May 29, 2018 12:43 PM UTC

Hi Randal, 
 
We have checked the reported query “Horizontal list view snap behavior” from our end. We have not clearly understand your requirement. If you requirement is ScrollToPosition support in SfListView means we have already implemented this feature and it will be included in our 2018 Vol2 main release. If it is not your requirement then please share the details regarding the issue like screenshot or video which would highly help us to analyze the query better. 
 
Regards, 
Rawoof M. 



RV Randal Vance Cunanan June 1, 2018 01:49 AM UTC

Hi,

The "snapping" behavior is when a list view item automatically "snaps" into the start or edge of the screen. If I scroll the list view without snap, an item will not be automatically moved to the left edge of the screen when I stop scrolling. An example implementation is in the Google Play app. The horizontal list view showing the apps has snapping behavior and whenever you stop scrolling, it snaps the first item to the left edge of the screen.

Does SfListView's ScrollToPosition behave like I describe above? It sounds like it just allows you to scroll to a certain item, and not do a snap.


RS Rawoof Sharief Muthuja Sherif Syncfusion Team June 1, 2018 11:48 AM UTC

Hi Randal, 
 
We have prepared the sample based on the information given by you. We would like to let you know that currently we have provided workaround for Snap to start. Snap to end can be achieved by using ScrollToPosition support which will be included in our 2018 Vol 2 main release. You can achieve your requirement by using the ScrollStateChanged event of SfListView like below code snippet 
 
CodeExample[C#]: 
public partial class GroupingPage : ContentPage 
    { 
        VisualContainer container; 
        public GroupingPage() 
        { 
            InitializeComponent(); 
            container = listView.GetVisualContainer(); 
            listView.ScrollStateChanged += ListView_ScrollStateChanged; 
        } 
 
        private void ListView_ScrollStateChanged(object sender, ScrollStateChangedEventArgs e) 
        { 
            if (e.ScrollState == ScrollState.Idle) 
            { 
                var lines = container.ScrollRows.GetVisibleLines(); 
 
                if (lines[0].IsClipped) 
                { 
                    if (lines[0].ScrollOffset < (listView.ItemSize / 2)) 
                    { 
                        listView.LayoutManager.ScrollToRowIndex(lines[0].LineIndex, true); 
                    } 
                    else 
                        listView.LayoutManager.ScrollToRowIndex(lines[1].LineIndex, true); 
                } 
            } 
        } 
    } 
 
 
For your reference we have attached the sample and you can download it from the below link. 
 
 
Could you please share the details regarding Snap to center which would help us to analyze the query better. 

Please let us know if you require further assistance. 
 
Regards, 
Rawoof M. 



BA Baba February 24, 2019 12:11 AM UTC

I believe this the behavior  Randal is requesting is the SnapTo feature that is upcoming in XF 4.0 collection view - see the relevant section in this article 
https://blog.xamarin.com/xamarin-forms-4-0-feature-preview-an-entirely-new-point-of-collectionview/
Would love to see this added to SF list view.


JN Jayaleshwari N Syncfusion Team February 25, 2019 11:53 AM UTC

Hi DJ,  
  
We have checked your query from our side. We would like to let you know that we need to analyze the behavior of SnapPoint with Xamarin Forms 4.0 once rolled out and also need to check the possibility to expose it as a property in our source. We will appreciate your patience until next release of Xamarin Forms 4.0.  
  
Regards,  
Jayaleshwari N 


Loader.
Up arrow icon