mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-01-21 01:35:39 -05:00
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:
65
Source/Sample Project/FancyBalloon.xaml.cs
Normal file
65
Source/Sample Project/FancyBalloon.xaml.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
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;
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
|
||||
namespace Sample_Project
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FancyBalloon.xaml
|
||||
/// </summary>
|
||||
public partial class FancyBalloon : UserControl
|
||||
{
|
||||
#region BalloonText dependency property
|
||||
|
||||
/// <summary>
|
||||
/// Description
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty BalloonTextProperty =
|
||||
DependencyProperty.Register("BalloonText",
|
||||
typeof (string),
|
||||
typeof (FancyBalloon),
|
||||
new FrameworkPropertyMetadata(""));
|
||||
|
||||
/// <summary>
|
||||
/// A property wrapper for the <see cref="BalloonTextProperty"/>
|
||||
/// dependency property:<br/>
|
||||
/// Description
|
||||
/// </summary>
|
||||
public string BalloonText
|
||||
{
|
||||
get { return (string) GetValue(BalloonTextProperty); }
|
||||
set { SetValue(BalloonTextProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public FancyBalloon()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the <see cref="TaskbarIcon"/> that displayed
|
||||
/// the balloon and requests a close action.
|
||||
/// </summary>
|
||||
private void imgClose_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
//the tray icon assigned this attached property to simplify access
|
||||
TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);
|
||||
taskbarIcon.CloseBalloon();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user