Gracefully Exit a XAML Application
This article describes how to gracefully exit a C++ Silverlight for Windows Embedded application:
http://social.technet.microsoft.com/wiki/contents/articles/3265.aspx
The equivalent code under XAML In The Hand is similar except uses the Close() method of the Window class. You can call this from anywhere in your application using:-
Application.Current.MainWindow.Close();