Back to Devexpress

Asynchronous Data Loading (Windows Forms)

expressappframework-401747-ui-construction-views-asynchronous-data-loading-asynchronous-data-loading.md

latest5.8 KB
Original Source

Asynchronous Data Loading (Windows Forms)

  • Dec 04, 2025
  • 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.

Prerequisites

You should use ThreadSafeDataLayer in your application to enable asynchronous data loading. To use this data layer, follow the steps below:

  1. Open the Startup.cs file and locate the AddXpo method.
  2. Set the ThreadSafe option to true.
csharp
builder.ObjectSpaceProviders
    .AddXpo((application, options) => {
        options.ConnectionString = connectionString;
        options.ThreadSafe = 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

How to: Customize Asynchronous Data Loading Behavior and UI (Windows Forms)