2010-02-12 17 views

Respuesta

13

Puede utilizar DispatcherUnhandledException:

XAML (App.xaml):

<Application x:Class="App.App" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    StartupUri="wndMain.xaml" DispatcherUnhandledException="Application_DispatcherUnhandledException"> 

Código Atrás (App.xaml.cs/vb:.

private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) 
{ 
    // Handle error here 

    ... 

    // Prevent default unhandled exception processing by WPF 
    e.Handled = true; 
} 

leer more here Siempre en primer lugar, haga la cantidad correcta de manejo de errores. No permita que los errores entren en este método.

Cuestiones relacionadas