0
votes

I create one page Windows Phone 8.1 Universal App. i want when click on button navigate back to page came from.

    private void backbtn_Click(object sender, RoutedEventArgs e)
    {
        Frame rootFrame = Window.Current.Content as Frame;

        if (rootFrame != null && rootFrame.CanGoBack)
        {                
            rootFrame.GoBack();
        }
    }

the problem is, i want back some parameter like id=10&name=test

i can do it when navigate to Uri

Frame.Navigate(typeof(page1), "id=1");

or

await Windows.System.Launcher.LaunchUriAsync(new Uri("myapp:///id=1"));

but there is no function to do it

        Frame rootFrame = Window.Current.Content as Frame;

        if (rootFrame != null && rootFrame.CanGoBack)
        {                
            rootFrame.GoBack("some parameter id=10");
        }

thanks

1

1 Answers

0
votes

It was a problem for me as well, so I in such a scenario I came up with the idea to create a static class where I put my data which I need to pass back. On the page which you navigate from, you can write the data in OnNavigatedFrom, and then on the page where you navigate to, you can read that data in the OnNavigatedTo method, if the NavigationMode is NavigationMode.Back.