To set the margin or Canvas of an object from the code you can use SetValue() which is a built-in method. SetValue() takes a DependencyProperty such as a Button, and a double value.
Example:
myButton.SetValue(Canvas.LeftProperty, myPoint.X);
In above example ‘myButton’ is a Button on the xaml, and myPoint is a variable of type Point which we use the X value of.
Posted by Damon Serji on
11. January 2010 18:36 under:
Basic