无法向 Windows Phone 8.1 中的组添加 Toast


ToastTemplateType toastTemplate = ToastTemplateType.ToastText02;
// Retrieve the content part of the toast so we can change the text.
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate);
//Find the text component of the content
XmlNodeList toastTextElements = toastXml.GetElementsByTagName("text");
// Set the text on the toast. 
// The first line of text in the ToastText02 template is treated as header text, and will be bold.
toastTextElements[0].AppendChild(toastXml.CreateTextNode(toastHeading));
toastTextElements[1].AppendChild(toastXml.CreateTextNode(toastBody));
// Set the duration on the toast
IXmlNode toastNode = toastXml.SelectSingleNode("/toast");
((XmlElement)toastNode).SetAttribute("duration", "long");
// Create the actual toast object using this toast specification.
ToastNotification toast = new ToastNotification(toastXml);
toast.group ??????????????????
return toast;

如果我写toast.组属性不会出现。有了toast.group我得到了一条红线。

由于您使用的是 C#,因此应该toast.Group .属性和方法始终大写。

至于为什么组属性没有出现,也许智能感知只是在给出?我的经常这样做。

最新更新