3

I am working on a Toast Notification app for Windows Phone 8.

I am able to receive the toast notification with single line of data which includes the Title and whatever content can be displayed on the single line.

But anything that goes beyond the scope of the first line is not displayed in the notification.

I know that the character limit for Toast notifications is around 40 chars and I am keeping the length of the text below this limit.

I have also tried including the '\n' sequence for new line. But it makes no difference.

Can anyone please help me to display the toast notification in multiple lines?

Thanks!

Eran
  • 387,369
  • 54
  • 702
  • 768
user1122549
  • 664
  • 1
  • 13
  • 27

3 Answers3

2

You can't display a multi-line Toast Notification as they are meant to be short. You can, however, display more information once the user taps on your notification.

Raz Harush
  • 739
  • 1
  • 6
  • 21
  • thanks for your response! What you say appears to be correct. But is it mentioned in any doc? Just so that i can use it as a reference in future. – user1122549 Aug 17 '13 at 10:08
  • @user1122549 Well, it is not mentioned that you can or cannot use multiple lines in a toast notification in their documentation. Check out the toast notification guidelines here: http://msdn.microsoft.com/en-us/library/windows/apps/hh465391.aspx – Raz Harush Aug 17 '13 at 15:20
  • @Raz Harush There is templates for multi line notifications. Check this document http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.toasttemplatetype – slobodans Mar 07 '14 at 08:07
  • 1
    @slobodans This relates to Windows 8 and not WP8 – Raz Harush Mar 07 '14 at 08:48
  • Its mentioned that you can not use multi line in phone in https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.toasttemplatetype – vITs Feb 12 '16 at 10:11
0

Don't know about Windows Phone, but in Windows 8 you just need to use a different xml template. With templates 01 and 02 the lines are automatically wrapped.

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.toasttemplatetype

0

You can use: Windows.UI.Notifications.ToastTemplateType.ToastText04

var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText04);
var strings = toastXml.GetElementsByTagName("text");
strings[0].AppendChild(toastXml.CreateTextNode("Title"));
strings[1].AppendChild(toastXml.CreateTextNode("First text line"));
strings[2].AppendChild(toastXml.CreateTextNode("Second text line"));

var notification = new ToastNotification(toastXml);            Windows.UI.Notifications.ToastNotificationManager.CreateToastNotifier().Show(notification);
Rowland Shaw
  • 37,700
  • 14
  • 97
  • 166
slobodans
  • 859
  • 1
  • 17
  • 23