Skip to main content
All docs
V25.1
  • SimpleButton.AsyncDisplayMode Property

    Gets or sets how the button indicates the progress of an asynchronous operation.

    Namespace: DevExpress.Xpf.Core

    Assembly: DevExpress.Xpf.Core.v25.1.dll

    NuGet Package: DevExpress.Wpf.Core

    Declaration

    public AsyncDisplayMode AsyncDisplayMode { get; set; }

    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 IsCancellationRequested property is changed to true.

    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:

    SimpleButton - Async Operations

    <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);
            }
        }
    }
    
    See Also