djack109
djack109

Reputation: 1377

In Xamarin using masterdetail how do you detect a page change?

When you have a Xamarin Master/Detail app. How can you detect when the detail pages changes

Basically, when you select a new page I want to be able to detect the change and get the old page to save its data.

Any ideas ?

Upvotes: 0

Views: 38

Answers (1)

Georgi Georgiev
Georgi Georgiev

Reputation: 70

Have you tried to override the OnDisappearing method of the page.

Example:

 public partial class LoginPage : ContentPage
 {
    public LoginPage()
    {
        InitializeComponent();
        
    }
    protected override void OnDisappearing()
    {
        base.OnDisappearing();
       //write your logic here
    }
 }

Upvotes: 1

Related Questions