Getting URL of Current Page in Windows Phone Dynamically Through Code

Have you ever come across the need to fetch the URL of content current displaying? Let us say there are 5 pages in your application and the 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.

        URI.gif

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.

Up Next
    Ebook Download
    View all
    Learn
    View all