AbsoluteSith
AbsoluteSith

Reputation: 1967

How to have in app notification in windows 10?

Earlier in windows phone 8.1 I used to use the ToastPrompt provided by coding4fun toolkit. These notifications are inside the app and are very neat. Is there something like that for Windows 10 UWP. As I couldn't use the same. Code Used currently:

ToastPrompt tp = new ToastPrompt() { Title = "Hi", Message = "Show the message" };
tp.Show();

This works on wp 8.1 winrt but fail's to run on win10 Universal.

enter image description here

I was looking for something like this which wouldn't show up in the action centre like a normal toast notification. But I realized that It wouldn't be nice with regards to universal apps hence implemented my own local notification. You can check out the app here if you'd like to see what exactly I meant.

Upvotes: 4

Views: 5531

Answers (3)

Pradyumna Das
Pradyumna Das

Reputation: 85

What you want is probably something like a modal dialog and not a notification. For that you can use a ContentDialog. Copying an example from the link below:

using System;
private async void WifiConnectionLost()
{
    ContentDialog noWifiDialog = new ContentDialog()
    {
        Title = "No wifi connection",
        Content = "Check connection and try again",
        PrimaryButtonText = "Ok"
    };

    await noWifiDialog.ShowAsync();
}

Upvotes: 0

MSicc
MSicc

Reputation: 329

If you want just a simple notification that pops in and out and remains inside your app, I wrote a blog post on how to do it on your own (simple but effective): http://msicc.net/?p=4365 (takes only about 30 minutes to implement).

Upvotes: 0

Related Questions