A newer version of this page is available. Switch to the current version.


  • 2 minutes to read

An XtraDialog is a message box that replaces the standard dialogs. Like the standard dialogs, it allows you to display a control (for example, a UserControl) and a button set in its client area. However, unlike standard dialogs, it supports DevExpress skins to provide a consistent appearance. For example, the image below shows a standard dialog that does not match the application's theme.

XtraDialog - Off

The second image displays the same application with an XtraDialog.

XtraDialog - On

To display a dialog, call the static XtraDialog.Show method. Method parameters allow you to specify which control is displayed in its client area, provide the dialog's caption and add predefined buttons:

The following code invokes an XtraDialog displaying a UserControl with custom controls (two TextEdit controls and one CheckEdit control), and the OK and Cancel buttons:


using DevExpress.XtraEditors;
using DevExpress.XtraLayout;
using System;
using System.Windows.Forms;

namespace WindowsFormsApp1 {
    public partial class Form3 : Form {
        public Form3() {

        private void simpleButton1_Click(object sender, EventArgs e) {
            LoginUserControl myControl = new LoginUserControl();
            if (DevExpress.XtraEditors.XtraDialog.Show(myControl, "Sign in", MessageBoxButtons.OKCancel) == DialogResult.OK) {
                // do something

    public class LoginUserControl : XtraUserControl {
        public LoginUserControl() {
            LayoutControl lc = new LayoutControl();
            lc.Dock = DockStyle.Fill;
            TextEdit teLogin = new TextEdit();
            TextEdit tePassword = new TextEdit();
            CheckEdit ceKeep = new CheckEdit() { Text = "Keep me signed in" };
            SeparatorControl separatorControl = new SeparatorControl();
            lc.AddItem(String.Empty, teLogin).TextVisible = false;
            lc.AddItem(String.Empty, tePassword).TextVisible = false;
            lc.AddItem(String.Empty, ceKeep);
            this.Height = 100;
            this.Dock = DockStyle.Top;