How to move a Silverlight Rectangle?
I want to say rect1.X++ to move a rectangle as a timer event is activated… It’s easy to change the height like rect1.Height++;
Is there some easy way to do this without having to deal with complex matrices?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to use a TranslateTransform to move an element:
You can then reference it in code:
However, the “correct” way (and also the way you can do other things like animate the translation) would be to set the values for the transform in the VisualStateManager and use
VisualStateManager.GoToState()instead of manipulating the values in code directly like above.