Page.cs
private void PageButton_Click(object sender, RoutedEventArgs e)
{
PageFunction pageFunction = new PageFunction();
pageFunction.Return += new ReturnEventHandler<String>(pageFunction_Return);
this.NavigationService.Navigate(pageFunction);
}
static void pageFunction_Return(object sender, System.Windows.Navigation.ReturnEventArgs<String> e)
{
String returnedVaule = e.Result;
MessageBox.Show(returnedVaule);
}
PageFunction.cs
private void PageFunctionButton_Click(object sender, RoutedEventArgs e)
{
OnReturn(new ReturnEventArgs<string>("Returned"));
}
As Shown above i have a Page and a PageFunction.
On PageButton_Click of Page.cs, i am navigating to PageFunction, But after the execution of the whole PageButton_Click event, a null reference exception (i.e, Object reference not set to an instance of an object).
And i dont know why this exception ocurred.
Help me out with this problem.
Thanks.
Remember ->
pagefunction<string>
it may help you.