Editar

Partilhar via


Binding.IsAsync Property

Definition

Gets or sets a value that indicates whether the Binding should get and set values asynchronously.

public:
 property bool IsAsync { bool get(); void set(bool value); };
public bool IsAsync { get; set; }
member this.IsAsync : bool with get, set
Public Property IsAsync As Boolean

Property Value

The default is false.

Remarks

Use the IsAsync property when the get accessor of your binding source property might take a long time. One example is an image property with a get accessor that downloads from the Web. Setting IsAsync to true avoids blocking the UI while the download occurs.

While waiting for the value to arrive, the binding reports the FallbackValue, if one is available, or the default value of the binding target property.

However, there should not be many scenarios where you need to use the IsAsync property. The .NET guidelines recommend against defining properties that are orders of magnitude slower than a field set would be. When you are creating your class, consider handling extremely slow operations outside of the get accessor and caching the result.

Applies to

See also