SimpleButton.AsyncDisplayMode Property
Gets or sets how the button indicates the progress of an asynchronous operation.
Namespace: DevExpress.Xpf.Core
Assembly: DevExpress.Xpf.Core.v24.2.dll
NuGet Package: DevExpress.Wpf.Core
Declaration
Property Value
Type | Description |
---|---|
AsyncDisplayMode | Specifies how the button indicates the progress of an asynchronous operation. |
Available values:
Name | Description |
---|---|
None | Asynchronous operations are executed without a visual indication. |
Wait | The button displays the wait indicator during the asynchronous operation. |
WaitCancel | The button displays the wait indicator and changes it to the cancel button when a user hovers the mouse pointer over the wait indicator. If a user presses the cancel button, the associated asynchronous command’s |
Remarks
The SimpleButton control can indicate whether an asynchronous operation is in progress. To enable this behavior, set the SimpleButton.AsyncDisplayMode
property to Wait
or WaitCancel
:
<dx:SimpleButton Content="Async Button"
AsyncDisplayMode="WaitCancel"
Command="{Binding AsyncCommand}"/>
using DevExpress.Mvvm;
using System.Threading.Tasks;
// ...
public class ViewModel : ViewModelBase {
public IAsyncCommand AsyncCommand { get; }
public ViewModel() {
AsyncCommand = new AsyncCommand(AsyncMethod);
}
async Task AsyncMethod() {
while(!AsyncCommand.IsCancellationRequested) {
await Task.Delay(100);
}
}
}