I am trying to implement a notifyicon (http://www.hardcodet.net/projects/wpf-notifyicon) in MVVM project. I understand this control is meant to be used in a regular WPF project.
I am wondering how to implement the ballon feature (Balloon feature).
As specified in this tutorial the method “ShowBallonTip” needs to be called
//show balloon with built-in icon
MyNotifyIcon.ShowBalloonTip(title, text, BalloonIcon.Error);
The only place I could call this method, I can think of, is in the code behind. I do not have a problem with having a little code in a view code behind (even if I would prefer not having any) but I can not figure out how I can have the view model to talk to the view and asks it to call this method.
Even if I place this method in an event how can I raise this event programatically from the viewmodel?
Any idea how I could achieve this?
I have been able to display a balloon tip by initialising the icon in the viewmodel instead of the XAML.
Just calling the ShowBalloonTip method in my command do the trick.
I created a wrapper for the notify Icon:
NotifyService:
And I used it in my view model:
viewmodel