Skip to main content
.NET 6.0+

ViewController.TargetViewId Property

Specifies the identifier of the View for which the View Controller is activated, or a semicolon-separated list of identifiers if a View Controller targets multiple Views.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

[DefaultValue("Any")]
public string TargetViewId { get; set; }

Property Value

Type Default Description
String "Any"

A string value that is a View identifier or a semicolon-separated list of View identifiers.

Remarks

By default, the TargetViewId property is set to “Any” (the ActionBase.AnyCaption constant value) which means that the View Controller is activated for any View. You can specify the identifier of a View to enable View Controller activation for a specific View. You can also specify multiple target Views by separating their identifiers by a semicolon (;). The Controller will be activated for each listed View. The TargetViewId value is passed to the Application Model‘s IModelViewController.TargetViewId property.

The example below demonstrates how to add a SimpleAction to the Department_ListView List View only.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
// ...
public class AddSimpleActionController : ViewController {
    public AddSimpleActionController() {
        TargetViewId = "Department_ListView";
        SimpleAction departmentAction = new SimpleAction(this, "DepartmentAction", PredefinedCategory.Edit);
    }
}
See Also