ToastNotifier.Show(ToastNotification) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
显示指定的 Toast 通知。
public:
virtual void Show(ToastNotification ^ notification) = Show;
void Show(ToastNotification const& notification);
public void Show(ToastNotification notification);
function show(notification)
Public Sub Show (notification As ToastNotification)
参数
- notification
- ToastNotification
包含要显示的 Toast 通知内容的对象。
示例
以下示例演示如何创建和发送包含文本和图像的 Toast 通知,包括使用 Show 方法。
var notificationManager = ToastNotificationManager;
var template = ToastTemplateType.ToastImageAndText01;
var toastXml = notificationManager.GetTemplateContent(template);
var images = toastXml.GetElementsByTagName("image");
images[0].SetAttribute("src", "images/toastImageAndText.png");
var textNodes = toastXml.GetElementsByTagName("text");
textNodes[0].AppendChild(toastXml.CreateTextNode("Text input 1"));
var toast = new ToastNotification(toastXml);
notificationManager.CreateToastNotifier().Show(toast);