To follow up on Stuart's answer, it's easy to support both ICommand.CanExecute
along with exposing properties to support Android and iOS Mvx bindings.
To do this, convert your typical CanExecute(
) methods to properties, then add handlers to CanExecuteChanged
that calls RaisePropertyChanged
on the associated property. Then use RaiseCanExecuteChanged
as normal and the PropertyChanged
event gets fired as well.
...
// constructor
public SomeClass()
{
DoSomethingCommand = new MvxCommand(OnDoSomething, () => CanDoSomething);
DoSomethingCommand .CanExecuteChanged += (sender, args) => RaisePropertyChanged(() => CanDoSomething);
}
public bool CanDoSomething
{
get { ... }
}
...