Pro-Tip: Accessing The Current Page From App.xaml.cs For Windows Store Apps

12 November 2012

Quick tip for anyone looking to access the current page from App in a Windows 8 Metro XAML/C# app; the full path you need to traverse is:

  • Get the Window.Current.Content, which is the Frame object assigned in App.xaml.cs in the OnLaunched() method
  • The Frame's Content will be your current page (you can test this, eg ((Frame)Window.Current.Content) is MainPage)

Tags: Windows Store App

Add a Comment

No Comments