Back to Devexpress

XtraDialog.Show(XtraDialogArgs) Method

windowsforms-devexpress-dot-xtraeditors-dot-xtradialog-dot-show-x28-devexpress-dot-xtraeditors-dot-xtradialogargs-x29.md

latest2.8 KB
Original Source

XtraDialog.Show(XtraDialogArgs) Method

Displays an XtraDialog with the specified settings.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public static DialogResult Show(
    XtraDialogArgs args
)
vb
Public Shared Function Show(
    args As XtraDialogArgs
) As DialogResult

Parameters

NameTypeDescription
argsXtraDialogArgs

An XtraDialogArgs object that allows you to dynamically customize the displayed dialog.

|

Returns

TypeDescription
DialogResult

A DialogResult enumerator value that specifies what dialog button an end-user has clicked.

|

Remarks

You can handle the Showing event for the args parameter to dynamically customize the dialog content and buttons. The code below illustrates an example.

csharp
XtraDialogArgs args = new XtraDialogArgs();
args.Showing += Args_Showing;
args.Caption = "Default Text";
args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel };
XtraDialog.Show(args);

//...
private void Args_Showing(object sender, XtraMessageShowingArgs e) {
    e.MessageBoxForm.Text = "Custom Text";
    e.Buttons[DialogResult.OK].Text = "Yes";
    e.Buttons[DialogResult.Cancel].Text = "No";
}
vb
Private args As New XtraDialogArgs()
Private args.Showing += AddressOf Args_Showing
args.Caption = "Default Text"
args.Buttons = New DialogResult() { DialogResult.OK, DialogResult.Cancel }
XtraDialog.Show(args)

'...
private void Args_Showing(Object sender, XtraMessageShowingArgs e)
    e.MessageBoxForm.Text = "Custom Text"
    e.Buttons(DialogResult.OK).Text = "Yes"
    e.Buttons(DialogResult.Cancel).Text = "No"

As a result, the displayed dialog will have content and button captions that differ from those that were initially set.

See Also

XtraDialog Class

XtraDialog Members

DevExpress.XtraEditors Namespace