Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[WinRT] How to change NavigationService base frame?

See original GitHub issue

I have a view BasePage, which is opened on start, and it contains Frame. I want to register NavigationService using not rootFrame, but my Frame from BasePage.

In WP it was possible to get container from code-behind:

Bootstrapper bootstrapper = Application.Current.Resources["bootstrapper"] as Bootstrapper;

and after that call RegisterNavigationService(CustomFrame);

But I didn’t found a way to do it in Win8 app. Any ideas?

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

nigel-sampsoncommented, Feb 26, 2014

On the Frame control in your BasePage.xaml is the Frame’s DataContext set to null?

<Frame DataContext="{x:Null}" />

If not, the behaviour you’re seeing will happen. The reason is that the Frame’s DataContext is BasePageViewModel, which means any Page you navigate to inside that Frame will inherit the DataContext, therefore the Navigation Service won’t create IndexPageViewModel as it believes the Page already has a ViewModel.

Ponfcommented, Mar 2, 2014
Read more comments on GitHub >

github_iconTop Results From Across the Web

NavigationService for WinRT
Some of its premises where no longer valid – most notable the way to retrieve the main application frame by accessing Application.Current.
Read more >
Peer-to-peer navigation between two pages - Windows apps
In this article. 1. Create a blank app; 2. Use a Frame to navigate between pages; 3. Add basic pages; 4. Pass information ......
Read more >
WinRT - How to ignore or delete page from navigation history
My question is how to do that, and how to manipulate Frame Navigation Stack on WinRT. I tried with going Back twice, but...
Read more >
NavigationService - How to cancel navigation to a certain ...
In my old WinRT app i developed a navigation service that expose the navigating event, allowing to cancel navigation from view models. I...
Read more >
Navigating in a WinUI 3 Desktop application
In this article we describe a minimal framework for a navigation service in a WinUI 3 Desktop application on top of a NavigationView...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found