[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Collapse]Messages, Notifications and Dialogs
    XtraMessageBox
    Input Box
    XtraDialog
    Flyout Dialog
    Flyout Panel
   [Expand]Alert Windows
    Toast Notification Manager
    WinRTLiveTileManager
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

XtraMessageBox

The XtraMessageBox replaces standard Windows Forms message boxes which do not support DevExpress skins.

Expanded Show Message Boxes

To display an XtraMessageBox, call the static XtraMessageBox.Show method. The sample code below prevents an application from closing if a user clicks "No".

Tip

You can use the XtraDialog class to display messages with a more complex layout.

Expanded Auto-Close Message Boxes

The Show(XtraMessageBoxArgs args) method overload allows you to show a message box that closes automatically. The method parameter is the XtraMessageBoxArgs class object and provides the AutoCloseOptions.Delay property that allows you to set the auto-close timeout (in milliseconds).

The first message box button ("OK" in the sample above) is a default button - if a user presses "Enter" or the auto-closing timer expires, this button is considered clicked, and the message box returns the corresponding DialogResult value. This button also displays the countdown timer for auto-closing messages.

You can modify the XtraMessageBoxArgs.DefaultButtonIndex to select the default button and disable the AutoCloseOptions.ShowTimerOnDefaultButton setting to hide the countdown timer.

Expanded Additional Customization

Invoke message boxes using the Show(XtraMessageBoxArgs args) method overload and handle this method parameter's Showing event to perform message box customizations.

Modify message box buttons

The code below illustrates how to add custom icons to message box buttons. In this example, icons are vector images stored in the external SvgImageCollection.

Change appearance and font settings

The example below increases the message box button's height and font size, and makes the text bold.

Change button alignment

Use the XtraMessageBox.ButtonsAlignment static (Shared in VB) property to specify the button alignment. The example below aligns message box buttons at the right.

Is this topic helpful?​​​​​​​