ToastNotifier.Show(ToastNotification) 方法

定义

显示指定的 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);

适用于