I have an application which has a drawing surface, where actions the user takes correlate strongly to the position of the mouse cursor. For the sake of example, let's say I'm trying to implement paste. In this case, the pasted data should be placed roughly in the center of the viewport from the user's prospective.
However, a concept like a "viewport" is a view concern, not a viewmodel concern. But the action to paste is a viewmodel concern, not a view concern.
How should this scenario be designed for MVVM systems?
Since there is no mouse position property you can bind (for which you would use
Mode=OneWayToSource), you could listen to theMouseMoveevent:Before you say that's not MVVM because it uses code-behind, from http://msdn.microsoft.com/en-us/library/gg405484(v=pandp.40).aspx
As pointed out another method could be to use a CallMethodAction to bind event invocations to a call a method on your ViewModel:
However I prefer not to use a binding here as the event will be raised very frequently and a binding will involve more overhead.