0
votes

I have gone through some code and got familiar with Navigation Service in Windows Phone 8.1. But I need this code to declare in my Base Page to use it every where in all other pages, declaring the code only one.

For example, from the following code,

    protected void NavigateToPage(string uri)
    {
        this.NavigationService.Navigate(new Uri(uri, UriKind.RelativeOrAbsolute));
    }

I just pass the Uri of the page in NavigateToPage(PageUri) to achieve my target. But how i could i achieve this in Windows Phone 8.1. This is what I tried,

    protected void NavigateToPage(Type sourcePage)
    {
        this.Frame.Navigate(typeof(sourcePage));
    }

But I couldn't use sourcePage here. May be I am doing wrong with the Type of parameter. Can anyone answer this?

1

1 Answers

1
votes

Why not this:

protected void NavigateToPage(Type sourcePage)
{
    this.Frame.Navigate(sourcePage);
}