导航到数据透视项目



我有两个不同的页面,每个页面上都有一个pivot元素。我只想从一个页面导航到另一个页面上的特定数据透视项。如何传递和处理NavigatedFrom和NavigatedTo方法的导航信息(如项目索引)?

对于Windows Phone XAML/WinRT应用程序,您可以在Navigate方法中提供一个参数:

Frame->Navigate(AnotherPage::typeid, 42);

在传递"0"的情况下,您需要使用隐式装箱,如以下

Frame->Navigate(AnotherPage::typeid, safe_cast<Platform::Object^>(0));

最后你可以在OnNavigatedTo:中阅读

protected:
void OnNavigatedTo(NavigationEventArgs^ e) override
{ 
    auto parameter = (int)e->Parameter; 
}

看看

http://mikaelkoskinen.net/winrt-xaml-navigating-from-page-to-page-how-it-differs-from-windows-phone-7/

对于Windows Phone Silverlight应用程序(仅限C#),您需要将参数放入导航URI的查询字符串中,并在OnNavigatedTo方法中读取。

最新更新