Hello guys,
i'm using Xamarin Forms to develope my app on both iOS and Android
I have 2 page:
1. A Custom Renderer Page for each platform, it include a listview to show list of item in SQLite database
2. A Result Page to show data when I press button to show camera and link item to taken image. This page i using NavigationAsync to show up
The question is, How to update list of item when i already link item to image and press back button?
Thanks.
You can use OnAppearing method on your Page A code behind to refresh/requery SQLite again, and refresh UI.
This method will be also called, when you would navigate back (from your Page B to Page A).
Of course you can also call somehow your page viewmodel from such place, to do the same - via MessagingCenter, or via something more custom, like calling BindingContext method (PageViewModel method):
protected override void OnAppearing() { var vm = BindingContext as YourPageViewModel; vm?.RefreshData(); base.OnAppearing(); }
Answers
You can use OnAppearing method on your Page A code behind to refresh/requery SQLite again, and refresh UI.
This method will be also called, when you would navigate back (from your Page B to Page A).
Of course you can also call somehow your page viewmodel from such place, to do the same - via MessagingCenter, or via something more custom, like calling BindingContext method (PageViewModel method):
hi
in the code above in place of YourPageViewModel what should I give , if I have a 2 pages namely page A and Page B and when I click on browse files button in page A it takes me to file explorer when I click on back button there the app is crashing next time when i go to file explorer ,so it is like to go to page B i need to select a file from file explorer by clicking on the browse button in page A, can you please let me know in place of YourPageViewModel what should be used in my program?
Perfect for me NamyslawSzymaniuk.
Great thanks.