User Tools

Site Tools


notes:uwp:lifecycle

Lifecycle in UWP

Page Lifecycle

After the page constructor finishes, the page goes through the following events:

  • OnNavigatedTo
  • SizeChanged
  • LayoutUpdated - invoked when elements are added or removed from the visual tree or the layout is changed
  • Loaded - occurs only once during the lifetime of a Page

Every FrameworkElement derivative has a Loaded event. The Loaded events occur in a sequence going up the visual tree, ending with the Page derivative.

Example: Handle the Loaded event using an anonymous method:

public MainPage()
{
    this.InitializeComponent();
 
    Loaded += (sender, args) =>
    {
        // ..
    };
}
notes/uwp/lifecycle.txt · Last modified: 2017/02/09 by admin