This is a migrated thread and some comments may be shown as answers.

Xamarin Forms RadListView doesn't maintain list position

3 Answers 109 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Brenden
Top achievements
Rank 1
Veteran
Brenden asked on 02 Jul 2020, 05:20 PM

we supported Android, iOS, and UWP with Xamarin forms, on the UWP platform we are using a RadListView to display a long list of items.  When a user presses on that item it pushes a new Detail page using MasterDetailContentNavigationPage, which all works fine

When exiting the detail page back down the stack to the page with the RadListView it does not maintain the position within the list. It seems like it reloads all the songs within the list and attempts to scroll to the previous position but doesn't hit the correct point

When using a normal ListView from xamarin forms this behavior does not exist

 

Wondering what might be going on or if i need a renderer or something

 

Thanks for any advice

Brenden

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 03 Jul 2020, 12:07 PM

Hello Brenden,

Yes, RadListView reloads the native ListView control when the user returns back to the page, that's why the scroll position is not preserved. 

I've tested the scenario with the Xamarin.Forms ListView and actually it does not maintain the scroll position as well - it has an additional feature to scroll the SelectedItem into  view when the page with the ListView is reloaded.  If just scroll the ListView without selecting an item, navigate to a different page and return back - the scroll would be reset.

The same behavior can be achieved with RadListView through the ScrollItemIntoView method which can be called inside OnAppearing event in case there is selection:

protected override void OnAppearing()
{
	base.OnAppearing();

	if(this.ItemsListView.SelectedItem != null)
	{
		this.ItemsListView.ScrollItemIntoView(this.ItemsListView.SelectedItem);
	}
}

Please give this approach a try and let me know whether it suits the scenario you have.

I look forward to your reply.

Regards,
Yana
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Brenden
Top achievements
Rank 1
Veteran
answered on 06 Jul 2020, 12:16 PM
i also tested with a Xamarin forms List view and it does maintain the position. This solution also wont work for us, but we found another solution in making the page a popup instead of a modal, thus the underneath page didnt reload
0
Yana
Telerik team
answered on 06 Jul 2020, 02:11 PM

Hi Brenden,

I am glad to hear you found an acceptable solution.

If you have any additional questions or concerns, do not hesitate to write to us again.

Regards,
Yana
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
ListView
Asked by
Brenden
Top achievements
Rank 1
Veteran
Answers by
Yana
Telerik team
Brenden
Top achievements
Rank 1
Veteran
Share this question
or