Occurs before showing a View.
public event EventHandler<ViewShowingEventArgs> ViewShowing
Public Event ViewShowing As EventHandler(Of ViewShowingEventArgs)
The ViewShowing event handler receives an argument of the ViewShowingEventArgs type. 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.