Back to Devexpress

GridRowValidationEventArgs.CancellationToken Property

wpf-devexpress-dot-xpf-dot-grid-dot-gridrowvalidationeventargs-3f6dde8b.md

latest2.3 KB
Original Source

GridRowValidationEventArgs.CancellationToken Property

Gets an object that notifies that the Update operation should be canceled.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public CancellationToken CancellationToken { get; protected set; }
vb
Public Property CancellationToken As CancellationToken

Property Value

TypeDescription
CancellationToken

An object that notifies that the Update operation should be canceled.

|

Remarks

Use the GridRowValidationEventArgs.UpdateRowResult property to specify a task that asynchronously posts changes to an underlying data source (database).

You can allow users to cancel the Update operation, for example, when they click the Cancel button. To do that, set the GridRowValidationEventArgs.UseCancellationToken property to true and use the GridRowValidationEventArgs.CancellationToken in a cancel function.

csharp
private void On_ValidateRow(object sender, GridRowValidationEventArgs e) {
    // ...
    e.UseCancellationToken = true;
    e.Register(() => DoSomethingToCancelOperation())
    e.ResultAsync = Task.Run(() => {
        // ...
        e.CancellationToken.ThrowIfCancellationRequested();
        // ...
    });
    // ...
}

See Also

GridRowValidationEventArgs Class

GridRowValidationEventArgs Members

DevExpress.Xpf.Grid Namespace