Back to Devexpress

View.Model Property

expressappframework-devexpress-dot-expressapp-dot-view-37b9d3d7.md

latest4.2 KB
Original Source

View.Model Property

Provides access to information on a View, which is stored in the Application Model.

Namespace : DevExpress.ExpressApp

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
public virtual IModelView Model { get; }
vb
Public Overridable ReadOnly Property Model As IModelView

Property Value

TypeDescription
IModelView

An IModelView object representing the current View’s Application Model node.

|

Remarks

Use this property to get the current View‘s properties which are stored in the Application Model as attribute values.

By default, the Model property is set when a View is created.

To learn how to customize the Application Model, refer to the Extend and Customize the Application Model in Code help topic. To learn how to use the Application Model in code, refer to the Access the Application Model in Code help topic.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Model 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.

xaf-save-and-share-custom-view-settings/CS/EFCore/ViewSettingsEF/ViewSettingsEF.Module/Controllers/ViewVariantsController.cs#L37

csharp
if(isDefaultViewSelected) {
    UpdateDefaultSettings(savedView.Model);
    isDefaultViewSelected = false;

xaf-how-to-save-the-currently-opened-view-as-a-new-view-variant-at-runtime/CS/EF/ViewVariantSaveEF/ViewVariantSaveEF.Module/Controllers/UserViewVariantsController.cs#L141

csharp
IModelVariant newModelViewVariant = ((ModelNode)rootModelViewVariants).AddNode<IModelVariant>(newViewVariantId); // Adds a new child node of the IModelVariant type with a specific identifier to the parent IModelViewVariants node.
newModelViewVariant.View = ((ModelNode)modelViews).AddClonedNode((ModelNode)View.Model, newViewVariantId) as IModelView; // Creates a new node of the IModelView type by cloning the settings of the current View and then sets the clone to the View property of the view variant created above. Beware of the specificity described at Q411979.
newModelViewVariant.Caption = parameter.Caption; //Sets the Caption property of the view variant created above to the caption specified by an end-user in the dialog.

See Also

View Class

View Members

DevExpress.ExpressApp Namespace