-1

///最初に、値を格納するための人気のあるクラスを作成しました

public class Popular
{
   public string   trk_mnetid,trk_title ,   art_mnetid, art_name,   image_url;
}

/// popularplaylist クラスを作成する

public partial class PopularPlaylist : PhoneApplicationPage
{

 Popular popobj = new Popular();
    List<Popular> pop = new List<Popular>();

/* call json parsing it  and show only "titles" in List form when i m click on perticular title i need to show details  in next screen which i paser and store in popular popularplaylist class.
i use navigationservice  call new screen
*/

 NavigationService.Navigate(new Uri("/Popular_Module/PopularPlaylist.xaml", System.UriKind.Relative));

}

// 次の画面でリストデータを取得する方法を教えてください

4

1 に答える 1

-1

クエリ文字列を使用します。値の受け渡し: MainPage.xaml.cs に次を追加します。パラメーターを渡す最も簡単な方法は、次のような文字列を使用することです。

private void btnNavigate_Click(object sender, RoutedEventArgs e)
{
   string url=String.Format("/Page1.xaml?parameter={0}",popular);
   NavigationService.Navigate(new Uri(url, UriKind.Relative));
}

値の取得: Page.xaml.cs に次を追加します。注: OnNavigatedTo をオーバーライドすることが重要です。その後、NavigationContext を使用して、渡されたパラメーターを取得できます。

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
  base.OnNavigatedTo(e);   
  List<string> parameterValue = NavigationContext.QueryString["parameter"];   
}

パラメータの値を取得する別の一般的な構文は次のとおりです。

List<string> parameter = string.Empty;
if (NavigationContext.QueryString.TryGetValue("parameter", out parameter))
{
  //do something with the parameter
}
于 2013-04-07T06:15:39.400 に答える