[Expand]General Information
[Expand]WinForms Controls
[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
[Collapse]eXpressApp Framework
 [Expand]Getting Started
  [Expand]Application Solution Components
  [Expand]Business Model Design
  [Expand]Application Model
  [Collapse]UI Construction
    UI Element Overview
    Windows and Frames
    Action Containers
     Ways to Show a View
     List View Column Generation
     List View Columns Customization
     List View Bands Layout
     List View Edit Modes
    [Expand]List View Data Access Modes Overview
     Mobile Detail View Layout
     Display Properties of a Referenced Object in the Master Object's View
   [Expand]View Items
    List Editors
    Ways to Access UI Elements and Their Controls
    Add and Override Images
    Text Notifications
    Ways to Show a Confirmation Dialog
    ASP.NET Web Application Appearance
    Ways to Customize a Mobile Application
    Application Personalization
    Using a Custom Control that is not Integrated by Default
    XAF Mobile Wrappers for DevExtreme Widgets
   [Expand]Splash Forms
  [Expand]Controllers and Actions
  [Expand]Data Manipulation and Business Logic
  [Expand]Security System
  [Expand]System Module
  [Expand]Extra Modules
  [Expand]Debugging, Testing and Error Handling
  [Expand]Application Life Cycle
 [Expand]Design-Time Features
 [Expand]Task-Based Help
  Frequently Asked Questions (FAQ)
 [Expand]API Reference
[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)

Ways to Show a View

Typically, Views are displayed in response to user input, e.g., when a menu item is clicked. This topic lists the approaches you can use to create and show a View.

Expanded Show a View from the Navigation

The Navigation System is visualized by the navigation control, which lists all available Views and provides means to activate the required View. The navigation structure defines the Views order and hierarchy.

Note that in Mobile applications, only the Default group's nodes are displayed.

Add a View to the Navigation in Code

The simplest way to add a List View to the navigation is to apply the DefaultClassOptionsAttribute attribute to the business class. As a result, a new navigation item is added to the Default group.

You can also use the NavigationItemAttribute for the same purpose. The difference is that this attribute allows you to specify the navigation group, while the DefaultClassOptions attribute always adds an item to the Default group.

You can use the DefaultClassOptions and NavigationItem attributes to show List Views only. Proceed to see how to show other View types.

Add a View to the Navigation in the Designer

You can use the Model Editor to add a List View, Detail View or a Dashboard View to the navigation. The NavigationItems node defines the tree-like structure of navigation items using IModelNavigationItem child nodes. Create a new NavigationItem node within the existing hierarchy and set the IModelNavigationItem.View property to the target List View to show this View from navigation.

To show a Detail View from navigation, you should additionally specify the IModelNavigationItem.ObjectKey property value.

A complete example is available in the Add an Item to the Navigation Control tutorial.

Expanded Show a View Using an Action

You can show a specific View when a user clicks a custom Action. Technically, the navigation system is also an Action (see ShowNavigationItemController.ShowNavigationItemAction). When you show a View from navigation, this View is created automatically. However, when you use a custom Action, you will require one of the following methods to create a View object.

The View can be shown before an Action execution (e.g., to collect user input required to proceed), and after the execution (e.g., to display certain resulting data).

Show a View Before an Action's 'Execute' Event Occurs

If you are required to show a View before an Action is executed, use the PopupWindowShowAction Action. In this Action type, the PopupWindowShowAction.CustomizePopupWindowParams event is triggered first. Then, the pop-up window is displayed. Finally, the PopupWindowShowAction.Execute event is raised when the OK button is clicked in the pop-up. You can handle the CustomizePopupWindowParams event to create and configure the displayed View.

The complete example for List View is available in the Add an Action that Displays a Pop-up Window tutorial. For an example of how to create and show a Detail View, refer to the How to: Create and Show a Detail View of the Selected Object in a Popup Window topic.

Show a View After an Action is Executed

In this case, you can use one of the following Action types.

Handle the Action's Execute event, access the ActionBaseEventArgs.ShowViewParameters argument and pass the View to the ShowViewParameters.CreatedView property.

The ShowViewParameters object also allows configuring other parameters of the displayed View, such as the target window type, template type and associated Controllers. For example, you can specify that the View passed to the ShowViewParameters.CreatedView property should be shown in a pop-up window. Refer to the ShowViewParameters class topic for additional information.

If you want to display a simple text notification on executing the Action, use the ShowViewStrategyBase.ShowMessage method.


The PopupWindowShowAction also passes the ShowViewParameters.CreatedView parameter to its Execute event handler. A View passed to this property will be shown when the DialogOK Action is executed in the pop-up window.

To learn more about using these Actions, refer to the Add a Simple Action, Add an Action with Option Selection and Add a Parametrized Action topics.

Expanded Show a View from a Custom Context

Showing a View using an Action is the most convenient and recommended approach. However, in certain rare scenarios, you may be required to show a View that is not associated with any Action. In this instance, create a View using the XafApplication.CreateListView, XafApplication.CreateDetailView or XafApplication.CreateDashboardView method. Then, you can pass the created View object to one of the following methods.

Expanded Non-Persistent Views Specifics

Views of non-persistent objects can be shown using the same techniques. However, you should manually provide data for these views before showing them. Examples:

Expanded Show a Custom non-XAF Form

You can design a custom form or user control in Visual Studio and add them to your XAF application. In most cases, you can create a Controller and show the form on an Action's Execute event.

For more information, refer to the following articles:

Expanded See Also

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