locked
Universal app: Frame.Navigate in and out a page containing a SwapChainBackgroundPanel

    Question

  • Hi,

    From my MainPage I’ve been opening a page DraftingPage1 containing a SwapChainBackgroundPanel using:

    DraftingPage1 page = new DraftingPage1(file);

    page.cacheFrame = Window.Current.Content as Frame;           

    Window.Current.Content = page;

    Window.Current.Activate();

    And going back to the MainPage using:

    Window.Current.Content = cacheFrame;

    Window.Current.Activate();

    It works.

    Now I need to navigate to a third page SettingsPage from DraftingPage1 and be able to go back to DraftingPage1 (saving the state).

    I tried to simply use to open the page:

    Frame.Navigate(typeof(SettingsPage));

    But unfortunately “Frame” is null and I cannot navigate from it.

    I also tried to use the pattern used from MainPage->DraftingPage1 but unexpectedly SettingsPage does have the cacheFrame property even considering both DraftingPage1 and SettingsPage are derived from the Page class.

    Any help is greatly appreciated.

    Thank you in advance

    Andrea

    Wednesday, August 6, 2014 8:24 PM

Answers

  • Your code snippet removes the Frame from Window.Current.Content and replaces it with DraftingPage1. Because DraftingPage1 replaced the Frame rather than being hosted in it, its Frame property is null and it cannot use Frame navigation. If instead you Navigate to the DraftingPage1 instead of replacing Windows.Current then you'll be able to use Frame.Navigate within DraftingPage1.

    Also consider replacing your SwapChainBackgroundPanel with a SwapChainPanel.

    --Rob

    Wednesday, August 6, 2014 10:45 PM
    Owner