Have you ever come across the requirement to fetch the URL of content current displaying on? Let us say there are 5 pages in your application and user is navigating across them. At any point of time if you want to fetch the URL of current page you can very much do that.

image

Above line of code will fetch URL of current page.

Imagine a scenario in which you need to fetch current page while deactivating the application. So you may do that as below,

 


private void Application_Deactivated(object sender, DeactivatedEventArgs e)
        {
            Uri currentUri = ((App)Application.Current).RootFrame.CurrentSource;


        }



This was all about getting the current page URL in Windows Phone application. I hope this quick post was useful. Thanks for reading Smile

Advertisements

2 thoughts on “Getting URL of current page in Windows Phone dynamically through code

  1. This is too much. Being an MVP this doesn’t give your good impression to me. You mainly write posts not to share but to increase your popularity on no. of posts.

    Take my suggestion. Post once in a week with good content instead of posting multiple small notes daily. Also, I observed, you posted 3-4 posts daily which are really bogus. Instead of increasing no. of post count, try to give a single post with a good content.

    – Pallab R.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s