Toast notifications are often used to inform users about things that apply to our application. It could be information about messages, invitations, and so on. We are going to create a simple method that shows a sample message, and after clicking, it goes directly to one of the pages in the application.
public static void ShowSettingsToast() { var toastMessage = new ShellToast(); toastMessage.Title = "Hello"; toastMessage.Content = "Your app settings needs your attention"; toastMessage.NavigationUri = new Uri("/Views/SettingsPage.xaml", UriKind.Relative); toastMessage.Show(); }
Implementation is very simple; it's just an initialization of the ShellToast
object that contains Title
, Content
, and NavigationUri
and that points to our application page. Calling this method in background agent causes the notification to be seen when the application is not running.