Я пытаюсь использовать значок уведомления WPF http://www.codeproject.com/Articles/36468/WPF-NotifyIcon. Я создаю новый проект wpf, я импортирую dll из образца проекта, а затем копирую часть и код xaml. XAML:Как использовать WPF NotifyIcon
<Window x:Class="trayicon.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="http://www.hardcodet.net/taskbar"
Title="MainWindow" Height="350" Width="525">
<Grid>
<!--
in order to create a NotifyIcon, all you need is the
namespace declaration (see above on line 4) and a simple
declaration
-->
<tb:TaskbarIcon
IconSource="Error.ico"
ToolTipText="hello world"
/>
</Grid>
</Window>
C# Код:
using Hardcodet.Wpf.TaskbarNotification;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace trayicon
{
/// <summary>
/// Logica di interazione per MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
//Note: XAML is suggested for all but the simplest scenarios
TaskbarIcon tbi = new TaskbarIcon();
tbi.Icon = Resources.Error;
tbi.ToolTipText = "hello world";
}
}
}
Существует ошибка в строке tbi.Icon = Resources.Error; , и если я прокомментирую эту строку, я получил исключение XamlParseException в строке ToolTipText = «hello world»
Помогите? Спасибо