WPF NotifyIcon

--------------
ADD   Added ParentTaskbarIcon attached dependency property which is set for tooltips, popups, and custom balloons.
CHG   Made CloseBalloon public.
CHG   Changed sample, cleaned up commands pattern.


git-svn-id: https://svn.evolvesoftware.ch/repos/evolve.net/WPF/NotifyIcon@93 9f600761-6f11-4665-b6dc-0185e9171623
This commit is contained in:
Philipp Sumi
2009-05-03 07:10:30 +00:00
parent d792f1c5a4
commit 2b05ff7bd7
12 changed files with 330 additions and 76 deletions

View File

@@ -163,7 +163,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
Popup.CreateRootPopup(popup, balloon);
//TODO we don't really need this and it causes the popup to become hidden if the
//don't set the PlacementTarget as it causes the popup to become hidden if the
//TaskbarIcon's parent is hidden, too...
//popup.PlacementTarget = this;
@@ -180,6 +180,9 @@ namespace Hardcodet.Wpf.TaskbarNotification
SetCustomBalloon(popup);
}
//assign this instance as an attached property
SetParentTaskbarIcon(balloon, this);
//fire attached event
RaiseBalloonShowingEvent(balloon);
@@ -199,7 +202,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
/// <summary>
/// Closes the current <see cref="CustomBalloon"/>, if it's set.
/// </summary>
private void CloseBalloon()
public void CloseBalloon()
{
if (IsDisposed) return;
@@ -214,6 +217,11 @@ namespace Hardcodet.Wpf.TaskbarNotification
{
//if a balloon message is already displayed, close it immediately
popup.IsOpen = false;
//reset attached property
UIElement element = popup.Child;
if (element != null) SetParentTaskbarIcon(element, null);
SetCustomBalloon(null);
}
}
@@ -396,7 +404,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
tt = new ToolTip();
tt.Placement = PlacementMode.Mouse;
//TODO we don't really need this and it causes the popup to become hidden if the
//do *not* set the placement target, as it causes the popup to become hidden if the
//TaskbarIcon's parent is hidden, too.
//tt.PlacementTarget = this;