Sunday, July 21, 2013

Transfer your data on navigation in windows phone (Wp 7)

Suppose two pages are there:

1)  One.xaml
2) Two.xaml

Want to navigate the data from one.xaml to two.xaml : -

Step 1: On Two.Xaml Page you have to make a property to get the value : -

public string navTo { get; set; }

Step 2: On One.XAML page write this code

        We have a OnNavigatedFrom method we will use it :-

protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
            Two obj=e.content.Two();
             if(obj ! = null)
                       obj.navTo = "hello";

In Button Click event on Page one write down

NavigationService.Navigate(new Uri("/ProfessionalSignUp.xaml", UriKind.Relative));

Now on second page you would have the value in navTo you can easily access it.