It's been on my mind for a while. Let's say that I have a simple app made in WPF with single rectangle inside a canvas. I can move this rectangle with Canvas.Left and Canvas.Top on mousemove. But let's say I want also to change colour of this rectangle, based on some calculation and change its width and height. I can do that by binding dependency properties from my viewmodel. However, as my project progress, my viewmodel became bigger and bigger. I would love to encapsulate some of its logic in separated objects. So i create a class for my Rectangle, containing properties like background, posX, posY, width and height.
The thing is, all those properties are view specific. In other words, this object isn't belonging to buisness logic of application (If I understand those concepts well, I'm still learning). So the question is, where I should contain class of this object? In model or in a helper layer of MVVM.
Thanks for answers.
Rectangle
with posX, posY, color. In Vm you have implementation of your model with bindings to the view. If your viewmodel becomes too big you can refactor elements that are more common, such us e.g.CalculatePositionOffset
could be in other class if it can calculate pos offset for other things too. Sometimes vm's are big, that just how it is. – FCin