Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9182441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:33:38+00:00 2026-06-17T18:33:38+00:00

In trying to determine why my app (which came into this brave new world

  • 0

In trying to determine why my app (which came into this brave new world based on thte “Blank App” template) isn’t working like I would expect (http://stackoverflow.com/questions/14467756/why-would-my-event-handler-not-get-called), I started a new Blank project, and then deleted MainPage and added a new Basic (not Blank) page which I named MainPage in honor of the dearly departed page (and as a nod to tradition and laziness – so I wouldn’t have to change the code in app.xaml.cs which navigates to that page).

The Blank app created the original MainPage.xaml.cs like this (auto-generated comment elided):

namespace AsYouWish
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
        }
    }
}

…I replaced it with a BasicPage (not BlankPage), and it generated this:

namespace AsYouWish
{
    public sealed partial class MainPage : AsYouWish.Common.LayoutAwarePage
    {
        public MainPage()
        {
            this.InitializeComponent();
        }

        protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
        }

        protected override void SaveState(Dictionary<String, Object> pageState)
        {
        }
    }

So the Basic Page gets LoadState() and SaveState(), whereas the Blank Page’s MainPage had OnNavigatedTo(). Why does the Basic Page not also have an OnNavigatedTo() event? It seems as if every page has the possibility of being navigated to (and from, but that event I can see as more likely being optional/unnecessary).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:33:39+00:00Added an answer on June 17, 2026 at 6:33 pm

    This is just a matter of the page template that is being used. OnNavigatedTo virtual method is implemented in Page class therefore it can be overriden in any class inherited directly or indirectly from it. The only difference is that the template used for MainPage.xaml.cs already has an empty OnNavigatedTo method in it and the BasicPage template doesn’t.

    There’s nothing stopping you from overriding the method by adding the following code:

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        base.OnNavigatedTo(e);
    
        // add you own code here
    }
    

    Just make sure you keep the base.OnNavigatedTo(e) call or you’ll lose the functionality that’s already implemented in LayoutAwarePage (enabling LoadState/SaveState).

    In case you don’t know, it’s really easy to add overrides to your class in Visual Studio. Just type override and press space and a dropdown will open with all the methods that you can override in your class. Once you select one of them the complete empty method will be added to your class, just like the one I’ve included in my answer above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the top command in MacOS X to determine which app
I am trying to determine if a phone is located in this polygon using
I'm trying to make an app that displays something in real-world units. It's not
I'm trying to configure OAuth into my iPhone app to connect to another web
I'm sorry if this is a noob question, I'm new to Ember.js and trying
I'm trying to determine which tab has been selected by the user. I melded
Trying my hand at java and android and have run into a problem which
I'm trying to launch the Amazon Kindle app from my android application but based
I have this entity - I'm trying to determine the type of its properties
I'm trying to determine the current day of the week in my app. To

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.