Search code examples
windows-store-appswin-universal-appapp.xaml

How to create a toast notification with OK and Cancel buttons?


Is there a way to create a toast notification with buttons and then handle the click events of the buttons?

Thanks


Solution

  • Windows 8.1 does not support general purpose buttons on toasts. General purpose toasts will activate the app if they are clicked or not if they are ignored or cancelled. Each toast can have only a singular ID set when the toast is raised.

    Additional command buttons are available if your app is the system alarm app or a VOIP app. These commands are added in the commands element of the toast template as described in the Toast schema

    <commands scenario="alarm"> 
        <command id="snooze"/> 
        <command id="dismiss"/> 
    </commands>" 
    

    This is demonstrated in the Alarm toast notifications sample

    The available commands for the alarm scenario are snooze and dismiss The available commands for the incomingCall scenario are video, voice, and decline.