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
 [Collapse]Concepts
  [Expand]Application Solution Components
  [Expand]Business Model Design
  [Expand]Application Model
  [Collapse]UI Construction
    UI Element Overview
    Windows and Frames
   [Expand]Templates
    Action Containers
   [Collapse]Views
     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
     Display Properties of a Referenced Object in the Master Object's View
   [Expand]View Items
    List Editors
    Add and Override Images
    Text Notifications
    ASP.NET Web Application Appearance
    Application Personalization
    Using a Custom Control that is not Integrated by Default
  [Expand]Extend Functionality
  [Expand]Data Manipulation and Business Logic
  [Expand]Security System
  [Expand]Localization
  [Expand]System Module
  [Expand]Extra Modules
  [Expand]Debugging and Error Handling
  [Expand]Filtering
  [Expand]Application Life Cycle
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Deployment
 [Expand]Task-Based Help
 [Expand]Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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 popup window is displayed. Finally, the PopupWindowShowAction.Execute event is raised when the OK button is clicked in the popup. 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 for the configuration of other parameters of the displayed View, such as the target window type, template type and associated Controllers.

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

Note

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 popup 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 See Also

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