Edit this page

Key Properties

The purpose of this help article is to show you the key properties of RadDesktopAlert control. The topic includes the following properties:

The Header property is used to set the header content of RadDesktopAlert. The Header is of type object, so by applying a custom HeaderTemplate as well any desired content can be visualized.

[C#] Setting Header

var alert = new RadDesktopAlert();
alert.Header = "Mail Notification";

[VB] Setting Header

Dim alert = New RadDesktopAlert()
alert.Header = "Mail Notification"

Content

Using the Content property the inner content of RadDesktopAlert could easily be set. The Content property is of type object, so any content can be visualized by applying a custom ContentTemplate.

[C#] Setting Content

alert.Content = "Hello, Here are two things that we noticed today on our front-end meeting";

[VB] Setting Content

alert.Content = "Hello, Here are two things that we noticed today on our front-end meeting"

ShowDuration

The duration of the visualization of RadDesktopAlert is determined by the ShowDuration property of the control. It is of type integer and represents the amount of milliseconds after which the alert automatically closes. The default value of the property is 5000.

[C#] Setting ShowDuration

alert.ShowDuration = 3000;

[VB] Setting ShowDuration

alert.ShowDuration = 3000

Icon

In order to display an icon inside RadDesktopAlert the Icon property should be set. It is of type object, so any content can be visualized by applying a custom IconTemplate as well. The following example demonstrates how to show the built in icon image of the currently used theme:

[C#] Setting Icon

alert.Icon = new Image { Source = Application.Current.FindResource("DesktopAlertIcon") as ImageSource, Width = 48, Height = 48 };

[VB] Setting Icon

alert.Icon = New Image() With
{
    .Source = TryCast(Application.Current.FindResource("DesktopAlertIcon"), ImageSource),
    .Width = 48,
    .Height = 48
}

IconColumnWidth

Using the IconColumnWidth property you could easily set the Width of the column that contains the icon. The default value is double.NaN, so the property needs to be set always to the needed value if an icon is used.

[C#] Setting IconColumnWidth

alert.IconColumnWidth = 75;

[VB] Setting IconColumnWidth

alert.IconColumnWidth = 75

IconMargin

The IconMargin property is a specific property of RadDesktopAlert that is used to set a Margin around the control's icon. By default there aren't any margins applied.

[C#] Setting IconMargin

alert.IconMargin = new Thickness(0, 0, 10, 10);

[VB] Setting IconMargin

alert.IconMargin = New Thickness(0, 0, 10, 10)

Command

RadDesktopAlert provides you with a command property. This means you can bind the alert to a command that will be executed when it gets clicked.

[C#] Setting Command

alert.Command = new DelegateCommand(this.OnCommandExecuted);

[VB] Setting Command

alert.Command = New DelegateCommand(Me.OnCommandExecuted)

CanAutoClose

In order to prevent RadDesktopAlert from auto closing you need to use the CanAutoClose property introduced with Q3 2015 release version of UI for WPF. It is of type bool so it could either be set to True, False – the default value is true:

[C#] Setting CanAutoClose

alert.CanAutoClose = true;

[VB] Setting CanAutoClose

alert.CanAutoClose = True

The CanAutoClose property could also be set using the DesktopAlertParameters that are passed to the ShowAlert method of RadDesktopAlertManager:

[C#] Setting CanAutoClose using DesktopAlertParameters

var manager = new RadDesktopAlertManager();
manager.ShowAlert(new DesktopAlertParameters
{
    CanAutoClose = false,
    Header = "Message",
    Content = "A new message has arrived!"
});

[VB] Setting CanAutoClose using DesktopAlertParameters

Dim manager = New RadDesktopAlertManager()
manager.ShowAlert(New DesktopAlertParameters With
{
    .CanAutoClose = False,
    .Header = "Message",
    .Content = "A new message has arrived!"
})

ShowCloseButton

You could easily hide the close button of RadDesktopAlert using the ShowCloseButton. By setting it to False the button will get hide - be default it is true. This property was introduced with Q3 2015 released version of UI for WPF:

[C#] Setting ShowCloseButton:

alert.ShowCloseButton = false;

[VB] Setting ShowCloseButton:

alert.ShowCloseButton = False

ShowMenuButton

In order to visualize the menu of RadDesktopAlert you need to set the ShowMenuButton property to true – by default it is set to false. By doing so a DropDownButton will be visualized next to the close button and an empty menu with no items will be created. This property was introduced with Q3 2015 released version of UI for WPF:

[C#] Setting ShowMenuButton:

alert.ShowMenuButton = false;

[VB] Setting ShowMenuButton:

alert.ShowMenuButton = False

See Also