The following code snippet demonstrates how to use event to catch exceptions that are not taken care of in the logic block / code segment.
//adding event for the error handler
//add event to the app.xaml.cs file
this.UnhandledException += App_UnhandledException;
//taking care of the exception in the event
void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
//handle/log error that occurs .
//details of the error are in the e.exception object