RadNotifyIcon
Provides a WPF control that represents a system tray icon with customizable features such as balloon tips, popups, and context menus. The RadNotifyIcon can be used to display an icon in the Windows notification area (system tray), allowing for user interaction with mouse events like clicks and movements. It offers various properties to customize its appearance and behavior such as TrayIcon, BalloonTitle, PopupContent, and more. Additionally, events are raised for user interactions, allowing developers to respond to user's actions, such as opening popups or displaying context menus.
Definition
Namespace:Telerik.Windows.Controls
Assembly:Telerik.Windows.Controls.Navigation.dll
Syntax:
[TelerikToolboxCategory("Containers")]
public class RadNotifyIcon : FrameworkElement, IDisposable
Inheritance: objectRadNotifyIcon
Implements:
Constructors
Initializes a new instance of the RadNotifyIcon class.
public RadNotifyIcon()
Fields
BalloonIconProperty
DependencyProperty
Identifies the BalloonIcon dependency property.
public static readonly DependencyProperty BalloonIconProperty
BalloonIconSourceProperty
DependencyProperty
Identifies the BalloonIconSource dependency property.
public static readonly DependencyProperty BalloonIconSourceProperty
BalloonTextProperty
DependencyProperty
Identifies the BalloonText dependency property.
public static readonly DependencyProperty BalloonTextProperty
BalloonTitleProperty
DependencyProperty
Identifies the BalloonTitle dependency property.
public static readonly DependencyProperty BalloonTitleProperty
ContextMenuActivationMouseEventProperty
DependencyProperty
Identifies the ContextMenuActivationMouseEvent dependency property.
public static readonly DependencyProperty ContextMenuActivationMouseEventProperty
GuidItemProperty
DependencyProperty
Identifies the GuidItem dependency property.
public static readonly DependencyProperty GuidItemProperty
PopupActivationMouseEventProperty
DependencyProperty
Identifies the PopupActivationMouseEvent dependency property.
public static readonly DependencyProperty PopupActivationMouseEventProperty
PopupCloseModeProperty
DependencyProperty
Identifies the PopupCloseMode dependency property.
public static readonly DependencyProperty PopupCloseModeProperty
PopupContentProperty
DependencyProperty
Identifies the PopupContent dependency property.
public static readonly DependencyProperty PopupContentProperty
PopupContentTemplateProperty
DependencyProperty
Identifies the PopupContentTemplate dependency property.
public static readonly DependencyProperty PopupContentTemplateProperty
PopupShowDurationProperty
DependencyProperty
Identifies the PopupShowDuration dependency property.
public static readonly DependencyProperty PopupShowDurationProperty
ShowTrayIconProperty
DependencyProperty
Identifies the ShowTrayIcon dependency property.
public static readonly DependencyProperty ShowTrayIconProperty
TooltipContentProperty
DependencyProperty
Identifies the TooltipContent dependency property.
public static readonly DependencyProperty TooltipContentProperty
TooltipContentTemplateProperty
DependencyProperty
Identifies the TooltipContentTemplate dependency property.
public static readonly DependencyProperty TooltipContentTemplateProperty
TrayContextMenuProperty
DependencyProperty
Identifies the TrayContextMenu dependency property.
public static readonly DependencyProperty TrayContextMenuProperty
TrayIconProperty
DependencyProperty
Identifies the TrayIcon dependency property.
public static readonly DependencyProperty TrayIconProperty
TrayIconSourceProperty
DependencyProperty
Identifies the TrayIconSource dependency property.
public static readonly DependencyProperty TrayIconSourceProperty
UseNativeTooltipProperty
DependencyProperty
Identifies the UseNativeTooltip dependency property.
public static readonly DependencyProperty UseNativeTooltipProperty
Properties
BalloonIcon
Icon
Gets or sets the icon of the balloon tip to be show when the ShowBalloonTip(int) method is called. This is a dependency property.
public Icon BalloonIcon { get; set; }
BalloonIconSource
ImageSource
Gets or sets the icon of the balloon tip to be show when the ShowBalloonTip(int) method is called. This is a dependency property.
public ImageSource BalloonIconSource { get; set; }
Gets or sets the text of the balloon tip to be show when the ShowBalloonTip(int) method is called. This is a dependency property.
public string BalloonText { get; set; }
Gets or sets the title of the balloon tip to be show when the ShowBalloonTip(int) method is called. This is a dependency property.
public string BalloonTitle { get; set; }
Gets or sets the mouse action that must be performed over the notify icon to show the TrayContextMenu. This is a dependency property.
public MouseActivationEvent ContextMenuActivationMouseEvent { get; set; }
Gets or sets the Guid id that will be used to identify the notify icon when sending messages to it. This is a dependency property.
public Guid GuidItem { get; set; }
Gets a value indicating whether a popup is open.
public bool IsPopupOpen { get; }
Gets a value indicating whether a custom tooltip is open.
public bool IsTooltipOpen { get; }
Gets or sets the mouse action that must be performed over the notify icon to show a popup with PopupContent. This is a dependency property.
public MouseActivationEvent PopupActivationMouseEvent { get; set; }
Gets or sets the mode in which the popup closes. This is a dependency property.
public PopupCloseMode PopupCloseMode { get; set; }
Gets or sets the content of the popup that the notify icon shows when the PopupActivationMouseEvent is performed. This is a dependency property.
public object PopupContent { get; set; }
PopupContentTemplate
DataTemplate
Gets or sets the content template for the popup that the notify icon shows when the PopupActivationMouseEvent is performed. This is a dependency property.
public DataTemplate PopupContentTemplate { get; set; }
Gets or sets the animation played when hiding the popup.
public RadAnimation PopupHideAnimation { get; set; }
Gets or sets the animation played when opening the popup.
public RadAnimation PopupShowAnimation { get; set; }
Gets or sets the amount of time in milliseconds after which the popup will begin to close automatically. This is a dependency property.
public int PopupShowDuration { get; set; }
Gets or sets whether the icon is visible in the notification area. This is a dependency property.
public bool ShowTrayIcon { get; set; }
Gets or sets the content of the tooltip that will be shown when the mouse hovers over the notify icon. This is a dependency property.
public object TooltipContent { get; set; }
TooltipContentTemplate
DataTemplate
Gets or sets the content template for the tooltip that will be shown when the mouse hovers over the notify icon. This is a dependency property.
public DataTemplate TooltipContentTemplate { get; set; }
Gets or sets the context menu to be shown when the ContextMenuActivationMouseEvent is performed. This is a dependency property.
public RadContextMenu TrayContextMenu { get; set; }
TrayIcon
Icon
Gets or sets the icon to be displayed in the windows notification area. This is a dependency property.
public Icon TrayIcon { get; set; }
TrayIconSource
ImageSource
Gets or sets the icon to be displayed in the windows notification area. This is a dependency property.
public ImageSource TrayIconSource { get; set; }
Gets or sets whether a native tooltip [true] or the TooltipContent and/or TooltipContentTemplate [false] will be shown when the mouse hovers over the notify icon. If set to [true] the TooltipContent property should be set to a string value. This is a dependency property.
public bool UseNativeTooltip { get; set; }
Methods
Adds the notify icon to the Windows notification area.
public void AddIcon()
Disposes any resources this instance holds.
public void Dispose()
Implements:
Disposes any resources this instance holds.
Releases unmanaged resources and performs other cleanup operations before the RadNotifyIcon is reclaimed by garbage collection.
protected override void Finalize()
Checks the state of the computer for the current user to determine whether sending a notification is appropriate.
public static UserNotificationState GetUserNotificationState()
The state of the computer for the current user.
Hides the balloon tip.
public void HideBalloonTip()
Hides the popup.
public void HidePopup()
Measurement override. Implement your size-to-content logic here.
protected override Size MeasureOverride(Size availableSize)
Available size that parent can give to the child.
Returns:Size
Desired Size of the control, given available size passed as parameter.
Fires the BalloonTipClicked event.
protected virtual void OnBalloonTipClicked()
Fires the BalloonTipClosed event.
protected virtual void OnBalloonTipClosed()
Fires the BalloonTipShown event.
protected virtual void OnBalloonTipShown()
Fires the PopupOpened event.
Fires the PopupOpening event.
protected virtual void OnPopupOpening(NotifyIconPopupOpeningEventArgs e)
The event arguments.
Fires the PreviewTooltipOpened event.
protected virtual void OnPreviewTooltipOpened(CancelEventArgs e)
The event arguments.
Notification that a specified property has been changed.
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
EventArgs that contains the property, metadata, old value, and new value for this change.
Fires the Selected event.
protected virtual void OnSelected(NotifyIconSelectedEventArgs e)
The event arguments.
Fires the TooltipOpened event.
Fires the TrayContextMenuOpened event.
protected virtual void OnTrayContextMenuOpened(EventArgs e)
The event arguments.
Fires the TrayContextMenuOpening event.
protected virtual void OnTrayContextMenuOpening(CancelEventArgs e)
The event arguments.
Fires the TrayIconMouseClick event.
protected virtual void OnTrayIconMouseClick(MouseButtonEventArgs e)
The event arguments.
Fires the TrayIconMouseDoubleClick event.
protected virtual void OnTrayIconMouseDoubleClick(MouseButtonEventArgs e)
The event arguments.
Fires the TrayIconMouseDown event.
protected virtual void OnTrayIconMouseDown(MouseButtonEventArgs e)
The event arguments.
Fires the TrayIconMouseMove event.
protected virtual void OnTrayIconMouseMove(MouseEventArgs e)
The event arguments.
Fires the TrayIconMouseUp event.
protected virtual void OnTrayIconMouseUp(MouseButtonEventArgs e)
The event arguments.
Removes the icon from the Windows notification area.
public void RemoveIcon()
Shows a balloon tip with the settings defined in the BalloonTitle, BalloonTitle and BalloonIcon properties.
public void ShowBalloonTip(int timeout = 10)
The amount of seconds to wait before the balloon auto hides. The system minimum and maximum are 10 and 30 seconds. Note this parameter has effect only in Windows 2000 and Windows XP. More information here https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa.
Shows a balloon tip.
public void ShowBalloonTip(string title, string text, BalloonTipIcon icon, bool doNotPlaySound = false, int timeout = 10)
The title of the balloon tip.
textstringThe text of the balloon tip.
iconBalloonTipIconThe icon of the balloon tip.
doNotPlaySoundboolWhether sound should be played when showing the balloon tip.
timeoutintThe amount of seconds to wait before the balloon auto hides. The system minimum and maximum are 10 and 30 seconds. Note this parameter has effect only in Windows 2000 and Windows XP. More information here https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa.
Shows a balloon tip.
public void ShowBalloonTip(string title, string text, Icon icon, bool useLargeIcon = true, bool doNotPlaySound = false, int timeout = 10)
The title of the balloon tip.
textstringThe text of the balloon tip.
iconIconThe icon of the balloon tip.
useLargeIconboolWhether the large version of the provided icon should be used.
doNotPlaySoundboolWhether sound should be played when showing the balloon tip.
timeoutintThe amount of seconds to wait before the balloon auto hides. The system minimum and maximum are 10 and 30 seconds. Note this parameter has effect only in Windows 2000 and Windows XP. More information here https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa.
Shows the popup next to the notify icon, depending on edge of the screen where the taskbar is located.
public void ShowPopup()
Shows the popup at the provided location.
public void ShowPopup(Point location)
The coordinates where the popup should be opened.
Sends an update message to the notify icon.
public void UpdateIcon()
Events
Occurs when the user clicks on a balloon tip.
public event EventHandler BalloonTipClicked
Occurs when a balloon tip is closed.
public event EventHandler BalloonTipClosed
Occurs when a balloon tip is shown.
public event EventHandler BalloonTipShown
Occurs when the popup of the RadNotifyIcon is opened.
public event EventHandler PopupOpened
Occurs before the popup of the RadNotifyIcon is opened.
public event EventHandler<NotifyIconPopupOpeningEventArgs> PopupOpening
Occurs before the custom tooltip of the RadNotifyIcon is opened.
public event CancelEventHandler PreviewTooltipOpened
Occurs when the user selects a RadNotifyIcon in the Windows notification area.
public event EventHandler<NotifyIconSelectedEventArgs> Selected
Occurs when the custom tooltip of the RadNotifyIcon is opened.
public event EventHandler TooltipOpened
Occurs when the context menu of the RadNotifyIcon is opened.
public event EventHandler TrayContextMenuOpened
Occurs before the context menu of the RadNotifyIcon is opened.
public event CancelEventHandler TrayContextMenuOpening
TrayIconMouseClick
MouseButtonEventHandler
Occurs when the user clicks on the notify icon.
public event MouseButtonEventHandler TrayIconMouseClick
TrayIconMouseDoubleClick
MouseButtonEventHandler
Occurs when the user double clicks on the notify icon.
public event MouseButtonEventHandler TrayIconMouseDoubleClick
TrayIconMouseDown
MouseButtonEventHandler
Occurs when the user presses a mouse button over the notify icon.
public event MouseButtonEventHandler TrayIconMouseDown
TrayIconMouseMove
MouseEventHandler
Occurs when the user moves the mouse over the notify icon.
public event MouseEventHandler TrayIconMouseMove
TrayIconMouseUp
MouseButtonEventHandler
Occurs when the user releases a mouse button over the notify icon.
public event MouseButtonEventHandler TrayIconMouseUp