问题
I'm try to pass a parameter while navigate between pages.. in the firs page I have:
private void companyGrid_Tap(object sender, GestureEventArgs e)
{
String tempVal = "";
tempVal = "PassVal";
NavigationService.Navigate(new Uri("/ComPage.xaml?comID=" + tempVal, UriKind.Relative));
}
and in the next page i have:
protected override void onNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
String strId = NavigationContext.QueryString["comID"];
}
but I get an error about the override "onNavigatedTo" mathod say: "no suitable method found to override"
i check and all the Examples show the same way to pass the parameter... Maybe someone know what the reason it's not working???
回答1:
I'm not at my desktop at the moment so not 100% sure, but shouldn't it be OnNavigatedTo (capital O at the start)?
So you'd have:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
String strId = NavigationContext.QueryString["comID"];
}
来源:https://stackoverflow.com/questions/11014715/passing-data-while-navigation-between-pages-onnavigatedto-no-suitable-method-fou