1

page1.xamlpage2.xamlの 2 つのページがあります。page1.xaml にボタンを 1 つ作成しました。そのクリック イベントで、page2.xamlに移動します。アプリケーションを実行すると失敗し、デバッガーによってApp.xaml.csにドロップされます。以下は私のコードです:

private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)                
{
    if (Debugger.IsAttached)
    {  
        // A navigation has failed; break into the debugger                      
        Debugger.Break();             
    }         
}  

私の page1.xaml.cs の背後にあるコードは次のとおりです。

public partial class MainPage : PhoneApplicationPage     
{
    // Constructor
    public MainPage()   
    { 
        InitializeComponent();  
        // Sample code to localize the ApplicationBar                        
        //BuildLocalizedApplicationBar();
    }

    private void btnDownloded_Click(object sender, RoutedEventArgs e)         
    {             
        NavigationService.Navigate(new Uri("/DownloadedBooksPortrait.xaml", UriKind.Relative));    
    } 
}
4

1 に答える 1

1

SourcePage.xaml

bookName.Id で書籍の ID をフェッチし、bookid を介して宛先ページの ID を取得し、データを表示します。

NavigationService.Navigate(new Uri("/MainPage.xaml?selectedItem=" +bookName.Id, UriKind.Relative));

DestinationPage.xaml

宛先ページでは、以下のようにクエリ パラメータを取得します。

   private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
   {
        string dir = "Hello" + selectedItem;
   }
于 2013-09-24T10:37:11.690 に答える