uwp Navigation Navigate to a newest page

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

To navigate to a newest page, we can use the Navigate() method from the frame.

contentRoot.Navigate(typeof(MyPage), parameter);

where contentRoot is the Frame instance and MyPage a control inheriting from Page

In MyPage, the OnNavigatedTo() method will be called once the navigation will complete (ie when the user will enter the page) allowing us to triggering or finalizing the loading of the page data. The OnNavigatedFrom() method will be called when leaving the page allowing us to release what has to be released.

public class MyPage : Page
{
    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        // the page is now the current page of the application. We can finalized the loading of the data to display
    }

    protected override void OnNavigatedFrom(NavigationEventArgs e)
    {
        // our page will be removed from the screen, we release what has to be released
    }
}


Got any uwp Question?