Skip to main content
All docs

Asynchronous Data Loading

  • 3 minutes to read

This article describes how to load View data asynchronously in WinForms applications. This capability allows you to keep the UI responsive while the application fetches required data. End users can navigate to another View while the operation is in progress. They can also close the tab before the View loads all data, which would then cancel the data load operation.


This feature works only in WinForms applications that use ThreadSafeDataLayer. To use this data layer in your application, follow the steps below.

  1. Open the WinApplication.cs (WinApplication.vb) file and locate the CreateDefaultObjectSpaceProvider method.
  2. Pass true as the threadSafe parameter of the XPObjectSpaceProvider/SecuredObjectSpaceProvider constructor.
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Win;
using DevExpress.ExpressApp.Xpo;
// ...
public partial class MySolutionWindowsFormsApplication : WinApplication {
    // ...
    protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args) {
        args.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(
            XPObjectSpaceProvider.GetDataStoreProvider(args.ConnectionString, args.Connection, true), true));
        // ...

You can enable this feature for Views that fit all the conditions below.

     List View

     Detail View

Enable Asynchronous Loading

Set the UseAsyncLoading property to true. The following Model Editor nodes allow you to specify this property for supported Views:

  • Navigate to the Options node to enable this feature for all Views in your application. The value you specified in this node is the default for UseAsyncLoading in the View-specific nodes.

  • Navigate to the Views | <ListView> node to enable this feature for a specific List View.

  • Navigate to the Views | <DetailView> node to enable this feature for a Detail View.

Important Notes

Detail Views

Detail Views always load associated collections in the main thread. These operations lock the UI. If you enable the UseAsyncLoading option, the View loads only its current object asynchronously. In other words, this option only helps you resolve high load times for the current object (for example, when this object has properties with complex logic or you use a remote database).

If DetailView.UseAsyncLoading is set to true, note the following:

List Views

If you enable the UseAsyncLoading option, do not manipulate a List View’s IObjectSpace until all data is loaded.

See Also