Question

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!

Était-ce utile?

La solution

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.

Autres conseils

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

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);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top