[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Collapse]Application UI Manager
    [Expand]Widget View
    [Collapse]WindowsUI View
     [Collapse]Getting Started
       How To: Create a Message Box Flyout With User Control
       How To: Create a Modal Message Box Flyout
       How To: Create a Page Container
       How To: Create a PageGroup Container
       How To: Create a Pop-up Flyout
       How To: Create a SlideGroup Container
       How To: Create a SplitGroup Container
       How To: Create a TabbedGroup Container
       How To: Create a TileContainer
       How To: Pass Specific Data when Navigating Through Containers
       How To: Create Content Containers Hierarchy
      Content Containers
      Navigation Bars
      WindowsUI Buttons
      Search Panel
      Application Hierarchy and Module Navigation
     Tabbed View
     Native MDI View
     Document Selector
     Non-Document Mode
   [Expand]Deferred Load
   [Expand]Interaction with Dock Panels
   [Expand]Bar and Ribbon Merging
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst 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]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How To: Create a Message Box Flyout With User Control

The How To: Create a Modal Message Box Flyout and How To: Create a Pop-up Flyout examples demonstrate how to add a Flyout that contains either a Document or a FlyoutAction. In this example, the Flyout contains both a Document and an Action. Such Flyouts are designed to display complex message boxes with user controls and custom buttons.

  1. Create a new WindowsUI View application or open an existing one.
  2. Open the DocumentManager's context menu and run the Designer.

  3. Switch to the 'Elements' section and select 'Content Containers'. Click the 'Add New Container' button and choose 'Flyout' from the drop-down list.

  4. Select the newly created Flyout and change its name to userConrolFlyout via the property grid.
  5. In the Visual Studio Solution Explorer window, right click your project and select 'Add', then 'Add New Item' and choose a User Control. Change its name to ucAddCustomer and click 'OK'. Add four text boxes and labels onto your user control as shown below:

  6. Switch back to the Document Manager Designer. Open the 'Elements' section, choose 'Documents' and click the 'Populate' button. A document for your user control will be created automatically. Change its name to addCustomerDocument. Note that a corresponding Tile appears as well. You can remove it in the 'Elements' - 'Tiles' section.
  7. Call the BaseView.AddDocument method and pass a new ucAddCustomer class instance to this method as a parameter. See the Documents topic for more info.

  8. Now pass the created user control to the Flyout. To do so, assign the addCustomerDocument object to the Flyout.Document property.

  9. Add a WindowsUI button to your start-up Content Container. See the WindowsUI Buttons topic for more info.

  10. Next, handle the Content Container's BaseContentContainer.ButtonClick event. Use the WindowsUIView.ActivateContainer method to display the Flyout.

  11. Launch your application and click the WindowsUI Button. The result should be similar to the following:

    As you can see, even if the IFlyoutDefaultProperties.Style property value equals FlyoutStyle.MessageBox, the Flyout is displayed as a pop-up. This occurs because no message box buttons were specified. The easiest way to add message box buttons is to use standard button sets via the Flyout.FlyoutButtons property. Set this property to YesNo and see the result.

    Note that you may want something more flexible than standard button sets. In this example, 'Yes' and 'No' buttons do not perfectly fit the displayed content. In this case, use FlyoutActions.

  12. Create a FlyoutAction and specify its UIActionPropertiesCore.Caption. Add a standard 'Cancel' button to its FlyoutAction.Commands collection.

  13. Add your own custom button by creating a FlyoutCommand class descendant, and overriding the required properties.

  14. Now you can add your custom button to the FlyoutAction.

    The last step is to assign your action to the Flyout via the Flyout.Action property.

  15. Launch your application to view the results:

  16. To get which Flyout Button an end-user has clicked, handle the WindowsUIView.FlyoutHidden event.

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