user4477748
user4477748

Reputation:

How to Work with NavigationService.Navigate in Windows Phone8.1

How To declare "?msg=" in WP8.1...?

i tried this code is working in WP8

In WP8

 private void passParam_Click(object sender, RoutedEventArgs e)
    {

        NavigationService.Navigate(new Uri("/SecondPage.xaml?msg=" + textBox1.Text, UriKind.Relative));
    }

coming to WP8.1 used Frame.Navigate

In WP8.1

 private void passParam_Click(object sender, RoutedEventArgs e)
    {

        Frame.Navigate(typeof(SecondPage.xaml) + textBox1.Text);
    }

Then how to declare "?msg=" in WP8.1....?

Upvotes: 0

Views: 158

Answers (3)

CCamilo
CCamilo

Reputation: 887

As people already wrote, what you need is:

Frame.Navigate(typeof(SecondPage), textBox1.Text);

The second paramater can be actually any object. Then, to get the paremeter in SecondPage you can do this (in your case):

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    String your_text = e.Parameter as String; 
}

Upvotes: 0

Chris Shao
Chris Shao

Reputation: 8231

In Windows Phone 8.1, Page Navigation method is:

Frame.Navigate(typeof(SecondPage), param);

or

Frame.Navigate(typeof(SecondPage));

In your code, you can set param to be yours like this:

Frame.Navigate(typeof(SecondPage), textBox1.Text);

You can find the documentation for this here MSDN

Upvotes: 0

Igor Kulman
Igor Kulman

Reputation: 16361

If you look at Frame.Navigate you will see, the second parameter is a navigation parameter you can pass. Take a look at http://mikaelkoskinen.net/winrt-xaml-navigating-from-page-to-page-how-it-differs-from-windows-phone-7/

Upvotes: 0

Related Questions