Specifies the type of the View, for which a View Controller is intended.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v19.2.dll
Type | Default | Description |
---|---|---|
ViewType | Any |
A ViewType enumeration value identifying a View type. |
Type | Default | Description |
---|---|---|
ViewType | Any |
A ViewType enumeration value identifying a View type. |
Type | Default | Description |
---|---|---|
ViewType | Any |
A ViewType enumeration value identifying a View type. |
View Controllers can be activated for both List and Detail Views. You can use the TargetViewType property to provide View Controller activation within the List, Detail, or any type of View.
The TargetViewType property affects only ViewController's activation. Controller.FrameAssigned and other events that are irrelevant to the view type always fire.
Alternatively, you can implement the generic ViewController<ViewType> Controller instead of the ViewController and specify the View's type, for which this Controller is intended, in the ViewType generic parameter. In this case, you do not need to perform an additional cast when you access the View.
The example below demonstrates how to add a PopupWindowShowAction to all List Views in an application.
using System;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
// ...
public class ShowListViewController : ViewController {
public ShowListViewController() {
TargetViewType = ViewType.ListView;
PopupWindowShowAction showListViewAction = new PopupWindowShowAction(this, "ShowListView",
PredefinedCategory.Edit);
showListViewAction.CustomizePopupWindowParams += ShowListViewAction_CustomizePopupWindowParams;
}
private void ShowListViewAction_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e) {
Type objectType = typeof(Person);
e.View = Application.CreateListView(objectType, true);
}
}
Imports System
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Actions
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Public Class ShowListViewController
Inherits ViewController
Public Sub New()
TargetViewType = ViewType.ListView
Dim showListViewAction As New PopupWindowShowAction(Me, "ShowListView", PredefinedCategory.Edit)
AddHandler showListViewAction.CustomizePopupWindowParams, _
AddressOf ShowListViewAction_CustomizePopupWindowParams
End Sub
Private Sub ShowListViewAction_CustomizePopupWindowParams(ByVal sender As Object, _
ByVal e As CustomizePopupWindowParamsEventArgs)
Dim objectType As Type = GetType(Person)
e.View = Application.CreateListView(objectType, True)
End Sub
End Class