Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
SilverLight runs in the browser which is a sizeable window your users will run the browser in windows of many sizes. A good UI design will be flexible when encountering different size environments. In this movie I want to show the Viewbox control. It provides a resizable container. That stretches or shrinks its contents to match the container size. It is most often used in conjunction with the Canvas panel. For this demonstration, I will use Visual Studio in a project called ChangeSizeWithViewBox. I am currently looking at the CanvasWithoutPage.
I have a Canvas containing some vector art. This flower is composed of Silverlight elements. It is not a photo, you can see that down here there is a Canvas that contains a number of ellipses and these ellipses are centered around this center ellipses. This ellipse is also contained inside a Grid which is inside my user control. I will run the application by pressing F5 and then I'll resize the browser window, even though the container, in this case, the Grid is being resized, the Canvas is not affected. I will take that exact same Canvas over here in the CanvasWithViewBox.
I'll wrap it inside this Viewbox control, there it is and I will place the Viewbox inside the Grid and the Grid goes inside the User control. With that simple change, I can now run the application, click on the WithViewBox tab, and now you see that the canvas is resizing. The elements retain their positions relative to each other. The Viewbox is just growing and shrinking the content of that canvas. When you need to size the contents of the Canvas, look to the Viewbox.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 98095 Viewers
61 Video lessons · 85367 Viewers
71 Video lessons · 69378 Viewers
56 Video lessons · 101735 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.