我试图了解 EventHandler 并且必须使用通知项目。这是项目的链接: https ://codeload.github.com/mike-eason/WPF_ToastNotifications/zip/master
我所做的只是将 .Net-framework 从 4.5 更改为 4
我遇到了这个错误:
我的类不能用作泛型类型或方法“System.EventHandler”中的类型参数“TEventArgs”
ToastNotification类:
[TemplatePart(Name = "PART_DismissButton", Type = typeof(Button))]
public class ToastNotification : ContentControl
{
public event EventHandler Dismissed;
public string Title
{
get { return (string)GetValue(TitleProperty); }
set { SetValue(TitleProperty, value); }
}
public static readonly DependencyProperty TitleProperty =
DependencyProperty.Register("Title", typeof(string), typeof(ToastNotification));
public string Message
{
get { return (string)GetValue(MessageProperty); }
set { SetValue(MessageProperty, value); }
}
public static readonly DependencyProperty MessageProperty =
DependencyProperty.Register("Message", typeof(string), typeof(ToastNotification));
public …Run Code Online (Sandbox Code Playgroud)