Breaking Change T917390
Visible to All Users

The IDelegateCommand and IAsyncCommand interfaces have been moved to the DevExpress.Mvvm namespace

What Changed

In v20.1 and earlier versions, the IDelegateCommand and IAsyncCommand interfaces were in a namespace for internal use - DevExpress.Mvvm.Native.
In v20.2, we have moved these interfaces to the public DevExpress.Mvvm namespace.
Currently the declaration is as follows:

C#
namespace DevExpress.Mvvm { public interface IDelegateCommand : ICommand { void RaiseCanExecuteChanged(); } public interface IAsyncCommand : IDelegateCommand { bool IsExecuting { get; } CancellationTokenSource CancellationTokenSource { get; } bool IsCancellationRequested { get; } ICommand CancelCommand { get; } Task ExecuteAsync(object parameter); //Legacy and hidden API [EditorBrowsable(EditorBrowsableState.Never)] bool ShouldCancel { get; } //Legacy and hidden API [EditorBrowsable(EditorBrowsableState.Never)] void Wait(TimeSpan timeout); } }
Visual Basic
Namespace DevExpress.Mvvm Interface IDelegateCommand Inherits ICommand Sub RaiseCanExecuteChanged() End Interface Interface IAsyncCommand Inherits IDelegateCommand ReadOnly Property IsExecuting As Boolean ReadOnly Property CancellationTokenSource As CancellationTokenSource ReadOnly Property IsCancellationRequested As Boolean ReadOnly Property CancelCommand As ICommand Function ExecuteAsync(ByVal parameter As Object) As Task '''Legacy And hidden API <EditorBrowsable(EditorBrowsableState.Never)> ReadOnly Property ShouldCancel As Boolean '''Legacy And hidden API <EditorBrowsable(EditorBrowsableState.Never)> Sub Wait(ByVal timeout As TimeSpan) End Interface End Namespace

Reasons for Change

We have public functions that return an IDelegateCommand or IAsyncCommand object. In previous versions, public APIs returned objects declared in a namespace for internal use (DevExpress.Mvvm.Native):

C#
namespace DevExpress.Mvvm.POCO { public static class POCOViewModelExtensions { ... public static IDelegateCommand GetCommand<T>(this T viewModel, Expression<Action<T>> methodExpression) { ... } public static IAsyncCommand GetAsyncCommand<T>(this T viewModel, Expression<Func<T, Task>> methodExpression) { ... } } }
Visual Basic
Namespace DevExpress.Mvvm.POCO Module POCOViewModelExtensions ... <Extension()> Function GetCommand(Of T)(ByVal viewModel As T, ByVal methodExpression As Expression(Of Action(Of T))) As IDelegateCommand ... End Function <Extension()> Function GetAsyncCommand(Of T)(ByVal viewModel As T, ByVal methodExpression As Expression(Of Func(Of T, Task))) As IAsyncCommand ... End Function End Module End Namespace

These functions are used in POCO ViewModels. In addition to these methods, we implemented similar functions in ViewModelBase in v20.2:

C#
namespace DevExpress.Mvvm { public abstract class ViewModelBase : BindableBase { ... protected IDelegateCommand GetCommand(Expression<Action> commandMethodExpression) { ... } protected IAsyncCommand GetAsyncCommand(Expression<Func<Task>> commandMethodExpression) { ... } } }
Visual Basic
Namespace DevExpress.Mvvm Public MustInherit Class ViewModelBase Inherits BindableBase ... Protected Function GetCommand(ByVal commandMethodExpression As Expression(Of Action)) As IDelegateCommand ... End Function Protected Function GetAsyncCommand(ByVal commandMethodExpression As Expression(Of Func(Of Task))) As IAsyncCommand ... End Function End Class End Namespace

How to Update Existing Apps

If you encounter a compilation error - "IDelegateCommand or IAsyncCommand could not be found", check that you referenced the DevExpress.Mvvm namespace in the files where this error occurs:

C#
using DevExpress.Mvvm;
Visual Basic
Imports DevExpress.Mvvm

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.