New to Telerik UI for WPF? Download free 30-day trial

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.

Example 1: Setting Header

var alert = new RadDesktopAlert(); 
alert.Header = "Mail Notification"; 
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.

Example 2: Setting Content

var alert = new RadDesktopAlert(); 
alert.Content = "Hello, Here are two things that we noticed today on our front-end meeting"; 
Dim alert = New RadDesktopAlert() 
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.

Example 3: Setting ShowDuration

var alert = new RadDesktopAlert(); 
alert.ShowDuration = 3000; 
Dim alert = New RadDesktopAlert() 
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:

Example 4: Setting Icon

var alert = new RadDesktopAlert(); 
alert.Icon = new Image { Source = Application.Current.FindResource("DesktopAlertIcon") as ImageSource, Width = 48, Height = 48 }; 
Dim alert = New RadDesktopAlert() 
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.

Example 5: Setting IconColumnWidth

var alert = new RadDesktopAlert(); 
alert.IconColumnWidth = 75; 
Dim alert = New RadDesktopAlert() 
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.

Example 6: Setting IconMargin

var alert = new RadDesktopAlert(); 
alert.IconMargin = new Thickness(0, 0, 10, 10); 
Dim alert = New RadDesktopAlert() 
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.

Example 7: Setting Command

var alert = new RadDesktopAlert(); 
alert.Command = new DelegateCommand(this.OnCommandExecuted); 
Dim alert = New RadDesktopAlert() 
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:

Example 8: Setting CanAutoClose

var alert = new RadDesktopAlert(); 
alert.CanAutoClose = true; 
Dim alert = New RadDesktopAlert() 
alert.CanAutoClose = True 

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

Example 9: Setting CanAutoClose using DesktopAlertParameters

var manager = new RadDesktopAlertManager(); 
manager.ShowAlert(new DesktopAlertParameters 
{ 
    CanAutoClose = false, 
    Header = "Message", 
    Content = "A new message has arrived!" 
}); 
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:

Example 10: Setting ShowCloseButton

var alert = new RadDesktopAlert(); 
alert.ShowCloseButton = false; 
Dim alert = New RadDesktopAlert() 
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:

Example 11: Setting ShowMenuButton

var alert = new RadDesktopAlert(); 
alert.ShowMenuButton = false; 
Dim alert = New RadDesktopAlert() 
alert.ShowMenuButton = False 

ShowInTaskSwitcher

By the default the RadDesktopAlert window will appear in the TaskSwitcher (Alt+Tab menu). To hide it from this menu, you need to set the ShowInTaskSwitcher property to false. The default value is true.

Example 12: Setting ShowInTaskSwitcher

var alert = new RadDesktopAlert(); 
alert.ShowInTaskSwitcher = false; 
Dim alert = New RadDesktopAlert() 
alert.ShowInTaskSwitcher = False 

See Also

In this article