1

I've created a 1 page (MainPage.xaml.cs) dice app, and another seperate page for Snap View (Snapped.xaml.cs). Is there a way to straight away navigate to the Snapped.xaml from the MainPage.xaml whenever I go into Snap View? And then, once again, back to MainPage.xaml when I return to full view?

mightybyte
  • 7,282
  • 3
  • 23
  • 39
user1660165
  • 63
  • 1
  • 1
  • 3

1 Answers1

0

Yes. First, place a Frame as the content of the current Window:

//this should happen when the app launches
var rootFrame = new Frame();
Window.Current.Content = rootFrame;

Then, have your pages inherit from a common page base to make it easier:

public partial MainPage : LayoutAwarePage

The default template for a GridApp includes a LayoutAwarePage class that you can start with. Pass in a reference to the frame (or wrap it in your own NavigationService)

Then, handle view state changes to and detect when you are in Snapped / Fullscreen state, and navigate to the appropriate page. To detect the current view, use the ApplicationView class (MSDN Reference).

Community
  • 1
  • 1
Krishna
  • 2,997
  • 1
  • 23
  • 31