App.xaml.cs
publiceventNavigatedEventHandler UnloadPageWorkaround;
privatevoid Application_Onexit(object sender,ExitEventArgs e)
{
UnloadPageWorkaround.Invoke(null, null);
}
Pagex.xaml.cs
void NavigationPage_Loaded(object sender,RoutedEventArgs e)
{
this.NavigationService.Navigating += newNavigatingCancelEventHandler(NavigationService_Navigating);
((App)Application.Current).UnloadPageWorkaround +=newNavigatedEventHandler(CheckExit);
fillData();
}
void CheckExit(object sender,NavigationEventArgs e)
{
if (isChg)
{
MessageBoxResult result = MessageBox.Show("Would you like to save the changes you've made? ","Changes made to your configuration!",MessageBoxButton.YesNo,MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
// ?????????
}
}
}
Thanks!
Peter