Version

WinStatusBar Using the Notification Badge

This topic demonstrates the usage of the NotificationBadge properties of the UltraStatusBar.

Overview

The Notification Badges allow you to notify your users about every important event that requires their attention. Almost all of the settings related to notification badges are exposed in the NotificationBadgeSettings property, which can be found directly on the StatusBar or the individual UltraStatusPanel. The only property related to the NotificationBadges that isn’t part of the NotificationBadgeSettings class is the NotificationBadgeText, which can be found on each UltraStatusPanel.

The size of the NotificationBadges is determined by the size of its contents and it is limited by the size of the DisplayArea. If you have a badge with text, the size of the notification will be the size needed to display the text with the specified font, as long as this size isn’t bigger than its display area. If you show an image, the NotificationBadge will use the image size (again if it isn’t bigger than its display area).

Appearance Properties

The NotificationBadgeSettings property exposes an Appearance property. The NotificationBadgeSettings property is exposed on the status bar and on individual panels. By default the notification badges will use a red background, red borders and a white foreground with a bold font.

In C#:

// Make the font size of the Notifications 8pt
this.ultraStatusBar1.NotificationBadgeSettings.Appearance.FontData.SizeInPoints = 8;
// Use smaller size for the Notifications
this.ultraStatusBar1.NotificationBadgeSettings.Appearance.FontData.SizeInPoints = 5.5f;
// Use Calibri font for all panels
this.ultraStatusBar1.NotificationBadgeSettings.Appearance.FontData.Name = "Calibri";

In Visual Basic:

' Make the font size of the Notifications 8pt
Me.UltraStatusBar1.NotificationBadgeSettings.Appearance.FontData.SizeInPoints = 8
' Use smaller size for the Notifications
Me.UltraStatusBar1.NotificationBadgeSettings.Appearance.FontData.SizeInPoints = 5.5F
' Use Calibri font for all panels
Me.UltraStatusBar1.NotificationBadgeSettings.Appearance.FontData.Name = "Calibri"

Style Property

The style properties for the NotificationBadgeSettings are the BorderStyle and DisplayShadow. BorderStyle determines the border style used by the notification, while DisplayShadow determines whether the notification will have a shadow.

The default border style is Rounded3 and the Notifications won’t show shadows by default. The shadow color is Gray by default and can be controlled by the BorderColor3DBase property of the notification appearances.

In C#:

// Display shadows around the NotificationBadges
this.ultraStatusBar1.NotificationBadgeSettings.DisplayShadow = DefaultableBoolean.True;
// Set the NotificationBadges BorderStyle to Rounded1
this.ultraStatusBar1.NotificationBadgeSettings.BorderStyle = UIElementBorderStyle.Rounded1;

In Visual Basic:

' Display shadows around the NotificationBadges
Me.UltraStatusBar1.NotificationBadgeSettings.DisplayShadow = DefaultableBoolean.[True]
'Set the NotificationBadges BorderStyle to Rounded1
Me.UltraStatusBar1.NotificationBadgeSettings.BorderStyle = UIElementBorderStyle.Rounded1

Visibility Property

The Visibility property determines under which circumstances the StatusBar will show the NotificationBadges. By default it is set to NonNullOrEmpty which means that the NotificationBadge will show only if there is content for it – if there is text or an image assigned to the NotificationBadge. You can make the NotificationBadges always appear, even if they have no content, by setting Visibility to Always or hide them by setting it to Never. Setting Visibility to never can be useful to prevent the NotificationBadges from appearing in places where you don’t want them.

In C#:

// Prevent the NotificationBadges from appearing
this.ultraStatusBar1.NotificationBadgeSettings.Visibility = NotificationBadgeVisibility.Never;

In Visual Basic:

' Prevent the NotificationBadges from appearing
Me.UltraStatusBar1.NotificationBadgeSettings.Visibility = NotificationBadgeVisibility.Never

NotificationBadgeText property

This property is not part of the NotificationBadgeSettings class, but a separate one, which is directly on the panel. It determines the text that is displayed by the NotificationBadge.

In C#:

// Set the notification text displayed by the panels
ultraStatusPanel1.NotificationBadgeText = "7";
ultraStatusPanel2.NotificationBadgeText = "New!";

In Visual Basic:

' Set the notification text displayed by the panels
UltraStatusPanel1.NotificationBadgeText = "7"
UltraStatusPanel2.NotificationBadgeText = "New!"