wpf-devexpress-dot-xpf-dot-core-dot-simplebutton-c36a49e8.md
Gets or sets how the button indicates the progress of an asynchronous operation.
Namespace : DevExpress.Xpf.Core
Assembly : DevExpress.Xpf.Core.v25.2.dll
NuGet Package : DevExpress.Wpf.Core
public AsyncDisplayMode AsyncDisplayMode { get; set; }
Public Property AsyncDisplayMode As AsyncDisplayMode
| 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 IsCancellationRequested property is changed to true.
|
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);
}
}
}
Imports DevExpress.Mvvm
Imports System.Threading.Tasks
' ...
Public Class ViewModel
Inherits ViewModelBase
Public ReadOnly Property AsyncCommand As IAsyncCommand
Public Sub New()
AsyncCommand = New AsyncCommand(AddressOf AsyncMethod)
End Sub
Private Async Function AsyncMethod() As Task
While Not AsyncCommand.IsCancellationRequested
Await Task.Delay(100)
End While
End Function
End Class
See Also