This is a mirror of official site: http://jasper-net.blogspot.com/

Creating a Silverlight Application that uses navigation framework and Viewbox control

| Tuesday, August 10, 2010
Introduction:

The objective of this article is to present the Viewbox control. I have also explained here the navigation framework of Silverlight 3.
Viewbox Control:

This control is a content decorator.

It can resize its content based on its own size.

It takes one child element.
The most important property of Viewbox control is the Stretch property. It can take four values:
Fill: When the Stretch property of the Viewbox control is set to Fill, the content of the Viewbox takes up the entire height & width of the Viewbox.

Uniform: When the Stretch property of the Viewbox control is set to Uniform, the Viewbox scales up/down or moves left/right its content without distorting them or changing their height/width ratio.

UniformToFill: When the Stretch property of the Viewbox control is set to UniformToFill, the content of the Viewbox fills the entire Viewbox, but at the same time the height/width ratio of the content remains same.

None: When the Stretch property of the Viewbox control is set to None, it just clips to the original content without resizing it.
Another important property of the Viewbox is StretchDirection. It can take three values.
UpOnly: When the StretchDirection property of the viewbox is set to UpOnly, the viewbox can only enlarge its content.
 
DownOnly: When the StretchDirection property of the viewbox is set to DownOnly, the viewbox can only shrink its content.

Both: When the StretchDirection property of the viewbox is set to Both, the viewbox can both enlarge and shrink its content.
Navigation Framework:

Using navigation framework, we can navigate between different xaml pages by clicking even the browser's Back & Forward button, if there is browser history associated with that.

Now I am creating a sample to explain the above mentioned points.

Step 1:

Create a new Silverlight application.

Read more: C# Corner

Posted via email from .NET Info

0 comments: