mercredi 6 mai 2015

MVVM C# Logic and view in the same function

I've a form with an image component : Image
I would like to get real mouse position in this image.
For that I use the formule below which is located in a function

mouseXInImage = MouseXInComponent / ComponentWidth  * ImageSourceWidth
mouseYInImage = MouseYInComponent / ComponentHeight * ImageSourceHeight 

ComponentWidth and ComponentHeight are part of the view. So my question is about MVVM pattern : Where should be this function ?

In the code behind ? (because of the view, but there are logic too)
In the view model ? (because of the logic, but there are view)

Thanks

Aucun commentaire:

Enregistrer un commentaire