2
如何在使用Microsoft.Toolkit.Uwp.Notifications库的WPF应用程序的系统吐司通知上将click
事件附加到按钮上?WPF上的系统通知
我知道我需要使用IBackground
接口,但我不能绑定到这个类,因为下面的代码导致错误(ToastNotificationActionTrigger()
元素未找到,HRESULT:0x80070490)。
private void RegisterBackgroundTask()
{
const string taskName = "ToastBackgroundTask";
// Otherwise create the background task
var builder = new BackgroundTaskBuilder();
builder.Name = taskName;
builder.TaskEntryPoint = typeof(ToastNotificationBackgroundTask).FullName;
// And set the toast action trigger
builder.SetTrigger(new ToastNotificationActionTrigger());
// And register the task
builder.Register();
}
我通知的观点:
请帮助。
谢谢,@ ganchito55,我已经现在如何显示简单的系统通知与文字,描述和图像,但现在我想实现按钮通知。我使用了[以下文章](https://blogs.msdn.microsoft.com/tiles_and_toasts/2015/07/08/quickstart-sending-a-local-toast-notification-and-handling-activations-from-it-it- windows-10 /),但我无法处理点击按钮事件。 –
@VitaliiKulyk我刚刚关注了那篇文章,并且在一个新的WPF应用程序中,我遇到ToastNotification无法识别的错误。你能用你的代码给我一个项目吗?我会尽力解决它。 – ganchito55
mr @ ganchito55,你可以点击[链接](https://github.com/vitcool/WPFDesctopNotifications/tree/master/CSharp-Toast-Example)下载我的项目。我会感谢任何帮助。 –