[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Collapse]Application UI Manager
   [Collapse]Deferred Load
     Deferred Load
   [Expand]Interaction with Dock Panels
   [Expand]Bar and Ribbon Merging
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Deferred Load

If your view contains many documents, you may want to use the deferred load feature. The main idea of the deferred load is that you initially create "empty" documents and provide content for them later, via an event that fires when an empty document is about to be displayed. The deferred load approach allows you to significantly reduce the application start-up initialization time, but navigation through documents will be a little slower compared to the direct content loading approach via the BaseView.AddDocument method.

Documents must be empty (i.e., have no content) to trigger the deferred load mechanism.

At runtime, you can create empty documents via the BaseView.AddDocument method overload without the Control parameter. At design time, you can create empty documents via the Document Manager Designer. Switch to the 'Documents' tab and add documents via the "Add New Document" button.

To specify the content (of any control) for an empty document, handle the BaseView.QueryControl event. This event is the first one triggered by the deferred load mechanism when an empty document is about to be displayed. It fires on application start-up (when displaying the first "empty" document), and each time an end-user activates another "empty" document (for instance, by clicking a tab header in the TabbedView). To set the content for the document, assign a control to the event's Control parameter, as shown below.

After a document's content has been displayed, the BaseView.ControlShown event fires.

By default, the deferred load mechanism persists the document content when the document is unselected. For instance, when switching from one tab to another in the TabbedView, the previously activated tab's contents are not destroyed by default. In the NativeMdiView, document content is never destroyed.

If you want to unbind a document's content, handle the BaseView.ControlReleasing event and set the event's KeepControl parameter to false. For this document, the BaseView.QueryControl event will repeatedly fire when the document is activated again. By default, unbound content is automatically destroyed.

When handling the BaseView.ControlReleasing event, you also have the option to unbind a document from its content without destroying the content itself so you can pass it to another document. This can be accomplished by setting the event's KeepControl and DisposeControl parameters to false.

After a control has been unbound from its parent document, the BaseView.ControlReleased event is raised.

The diagram below demonstrates this event sequence.

The following code from DevExpress BarTutorials ('Deferred Load' demo) illustrates how to use the BaseView.QueryControl and BaseView.ControlReleasing events:

When you need to populate multiple similar Documents, you can specify their BaseDocument.Tag property. Then, when handling the QueryControl event, you can check these tags and depending on their values pass a required content to a current Document. The code below illustrates how to pass different detail User Controls depending on the employee department.

Navigation through documents can be accompanied by a load indicator (see the figure below). Its availability is specified via the BaseView.UseLoadingIndicator property. You can access a loading indicator's appearance settings using the BaseView.LoadingIndicatorProperties property.

Expanded See Also

Is this topic helpful?​​​​​​​