Back to Devexpress

ViewItem Class

expressappframework-devexpress-dot-expressapp-dot-editors-8be60226.md

latest8.3 KB
Original Source

ViewItem Class

Represents a base class for View Items.

Namespace : DevExpress.ExpressApp.Editors

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
public abstract class ViewItem :
    IDisposable
vb
Public MustInherit Class ViewItem
    Implements IDisposable

The following members return ViewItem objects:

Remarks

The ViewItem class implements basic functionality for items that can be contained in a Detail View. This functionality includes:

  • The capability to display View Items via a specified control in a UI. Basically, a Detail View’s representation in a UI is a set of controls that display View Items.

  • A View Item can be related to the object that the parent Detail View presents. For instance, the PropertyEditor, being the ViewItem class’ descendant, represents the properties of the object presented by the Detail View.

  • A View Item can be refreshed when the parent Detail View is refreshed. Refreshing is assumed to be data related.

  • The capability to save the current settings of the control to the Application Model, so that the next time the control is created the same settings are used.

To access the Detail View in which a View Item is contained, use the ViewItem.View property.

XAF ships with the following descendants of the ViewItem class:

To implement a custom View Item, inherit from the ViewItem class. The following protected members that are not described in the documentation can be overridden:

MemberDescription
CreateControlCoreCalled by the ViewItem.CreateControl method. You should return the control that will represent your View Item in a UI.
SaveModelCoreCalled by the ViewItem.SaveModel method. You can override it to save the settings of a View Item and its control to the Application Model. This allows display of the View Item in the same manner as it was before it was recreated.
DisposeCalled by the ViewItem.Dispose method. Override it if you need to dispose custom allocated resources.
OnCurrentObjectChanging and OnCurrentObjectChangedCalled when the ViewItem.CurrentObject property is changed.
OnControlCreating and OnControlCreatedCalled when a control (see ViewItem.Control) is created. Raise the ViewItem.ControlCreating and ViewItem.ControlCreated events.

Note

A custom View Item should be implemented in a platform-specific application project and decorated with the ViewItemAttribute. This View Item will be loaded to the Application Model, which means that you will be able to use it in a UI.

For details on View Items and basics on how to implement custom ones, refer to the View Items and How to: Implement a View Item topics.

To access a View Item of the View for which a Controller is activated, handle the Controller.Activated and ViewItem.ControlCreated events, as it is demonstrated in the following article: Access the Settings of a Property Editor in a Detail View.

Inheritance

Show 19 items

Object ViewItem BlazorDashboardViewerViewItem

WinDashboardViewerViewItem

ActionContainerViewItem

DashboardViewItem

PropertyEditor

StaticImage

StaticText

ControlViewItem

BlazorControlViewItem

BlazorPropertyEditorBase

WinPropertyEditor

WinActionContainerViewItem

DXPropertyEditor

StaticImageViewItem

StaticTextViewItem

BlazorActionContainerViewItem

StaticTextViewItem

See Also

ViewItem Members

How to Add an Unbound Control (Button) to the Form Layout in an XAF View (with a Built-in ActionContainerViewItem)

ViewItemAttribute

DevExpress.ExpressApp.Editors Namespace