Balloon Notifications
With the RadNotifyIcon
you can show a notification allowing you to display a message or prompt the user for some action.
Balloon Notification Properties
The RadNotifyIcon exposes the following properties for controlling the look of the notification:
-
BalloonTitle
—Gets or sets the title of the balloon tip. -
BalloonText
—Gets or sets the text of the balloon tip. -
BalloonIcon
—A property of typeSystem.Drawing.Icon
that gets or sets the icon of the balloon tip. -
BalloonIconSource
—This property provides an alternative way of setting an icon by using anImageSource
or a string path pointing to the location of your icon.
If the BalloonIconSource property is set, it should point to an .ico file.
Use an .ico file with bigger dimensions (Width/Height) as Windows can scale it down, however, it will not be scaled up if it is less than the default size.
Setting up the RadNotifyIcon
<Grid>
<Button Content="Show notification" Click="OnShowNotification" />
<telerik:RadNotifyIcon
x:Name="icon"
BalloonText="Balloon Text"
BalloonTitle="Balloon Title"
TrayIconSource="/Icons/ProgressGreen.ico"
BalloonIconSource="/Icons/ProgressGreen.ico">
</telerik:RadNotifyIcon>
</Grid>
Showing a notification
private void OnShowNotification(object sender, RoutedEventArgs e)
{
this.icon.ShowBalloonTip();
}
Private Sub OnShowNotification(ByVal sender As Object, ByVal e As RoutedEventArgs)
Me.icon.ShowBalloonTip()
End Sub
Balloon Notification
ShowBalloonTip Overloads
Here are the overloads exposed by the ShowBallonTip method:
-
void ShowBalloonTip(int timeout = 10)—This overload uses the
BalloonTitle
,BalloonText
and the icon provided byBalloonIcon
/BalloonIconSource
properties to show a notification. Optionally an integer can be passed to specify the amount of seconds to wait before the balloon auto hides (The system minimum and maximum are 10 and 30 seconds).The timeout parameter is not supported by the Windows OS after Windows Vista, so setting the
timeout
won't do anything. -
void ShowBalloonTip(string title, string text, BalloonTipIcon icon, bool doNotPlaySound = false, int timeout = 10)—This overload allows for passing a title, text, and choosing an icon from the set of standardized icons. Optionally you can specify whether sound should be played and the amount of seconds to wait before the balloon auto hides (The system minimum and maximum are 10 and 30 seconds).
Showing a warning notification
this.icon.ShowBalloonTip("Warning", "Emergency", BalloonTipIcon.Warning, false, 15);
Me.icon.ShowBalloonTip("Warning", "Emergency", BalloonTipIcon.Warning, False, 15)
Warning Notification
-
void ShowBalloonTip(string title, string text, System.Drawing.Icon icon, bool useLargeIcon = true, bool doNotPlaySound = false, int timeout = 10)—This overload allows for passing a title, text, and a
System.Drawing.Icon
instance. Optionally you can specify whether the large version of the provided icon should be used, whether sound should be played and the amount of seconds to wait before the balloon auto hides (The system minimum and maximum are 10 and 30 seconds).Showing a notification with custom icon
var icon = new System.Drawing.Icon("YourIconPath.ico"); this.icon.ShowBalloonTip("Balloon Title", "Balloon Text", icon, true, false, 15);
Dim icon = New System.Drawing.Icon("YourIconPath.ico") Me.icon.ShowBalloonTip("Balloon Title", "Balloon Text", icon, True, False, 15)
Hide the Notification
You can manually hide the notification by invoking the HideBalloonTip
method.
Hide the notification
this.icon.HideBalloonTip();
Me.icon.HideBalloonTip()