Mega Code Archive

 
Categories / C# / WPF
 

Handle Application DispatcherUnhandledException

<Application x:Class="TreeViewDataBinding.app"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Startup="AppStartup"     >     <Application.Resources>               </Application.Resources> </Application> //File:Window.xaml.cs using System; using System.Windows; using System.Data; using System.Xml; using System.Configuration; namespace TreeViewDataBinding {     public partial class app : Application     {         void AppStartup(object sender, StartupEventArgs args)         {             this.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(app_DispatcherUnhandledException);         }         void app_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)         {             MessageBox.Show(e.Exception.Message);         }                      } }