I try to port some Windows Phone 8 projects to current UWP, and get stucked in this snippet code that I\'ve used in old project.
private void Restaurant_Tap(
What you passed in Windows (Phone) 8 has just been a simple string
that included all your parameters. You had to parse them in the OnNavigatedTo()
method of your target page. Of course you can still do that and pass a string to the Frame.Navigate()
method.
But since UWP you can pass complete objects to other pages. So why don't you create a small class that includes all your parameters and pass an instance of that?
Your class could look like:
public class RestaurantParams
{
public RestaurantParams(){}
public string Name { get; set; }
public string Text { get; set; }
// ...
}
And then pass it via:
var parameters = new RestaurantParams();
parameters.Name = "Lorem ipsum";
parameters.Text = "Dolor sit amet.";
// ...
Frame.Navigate(typeof(PageTwo), parameters);
On your next page you can now access them via:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
var parameters = (RestaurantParams)e.Parameter;
// parameters.Name
// parameters.Text
// ...
}
Where Parameter is the function that retrieves the arguments.
Hope that helps.