You are right that the provided custom service is working when the the shapes are being moved using the mouse. In order to implement such restriction whenever the Position
(or any other) property is being changed you can check the value of the property exposed by your ViewModel
before changing it.
For example lets take the Width
property in your ViewModel
. Lets say that it should not be greater than 90 pixels. Hence, you can change it only when the Value
in the setter of that property is lower than 90, if equal or greater you can set it to 90.
In other words - when using MVVM approach you can implement custom logic in your ViewModel
to verify that the properties (Position, Height, Width...) are in the desired range.
Please give this approach a try and let us know if you have any other questions.
Pavel R. Pavlov
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>