简体   繁体   中英

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?

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/

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM