小编ham*_*jz4的帖子

在UWP中的页面之间传递一些参数

我尝试将一些Windows Phone 8项目移植到当前的UWP,并且陷入了我在旧项目中使用的代码片段.

 private void Restaurant_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    {
        string types = "restaurant";
        string title = "restaurant";
        string url = string.Format("/NearbyPlaces.xaml?latitude={0}&longitude={1}&types={2}&title={3}", LocationLatitude.Text, LocationLangitude.Text, types, title);
        NavigationService.Navigate(new Uri(url, UriKind.Relative));

    }
Run Code Online (Sandbox Code Playgroud)

在该代码中,我使用NavigationService将一些参数传递给另一个页面.我不能再使用NaigationService了,因为UWP不支持它.我已经尝试在我的UWP项目中使用它,但我认为它只支持传递一个参数CMIIW.

 private void restaurant_tapped(object sender, TappedRoutedEventArgs e)
    {
        string types = "restaurant";
        string title = "restaurant";
        Frame.Navigate(typeof(placeResult), latLoc.Text, longLoc.Text, types, title);
    }
Run Code Online (Sandbox Code Playgroud)

该代码给我一个错误,因为它需要5个参数,即+2重载.我的问题是如何以正确的方式在UWP项目中传递一些参数?

c# uwp

22
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×1

uwp ×1