我正在尝试实现单击按钮时出现的气球通知,但是我不断收到特定错误:
An object reference is required for the non-static field, method, or property
'TaskbarIcon.ShowBalloonTip(string, string, BalloonIcon)
我正在使用图书馆Hardcodet.Wpf.TaskbarNotification;
方法是
class NotifyIcon
{
public static void ShowStandardBalloon()
{
string title = "WPF NotifyIcon";
string text = "This is a standard balloon";
TaskbarIcon.ShowBalloonTip(title, text, BalloonIcon.Error);
}
}
并被称为:
private void Button_Click(object sender, RoutedEventArgs e)
{
NotifyIcon ST = new NotifyIcon();
ST.ShowStandardBalloon();
}
下出现错误TaskbarIcon.ShowBalloonTip
。
我尝试public static void
在通知图标类中更改为,但这并没有解决任何问题。