Skip to main content
.NET Standard 2.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.v22.1.dll

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);
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the TargetViewId property.

Note

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.

See Also