Ramesh
Ramesh

Reputation: 422

Navigation.PopAsync showing the old page for a moment

I am calling Navigation.PopAsync to call the previous page. But, on the OnAppearing method of the previous page, I am refreshing data of listview by setting itemssource. But when calling popasync I am able to see the previous page with old data for a moment. After a moment the page refreshes and shows the correct data. Is there any way to hide the old data being shown?

Upvotes: 0

Views: 1187

Answers (2)

Ramesh
Ramesh

Reputation: 422

I removed listview in OnDisappearing method. Now, It is working correctly. It does not show old data any more.

Upvotes: 0

Daniel Luberda
Daniel Luberda

Reputation: 7454

You could add bool DataLoaded property which implements OnPropertyChanged to your view model. Then bind this property to yours page Content.IsVisibleProperty. When you start refreshing your data simply set DataLoaded to false, and after it finishes set it to true. You could also add an ActivityIndicator for a better user experience (http://developer.xamarin.com/api/type/Xamarin.Forms.ActivityIndicator)

See Data Binding chapter: http://developer.xamarin.com/guides/cross-platform/xamarin-forms/introduction-to-xamarin-forms/

Upvotes: 1

Related Questions