win10 uwp 通知Toast
2016-06-02 00:00
260 查看
win10通知使用Toast
可以使用win10 模板添加通知
使用GetTemplateContent得到模板xml,可以修改
用XmlNodeList xml = content.GetElementsByTagName("text");来得到xml节点
用
Windows.UI.Notifications.ToastNotification toast = new ToastNotification(content);
代码
代码:https://code.csdn.net/lindexi_gd/lindexi_gd/tree/master/Toast_%E9%80%9A%E7%9F%A5
文章有参考某大神,但是忘了他写的在哪,很抱歉
可以使用win10 模板添加通知
var t = Windows.UI.Notifications.ToastTemplateType.ToastText02;
使用GetTemplateContent得到模板xml,可以修改
var content = Windows.UI.Notifications.ToastNotificationManager.GetTemplateContent(t);
用XmlNodeList xml = content.GetElementsByTagName("text");来得到xml节点
xml[0].AppendChild(content.CreateTextNode("通知")); xml[1].AppendChild(content.CreateTextNode("小文本"));
用
Windows.UI.Notifications.ToastNotification toast = new ToastNotification(content);
ToastNotificationManager.CreateToastNotifier().Show(toast);通知
代码
//选择消息模板
//ToastImageAndText01 在三行文本中被包装的大型图像和单个字符串
//ToastImageAndText02 大图像、加粗文本的一个字符串在第一行、常规文本的一个字符串包装在第二、三行中
//ToastImageAndText03 大图像、加粗文本的一个字符串被包装在开头两行中、常规文本的一个字符串包装在第三行中
//ToastImageAndText04 大图像、加粗文本的一个字符串在第一行、常规文本的一个字符串在第二行中、常规文本的一个字符串在第三行中
//ToastText01 包装在三行文本中的单个字符串
//ToastText02 第一行中加粗文本的一个字符串、覆盖第二行和第三行的常规文本的一个字符串。
//ToastText03 覆盖第一行和第二行的加粗文本的一个字符串。第三行中常规文本的一个字符串
//ToastText04 第一行中加粗文本的一个字符串、第二行中常规文本的一个字符串、第三行中常规文本的一个字符串
var t = Windows.UI.Notifications.ToastTemplateType.ToastText02;
//在模板添加xml要的标题
var content = Windows.UI.Notifications.ToastNotificationManager.GetTemplateContent(t);
//需要using Windows.Data.Xml.Dom;
XmlNodeList xml = content.GetElementsByTagName("text");
xml[0].AppendChild(content.CreateTextNode("通知")); xml[1].AppendChild(content.CreateTextNode("小文本"));
//需要using Windows.UI.Notifications;
Windows.UI.Notifications.ToastNotification toast = new ToastNotification(content);
ToastNotificationManager.CreateToastNotifier().Show(toast);
代码:https://code.csdn.net/lindexi_gd/lindexi_gd/tree/master/Toast_%E9%80%9A%E7%9F%A5
文章有参考某大神,但是忘了他写的在哪,很抱歉
相关文章推荐
- win10 uwp 绑定多数据
- WPF 快捷键读写txt
- C# wpf 使用资源文件 resx
- C# wpf image绑定viewModel没有显示图片
- bzoj3771 Triple
- win10 UWP 申请微软开发者
- XamlReader动态使用xaml
- Xamarin Forms 进度条控件
- 第一次python,第一次爬虫
- 序列
- win10 UWP MessageDialog 和 ContentDialog
- btsync 分享资源
- wpf textblock 长文本滚动
- win10 删除设备和驱动器中你不要的图标
- win10 输入法禁用IME
- win10 edge扩展
- redHat 安装mono 错误
- Express 2015 RC for Windows 10 安装
- 需求分析
- Android Tcp服务器端