expressappframework-devexpress-dot-expressapp-dot-editors-fd58d162.md
Applied to a custom View Item. Registers the View Item in the application and specifies the type of the Application Model‘s node used by the custom View Item.
Namespace : DevExpress.ExpressApp.Editors
Assembly : DevExpress.ExpressApp.v25.2.dll
NuGet Package : DevExpress.ExpressApp
[AttributeUsage(AttributeTargets.Class, Inherited = true)]
public class ViewItemAttribute :
Attribute
<AttributeUsage(AttributeTargets.Class, Inherited:=True)>
Public Class ViewItemAttribute
Inherits Attribute
To use a custom View Item in the Application Model and Views, decorate your custom View Item with the ViewItemAttribute. Pass a Model interface that extends the IModelViewItem interface or its descendant as the attribute’s parameter. This interface defines the properties available in the Application Model. When the View Item is created, the corresponding model node is passed to its constructor via the model parameter:
public MyDetailViewItem(IModelViewItem model, Type objectType) : base(objectType, model.Id) {
//...
This allows you to use the data from the corresponding Application Model’s node, to initialize and configure the View Item.
The ViewItemAttribute attribute has several parameters. So, you have the following options:
To see an example of using this attribute, refer to the Implement Custom View Items help topic.
Object Attribute ViewItemAttribute
See Also