Following MVVM principles, I am attempting to fire a command in my view-model when a button in the view is clicked.
I have a valid view and a valid view-model and the view-model is set as the DataContext
for the view. To verify that I have a working binding to the view-model, I have created a Label
, which I can successfully bind to a string property on the view-model. When I add the binding for the Button.Command
, I get a completely useless error that says: 'Error while resolving expression: One or more errors occurred.'
Interestingly, I get this error if I define the type of the command as an ICommand
. If I define it as Command
, I don't get the error (but it still doesn't work).
One thing I wondered about is that I have defined my own ICommand
interface to avoid pulling System.Windows.Input
into my core logic module. And I have created my own concrete classes Command
and Command<T>
that implement the interface. Does this matter? It certainly didn't use to. I know this because I am currently recreating the whole project from another Xamarin.Forms application in which all of this commanding stuff was working just fine.
Anyone got any ideas? It would be nice even to get some communication from the binding engine. I love the idea of data binding but it seems to either work or not work and never seems to give useful information when it is not working.
- Patrick