这是我第一次实施 Toast 通知,但我遇到按钮问题:
我正在使用NotificationsExtensions
创建Toast通知:
ToastContent tc = new ToastContent()
{
Visual = new ToastVisual()
{
TitleText = new ToastText() { Text = "Quick Save" },
BodyTextLine1 = new ToastText() { Text = "Type below the info that you wanna save and press enter" }
},
Actions = new ToastActionsCustom()
{
Inputs =
{
new ToastTextBox(nameBox)
{
PlaceholderContent = "type here"
}
},
Buttons =
{
new ToastButton("save", "save")
{
TextBoxId = nameBox
}
}
},
Duration = ToastDuration.Short
};
答案 0 :(得分:2)
您忘记为按钮添加ImageUri
ToastContent tc = new ToastContent()
{
Visual = new ToastVisual()
{
TitleText = new ToastText()
{
Text = "Quick Save"
},
BodyTextLine1 = new ToastText()
{
Text = "Type below the info that you wanna save and press enter"
}
},
Actions = new ToastActionsCustom()
{
Inputs =
{
new ToastTextBox("nameBox")
{
PlaceholderContent = "type here"
}
},
Buttons =
{
new ToastButton("save", "save")
{
TextBoxId = "nameBox",
ImageUri = "Assets/check.png"
}
}
}
};
var text = tc.GetContent();
var xml = tc.GetXml();
var toast = new ToastNotification(xml);
ToastNotificationManager.CreateToastNotifier().Show(toast);