Completed
Last Updated: 17 Sep 2024 11:56 by ADMIN
Aaron
Created on: 26 Apr 2023 21:00
Category: ListView
Type: Feature Request
1
ListView: Provide an option to configure the inner ScrollView or Allow setting the Y Position

Hi Team,

Please expose the ScrollViewer, or expose a method on the RadListView that allows the developer to set a Y device-independent vertical position. Setting the Y value will trigger the internal/native scrollview to go to that position without any special animations or manipulation. Just a pure position set.

I need to be able to programmatically scroll to a specific position in the list. Yes, I am aware of the ScrollToItem methods, however that will not work in my case as I explicitly need the Y position (for acceleration and manipulation of the exact position).

As an example, here's how I am currently doing it for a ScrollView:

private async Task AutoScrollAsync()
        {
            while (!(this.ScrollVelocity == 0 || this.ScrollVelocity > 0 && this.IsScrolledToBottom() || this.ScrollVelocity < 0 && this.IsScrolledToTop()))
            {
                await this.scrollView.ScrollToAsync(0, this.CalculateNextScrollY(), false);
                await Task.Delay(ScrollDelay);
            }

            this.StopScrolling();
        }

I am hoping to be able to do the same thing for the RadListView.

Thank you,

Aaron

1 comment
ADMIN
Didi
Posted on: 17 Sep 2024 11:56

Hi Aaron,

We have resolved this behavior by implementing a new control, CollectionView, which is a complete rewrite of the ListView from the ground up. CollectionView offers improved performance, enhanced features, and a modernized approach to managing lists of data. The CollectionView incorporates all key features of the ListView.

As this new control supersedes the ListView, this feature request will be closed. We recommend transitioning to CollectionView to take full advantage of its capabilities. Visit the following article that explains how to migrate to the new RadCollectionView.

Access the inner ScrollView from the CollectionView's Children collection and call the ScrollToAsync method, here is an example:
    <telerik:RadCollectionView ItemsSource="{Binding Locations}" Loaded="RadCollectionView_Loaded"
                           DisplayMemberPath="City">
        <telerik:RadCollectionView.BindingContext>
            <local:ViewModel />
        </telerik:RadCollectionView.BindingContext>
    </telerik:RadCollectionView>
    private void RadCollectionView_Loaded(object sender, EventArgs e)
    {
        foreach (var child in (sender as RadCollectionView).Children)
        {
            if (child is ScrollView)
            {
                ScrollView sv = child as ScrollView;
                sv.ScrollToAsync(20,30,false);
                return;
            }
        }
    }

Regards,
Didi
Progress Telerik