Skip to main content
.NET Framework 4.6.2+

XafApplication.DelayedViewItemsInitialization Property

Indicates whether View Items controls are initialized immediately when a View is created.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

[Browsable(false)]
[DefaultValue(true)]
public bool DelayedViewItemsInitialization { get; set; }

Property Value

Type Default Description
Boolean true

true, if View Item controls are initialized once they are visible to end-users; false, if View Item controls are initialized once a View is created. The default value is true.

Remarks

When this property is set to true, controls corresponding to View Items will not be created immediately after the root control of the View is created. Instead, they will be created only once they are visible to end-users. Complex Property Editors will also create their Frame and View only when their respective controls are created. Since their Frame, View and Control properties are null before the editors are visible, that leads to a potential problem in your code. So, instead of handling the View.ControlsCreated and ViewController.ViewControlsCreated events to access a View Item’s control, you should ensure that you are not accessing the properties mentioned above before the controls are created. In order to bypass any possible problems, you should handle the ViewItem.ControlCreated event of the required View Item or test whether the properties accessed are null.

You can change the default value of the DelayedViewItemsInitialization property in the XafApplication descendant’s constructor implemented in the default WinForms, ASP.NET Web Forms, and ASP.NET Core Blazor application project. For instance, here is the code for the Windows Forms application.

public partial class MySolutionWindowsFormsApplication : WinApplication {
    public MySolutionWindowsFormsApplication() {
        InitializeComponent();
        DelayedViewItemsInitialization = false;
    }
    // ...
}

To change this behavior for an individual View, use the CompositeView.DelayedItemsInitialization property.

See Also