Occurs before showing a View.
The ViewShowing event's data class is ViewShowingEventArgs. The following properties provide information specific to this event:
|SourceFrame||Provides access to the Frame for which creation of a new View was requested.|
|TargetFrame||Provides access to the Frame in which a new View will be displayed.|
|View||Returns the View to be shown.|
In many scenarios, a View is not shown in the Frames, in which the command to show this View has been performed, but in a separate Frames. Let these Frames be called a source Frame and a target Frame. When implementing custom features, you may need to pass some values from the source Frame to the target Frame. For instance, the RecordsNavigationController‘s PreviousObject and NextObject Actions displayed in a Detail View allows navigating to the previous and next record in the List View from which this Detail View has been shown. Here, the target Frame (the Frame with the Detail View) obtains information on the order of objects in the source Frame (the Frame with the List View).
To implement such feature where you need to exchange data between the source and target Frames, handle the ViewShowing and XafApplication.ViewShown events. The former event is raised before showing a View in the target Frame, the latter - after showing this View. To access the source and target Frames, use the handler’s parameters. In addition, the ViewShowing event handler provides the ViewShowingEventArgs.View parameter.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ViewShowing event.
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.