Question. I want to call a ViewModel-Command from my View. The problem I have is: The Command parameter can't be bound. Let's say. User clicks an Item. And I want to pass to my ViewModel Command a object which contains the properties: CurrentEntity, PositionX, PositionY. (It's a graphic oriented application. That's why I pass the X,Y positions to my viewmodel. I have to store the values in DB.) Now how would you solve that problem? How do you bind the Command from View and pass this specific command parameter object?
What I've done for now: I have a special interface which the Command definition which is implemented by the VM. THen... in my view (code-behind) I cast the DataContext to this Command-interface and then I call the Command from code behind (event handler). But it doesn't really make sense... Because in that case I could just call a simple ViewModel function. (If I don't need the CanExecute functionality) Is that a good design? What I dont like is... that some Command bindings are in XAML and some in code-behind. It's a bit confusing from a architectural perspective.
Am I clear enough?
Thanks