I am still forcing myself to go to sleep after watching an unreal football drama in Barcelona, so I am writing this short blog post at night.
Besides Visual Studio 2017 official support, XAF v16.2.5 delivers a small gem, which I cannot hide from you too long. Remember that this is an early preview of the functionality we hope to officially release by v17.1 and which is have polished in the coming 2-3 months. So, your feedback is welcome, as always!
Let's modify the platform-agnostic Controller from our demo (C:\Users\Public\Documents\DevExpress Demos 16.2\Components\eXpressApp Framework\SimpleProjectManager\CS\SimpleProjectManager.Module\Controllers\ProjectTaskController.cs) by adding the Application.ShowViewStrategy.ShowMessage call at the end of the Execute event handler:
...
markCompletedAction.Execute += (s, e) => {
IObjectSpace viewDataContext = View.ObjectSpace;
foreach(ProjectTask task in e.SelectedObjects) {
task.EndDate = DateTime.Now;
task.Status = ProjectTaskStatus.Completed;
viewDataContext.SetModified(task); // Mark the changed object as 'dirty' (only required if data properties do not provide change notifications).
}
viewDataContext.CommitChanges();
//viewDataContext.Refresh(); // Optionally update the UI in accordance with the latest data changes.
Application.ShowViewStrategy.ShowMessage(string.Format("{0} task(s) have been completed!", e.SelectedObjects.Count), InformationType.Success, 4000, InformationPosition.Top);
};
...
Now, let's start the Windows and Web apps, select a few uncompleted tasks in the ProjectTask ListView and execute the Done! command from the menu.
Windows < 8
A Microsoft Outlook-styled notification window managed with the AlertControl component from our XtraBars library:
Windows 8, 8.1, 10
A Windows 10-styled notification window managed by the Toast Notification Manager component from our XtraBars library:
![]()
Customization and configuration
You can control the notification appearance and position using the InformationType and InformationPosition enumerations, which are quite self explanatory:
public enum InformationType {
Info = 0,
Warning = 1,
Error = 2,
Success = 3
}
public enum InformationPosition {
Top = 0,
Right = 1,
Bottom = 2,
Left = 3
}
For instance, check out what Information, Warning and Error types look like on the Web:
protected virtual AlertControl ShowMessageWithAlertControl(string message, int displayInterval, InformationType type) { ... }
protected virtual ToastNotification ShowMessageWithToastNotificationManager(string message, int displayInterval, InformationType type) {...}
WebWindow.CurrentRequestWindow.RegisterStartupScript("infoMessage", string.Format("DevExpress.ui.notify({{message: '{0}',type: '{1}', displayTime: {2}, position: {{my:'{3}', at: '{3}'}} }});", message, type.ToString().ToLower(), displayInterval, position.ToString().ToLower()));
Besides Visual Studio 2017 official support, XAF v16.2.5 delivers a small gem, which I cannot hide from you too long. Remember that this is an early preview of the functionality we hope to officially release by v17.1 and which is have polished in the coming 2-3 months. So, your feedback is welcome, as always!
Typical usage
Let's modify the platform-agnostic Controller from our demo (C:\Users\Public\Documents\DevExpress Demos 16.2\Components\eXpressApp Framework\SimpleProjectManager\CS\SimpleProjectManager.Module\Controllers\ProjectTaskController.cs) by adding the Application.ShowViewStrategy.ShowMessage call at the end of the Execute event handler:
...
markCompletedAction.Execute += (s, e) => {
IObjectSpace viewDataContext = View.ObjectSpace;
foreach(ProjectTask task in e.SelectedObjects) {
task.EndDate = DateTime.Now;
task.Status = ProjectTaskStatus.Completed;
viewDataContext.SetModified(task); // Mark the changed object as 'dirty' (only required if data properties do not provide change notifications).
}
viewDataContext.CommitChanges();
//viewDataContext.Refresh(); // Optionally update the UI in accordance with the latest data changes.
Application.ShowViewStrategy.ShowMessage(string.Format("{0} task(s) have been completed!", e.SelectedObjects.Count), InformationType.Success, 4000, InformationPosition.Top);
};
...
Now, let's start the Windows and Web apps, select a few uncompleted tasks in the ProjectTask ListView and execute the Done! command from the menu.
Result in the UI for various platforms
Web
A nice notification window is managed using the dxToast widget (invoked via the DevExpress.ui.notify method) from our DevExtreme HTML5/JavaScript library:Windows < 8
A Microsoft Outlook-styled notification window managed with the AlertControl component from our XtraBars library:
Windows 8, 8.1, 10
A Windows 10-styled notification window managed by the Toast Notification Manager component from our XtraBars library:

Customization and configuration
You can control the notification appearance and position using the InformationType and InformationPosition enumerations, which are quite self explanatory:
public enum InformationType {
Info = 0,
Warning = 1,
Error = 2,
Success = 3
}
public enum InformationPosition {
Top = 0,
Right = 1,
Bottom = 2,
Left = 3
}
For instance, check out what Information, Warning and Error types look like on the Web:
The duration of the message can be set in milliseconds.
In WinForms, you can handle the CustomGetImage event of the DevExpress.ExpressApp.Win > WinShowViewStrategyBase class to provide a custom image for a notification.The same class provides two virtual methods you can override in a custom strategy, if required:
protected virtual AlertControl ShowMessageWithAlertControl(string message, int displayInterval, InformationType type) { ... }
protected virtual ToastNotification ShowMessageWithToastNotificationManager(string message, int displayInterval, InformationType type) {...}
On the Web, you can additionally customize the style of messages using the DevExpress.Web > ASPxWebClientUIControl > GlobalColorScheme property (see the Public Fields section here to learn more about which values to pass there). If this is insufficient for your needs, then we recommend you implement a platform-dependent solution manually:
WebWindow.CurrentRequestWindow.RegisterStartupScript("infoMessage", string.Format("DevExpress.ui.notify({{message: '{0}',type: '{1}', displayTime: {2}, position: {{my:'{3}', at: '{3}'}} }});", message, type.ToString().ToLower(), displayInterval, position.ToString().ToLower()));
The string is formed is according to the DevExtreme documentation for the Toast object.
Limitations
1. In WinForms, the InformationPosition parameter is not taken into account.
2. In WinForms, it is not possible to specify the exact display internally for the toast notification. If the duration parameter is set to int.MaxValue, then 'long' mode is used, otherwise 'default'.
3. In ASP.NET WebForms, the ShowMessage method can be used on XafCallbackManager callbacks initiated by the RaiseXafCallback script. It cannot be used on callbacks of controls (e.g., grid sorting).
Your feedback is welcome!
I hope this information will help you get started with this feature. My team and I are looking forward to hearing from you on how you would leverage this in your XAF project. We will also be ready to answer any questions in the Support Center, as always.