Heimonen Christofer
Heimonen Christofer

Reputation: 1

The simplest way to show a toast notification in WP7?

I've been looking for a way to show an offline (not pushed from a server) toast notification on WP7 for a while now. Any ideas?

Upvotes: 0

Views: 1206

Answers (2)

Drew
Drew

Reputation: 1014

Within a background task, simply call this method:

    public static void makeToast(string toastText)
    {
        //Make a new toast with content "text"
        ShellToast toast = new ShellToast();
        toast.Title = "Toast Title: ";
        toast.Content = toastText;
        //toast.NavigationUri = new Uri();
        toast.Show();
    }

Upvotes: 0

Kevin Gosse
Kevin Gosse

Reputation: 39007

If you're trying to show the notification while your application is running, you can use the ToastPrompt from the coding4fun toolkit: http://coding4fun.codeplex.com/

If you want to show the notification while your app isn't running, you can use the ShellToast class from a background agent: http://msdn.microsoft.com/en-us/library/microsoft.phone.shell.shelltoast(v=vs.92).aspx

Upvotes: 4

Related Questions