You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm trying to use the AsyncCommand with CanExecute, but I'm not sure how to revalidate the CanExecute.
I'm calling RaiseCanExecuteChanged, but it is not working.
Anyone could help me?
I'm using Xamarin.Forms v5.0
The text was updated successfully, but these errors were encountered:
Hi Pedro,
I run into the same issue myself...I guess the problem is that the IAsyncCommand interface (in the NuGet package) is missing the RaiseCanExecuteChanged() method, while the mvvm-helpers repository has it.
So in order to update the CanExecute method every time a property changes, you have to declare the command using the class, not the interface. The class has the method, the interface does not.
internal class CheckViewModel : ViewModelBase
{
private AsyncCommand CheckCommand { get; }
//private IAsyncCommand CheckCommand {get;}//doesn't work
public CheckViewModel()
{
CheckCommand = new AsyncCommand(CheckOfficeExists, CanCheckOfficeExists);
this.PropertyChanged += (_, _) => CheckCommand.RaiseCanExecuteChanged();
}
Hi,
I'm trying to use the AsyncCommand with CanExecute, but I'm not sure how to revalidate the CanExecute.
I'm calling RaiseCanExecuteChanged, but it is not working.
Anyone could help me?
I'm using Xamarin.Forms v5.0
The text was updated successfully, but these errors were encountered: