Friday, November 21, 2008

Silverlight Tips

Question: If the image is larger than its container, it will pass through the border of its container. How can I restrict the size of the image (or other objects)?

Answer:
Clip the object using Canvas.Clip



Question: How do I animate a object to simulate the zoom function?

Answer:
Set the Scale Transform and then use a storyBoard to control the ScaleX and ScaleY.
Remember to put the storyboard inside the Canvas.Resources (Assume you use Canvas here)

Question: How should I make an object disappear?

Answer:
Setting the object's opacity to zero is not a good way.

The following code should be used:
texbox.visibility = Visibility.Colapsed

Other articles you may be interested:

http://msdn.microsoft.com/en-us/library/cc295092.aspx

http://silverlight.net/forums/t/9422.aspx

No comments: