Version

WinExplorerBar Using the Notification Badge

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

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 ExplorerBar, and on each item and group. The only property related to the NotificationBadges that isn’t part of the NotificationBadgeSettings class is the NotificationBadgeText, which can be found on each UltraExplorerBarGroup and each UltraExplorerBarItem.

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 UltraExplorerBar and on the settings object for individual items and groups. 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.ultraExplorerBar1.NotificationBadgeSettings.Appearance.FontData.SizeInPoints = 8;
// Use smaller size for the Notifications on groups
this.ultraExplorerBar1.GroupSettings.NotificationBadgeSettings.Appearance.FontData.SizeInPoints = 5.5f;
// Use Calibri font for the first group
this.ultraExplorerBar1.Groups[0].ItemSettings.NotificationBadgeSettings.Appearance.FontData.Name = "Calibri";

In Visual Basic:

' Make the font size of the Notifications 8pt
Me.UltraExplorerBar1.NotificationBadgeSettings.Appearance.FontData.SizeInPoints = 8
' Use smaller size for the Notifications on groups
Me.UltraExplorerBar1.GroupSettings.NotificationBadgeSettings.Appearance.FontData.SizeInPoints = 5.5f
' Use Calibri font for the first group
Me.UltraExplorerBar1.Groups(0).ItemSettings.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.ultraExplorerBar1.NotificationBadgeSettings.DisplayShadow = DefaultableBoolean.True;
// Set the NotificationBadges BorderStyle to Rounded1
this.ultraExplorerBar1.NotificationBadgeSettings.BorderStyle = UIElementBorderStyle.Rounded1;

In Visual Basic:

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

Visibility Property

The Visibility property determines under which circumstances the ExplorerBar 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.ultraExplorerBar1.NotificationBadgeSettings.Visibility = NotificationBadgeVisibility.Never;

In Visual Basic:

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

NotificationBadgeText property

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

In C#:

// Set the notification text displayed by the items
ultraExplorerBarGroup1.NotificationBadgeText = "7";
ultraExplorerBarItem1.NotificationBadgeText = "New!";

In Visual Basic:

' Set the notification text displayed by the items
UltraExplorerBarGroup1.NotificationBadgeText = "7"
UltraExplorerBarItem1.NotificationBadgeText = "New!"