page_type | languages | products | urlFragment | extendedZipContent | description | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
|
|
Notifications |
|
Shows how to use the various Toast and LiveTile related APIs, such as Notification, Popup, and the Windows.UI.StartScreen namespace. |
Shows how to use the various Toast and LiveTile related APIs, such as Notification, Popup, and the Windows.UI.StartScreen namespace.
Note: This sample is part of a large collection of UWP feature samples. You can download this sample as a standalone ZIP file from docs.microsoft.com, or you can download the entire collection as a single ZIP file, but be sure to unzip everything to access shared dependencies. For more info on working with the ZIP file, the samples collection, and GitHub, see Get the UWP samples from GitHub. For more samples, see the Samples portal on the Windows Dev Center.
There are many scenarios in this sample broken down to three major sections:
- Badge
- LiveTile
- Toast
Badges are optional numbers of glyphs that are applied to LiveTiles. They enable the app to communicate whether the user has certain amount of notifications, or their attention is needed due to an event. They can also convey user status in a chat application.
Scenarios include:
- Setting a numerical badge onto a primary tile
- Setting a glyph badge onto a primary tile
- Clearing badges
- Setting badges to secondary tiles
There are two kinds of LiveTiles, Primary and Secondary tiles. Primary tiles are persistent and only one exist for each individual application. Secondary tiles can be more numerous and be used as shortcuts to various locations within the app. LiveTiles need to be pinned to the Start Menu.
Scenarios include:
- Pinning and Unpinning
- Adaptive Templates
- Branding
- Names and Logos
- Hint Presentation
- People, Photos, Contacts
- Images
- From AppData, AppPackage, Internet
- TextStyles
- TextWrap
- Custom
- Basic State
- Background Color
- Logos
- FindAllSync API
- Notifications
- Updating Secondary Tiles
- Updating Primary Tile
- Clearing Primary Tile
- Expiring Notifications
Toast notifications are small pop ups that appear on the screen for few seconds. They convey messages and can be customized to even play different sounds. New to Windows 10 are actionable toasts where a user has a choice to interact with the notifications by use of a button, for example.
Scenarios Include:
- Actions
- Quick Reply
- Text
- Text and Image
- Input Text
- Default Input
- Placeholder Content
- Title
- System Commands
- Snooze
- Dismiss
- Activation Types
- Protocol
- System
- Background Activation With App Closed
- Background Activation With App Open
- Foreground Activation With App Closed
- Foreground Activation With App Open
- Adaptive Templates
- Image Sources
- From App, From AppPackage, From Internet
- Image Sources
- Audio
- Default Audio
- Email Sound
- Looping Audio
- Silent
- Update Toasts
- Expiring Toasts
- Ghost/Suppressed Toasts
- HistoryChangedTrigger API Sample
- Badge Control
- Responding To Toasts
- Various Scenarios
- Default
- Alarm
- Incoming Call
- Reminder
- ToastNotificationManagerHistory API
- Get History
- Remove by Tag
- Remove by Group
- Clear All
- Traffic App sample
- Lunch Scheduler app sample
- Notifications sample for JavaScript (archived)
- Windows 10
- If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
- Start Microsoft Visual Studio and select File > Open > Project/Solution.
- Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio Solution (.sln) file.
- Press Ctrl+Shift+B, or select Build > Build Solution.
The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it.
- Select Build > Deploy Solution.
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or selectDebug > Start Without Debugging.