Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Deployment
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]Actions
  [Expand]Navigation
  [Expand]Views
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Templates
  [Expand]Filtering
  [Expand]Reporting
  [Expand]Dashboards
  [Expand]Scheduler and Notifications
  [Expand]Maps
  [Expand]Security
  [Expand]Workflow
  [Expand]Localization
  [Expand]Testing
  [Collapse]Miscellaneous UI Customizations
    How to: Add a button to a Form using Custom View Item
    How to: Adjust the Size and Style of Pop-up Dialogs (ASP.NET)
    How to: Adjust the Windows' Size and Style
    How to: Change an Application Logo and Info
    How to: Create a Custom Control Detail Item
    How to: Customize a Window Caption
    How to: Customize ASP.NET Layout Elements Using Custom CSS Classes
    How to: Customize Export Options of the Printing System
    How to: Customize the Conditional Appearance Module Behavior
    How to: Customize Window Status Messages
    How to: Enable High DPI Support in a WinForms Application
    How to: Implement a Custom Messaging Class
    How to: Include an Action to a Detail View Layout
    How to: Set Images and Captions for Enumeration Values
    How to: Show a Custom Confirmation Window
    How to: Show a Custom Window with an Embedded XAF View
    How to: Show a Custom Windows Form
    How to: Use a Custom Splash Screen
    How to: Use Custom Themes in ASP.NET Applications
 [Expand]Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
[Expand]End-User Documentation

How to: Show a Custom Confirmation Window

This topic describes approaches to creating and showing a custom confirmation form. In case a specific confirmation window is required, you can design and show it using built-in XAF facilities. It is possible to display a confirmation message with additional fields in a pop-up window with the Detail View and customize a layout in code or change a default confirmation window.

This topic contains the following sections.

Expanded Using the ConfirmationMessage Property

You can change a default confirmation message for built-in or custom Actions using the ActionBase.ConfirmationMessage property.

For example, change the confirmation message for the Delete Action as demonstrated in the following code snippet.

To see the result, click the Delete Action.

Expanded Using a New Detail View

In this section, the confirmation form is a pop-up window with the DetailView of the ConfirmationWindowParameters object, which contains a confirmation message and a visible Accept button, and will be invoked in an Action’s Execute event.

  1. For example, the confirmation message, the Close and OK buttons are placed on the confirmation form. Create a class with form layout properties, such as confirmation message text and visibility of elements. Decorate this class with the DomainComponentAttribute to register it in the Types Info Subsystem. Also, use the AppearanceAttribute to declare a conditional appearance rule that is determined when the Cancel button is invisible or create this rule using the Model Editor.

  2. Open the Module.cs file in the platform-agnostic module project, add the Conditional Appearance Module to the Required Modules section, and rebuild the solution.

  3. The confirmation message will be shown in the Action's Execute event. Create a new ViewController and SimpleAction in its constructor. In the Action’s Execute event, create an IObjectSpace object, a new instance of the ConfirmationWindowParameters class, and the DetailView for this object. Set the ConfirmationWindowParameters object's properties to the required values and invoke a pop-up window with the created Detail View using the ShowViewStrategyBase.ShowViewInPopupWindow method.

The following image demonstrates this confirmation window.

Expanded Using the Messaging Class' Methods

In WinForms applications, a confirmation window can be shown using the Messaging class' methods. This class provides you with the main features to display a confirmation message with the standard set of dialog buttons (see the MessageBoxButtons).

The following code snippet demonstrates a simple example of using this approach.

The image below demonstrates the result of this implementation.

If you want to show a simple text notification, refer to the following topics:

Expanded See Also

How would you rate this topic?​​​​​​​