Toasts

Glance

  • See new information from your App

Act

  • Take simple actions,

Toast States

  • Collapsed State (Action Center*, Mobile default)
  • Expanded State (Action Center*, Desktop default)

*chevron = expand arrow

Templates

Same Syntax as for adaptive Tiles.

Sending Toast

  • Scheduled
  • Local
  • Push

Sending Toast (Legacy)

var template = ToastTemplateType.ToastText01;
var xml = ToastNotificationManager.GetTemplateContent(template);
xml.DocumentElement.SetAttribute("launch", "Args");

var text = xml.CreateTextNode(content);
var elements = xml.GetElementsByTAgName("text");
elements[0].AppendChild(text);

var toast = new ToastNotification(xml);
var notifier = ToastNotificationManager.CreateToastNotifier();
notifier.Show(toast);

Sending Toast

toast = new ToastNotification(toastxml);
toast.Tag = tag;
toast.Group = group;

var notifier = ToastNotificationManager.CreateToastNotifier();
notifier.Show(toast);

Handling activation

  • void OnActivated(IactivatedEventArgs args)
  • void OnLaunchend(LaunchActivatedEventArgs args)
if(args.Kind == ActivationKind.Launch && args.Arguments != null && args.TileId != "App")
{
  // Handle Toast
}

if(args.Kind == ActivationKind.Launch && args.Arguments == null && args.TileId != "App")
{
  // Handle Primary Tile or Toast
}

„App“ means Primary Tile

Special Toasts

  • Alarm <toast scenario=“alarm“ …>
  • Reminder <toast scenario=“reminder“ …>
  • Incoming Call <toast scenario=“incomingCall“ …>

Toast Notification

<toast>
 <visual>
  <binding template="ToastGeneric">
   <image placement="appLogoOverride" src="Torrance/Shum.png"
   <text>Torrance Shum</text>
   <text>Media content attached.</text>
   <image placement="inline" src="attachment.png" />
   <text>Hey check out this photo</text>
  </binding>
 </visual>
</toast>

Toast Input

<toast>
  ...
  <actions>
   <input title="Snooze for" id="SnoozeTime" type="selections" defaultSelection="5">
    <selection id="5" content="5 Minutes" />
    <selection id="10" content="10 Minutes" />
    <selection id="15" content="15 Minutes" />
   </input>
  ...
  <action activationType="system" arguments="snooze" hint-inputId="snoozeTime" content="" />
  <action activationType="system" arguments="dismiss" content="" />
  ...
  </actions>
</toast>

New activation types & activations

  • Foreground
    1. Tap Button
    2. Task launches
    3. Retrieve Args
    4. Takle Actions
  • Background (No UI)
    1. Tap Button
    2. Task launches
    3. Retrieve Args
    4. Takle Actions
  • Protocol
    1. Tap Button
    2. Protocol Activates
    3. Web / App
  • System
    1. Tap Button
    2. System handles