Introduced
Silverlight 4.0 Control Overview:
* Viewbox-a container control in which there can be only one child element. Viewbox can determine how the child elements inside are stretched, scaled, aligned
* RichTextBox-Editor. Used to display or edit text, hyperlinks, pictures, UI elements, and so on
Online Demo
Http://www.cnblogs.com/webabcd/archive/2010/08/09/1795417.html
Example
1, Viewbox's Demo
Viewboxdemo.xaml
Code
<navigation:page x:class= "Silverlight40.Control.ViewboxDemo"
Xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"
Xmlns:d= "http://schemas.microsoft.com/expression/blend/2008"
Xmlns:mc= "http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigation= "Clr-namespace:system.windows.controls;assembly=system.windows.controls.navigation"
title= "Viewboxdemo Page" >
<grid x:name= "LayoutRoot" background= "White" >
<stackpanel background= "Antiquewhite" horizontalalignment= "left" >
<!--to demonstrate Viewbox.stretch properties-->
<stackpanel margin= "5" width= ">"
<textblock text= "Stretch"/>
<button name= "btn1" click= "Stretchnone" content= "None"/>
<button name= "btn2" click= "Stretchfill" content= "Fill"/>
<button name= "Btn3" click= "Stretchuniform" content= "Uniform"/>
<button name= "Btn4" click= "Stretchuniformtofill" content= "UniformToFill"/>
</StackPanel>
<!--to demonstrate Viewbox.stretchdirection properties-->
<stackpanel margin= "5" width= ">"
<textblock text= "Stretchdirection"/>
<button name= "Btn5" click= "stretchdirectionuponly" content= "Uponly"/>
<button name= "btn6" click= "stretchdirectiondownonly" content= "Downonly"/>
<button name= "btn7" click= "Stretchdirectionboth" content= "Both"/>
</StackPanel>
<!--to demonstrate Viewbox.horizontalalignment properties-->
<stackpanel margin= "5" width= ">"
<textblock text= "HorizontalAlignment"/>
<button name= "Btn8" click= "Horizontalalignmentcenter" content= "Center"/>
<button name= "Btn9" click= "Horizontalalignmentleft" content= "left"/>
<button name= "Btn10" click= "Horizontalalignmentright" content= "right"/>
<button name= "Btn11" click= "Horizontalalignmentstretch" content= "Stretch"/>
</StackPanel>
<!--to demonstrate Viewbox.verticalalignment properties-->
<stackpanel margin= "5" width= ">"
<textblock text= "VerticalAlignment"/>
<button name= "Btn12" click= "Verticalalignmentcenter" content= "Center"/>
<button name= "Btn13" click= "Verticalalignmenttop" content= "Top"/>
<button name= "btn14" click= "Verticalalignmentbottom" content= "Bottom"/>
<button name= "Btn15" click= "Verticalalignmentstretch" content= "Stretch"/>
</StackPanel>
<!--to display the current Viewbox Stretch value, stretchdirection value, HorizontalAlignment value, VerticalAlignment value-->
<stackpanel margin= "5" >
<textblock name= "Lblmsg"/>
</StackPanel>
<!--is used to demonstrate the various effects of Viewbox-->
<stackpanel width= "height=" background= "Black" >
<viewbox name= "Viewbox" width= "height=" >
<!--Note: Viewbox can only have one child element-->
<image source= "/resource/logo.jpg"/>
</Viewbox>
</StackPanel>
</StackPanel>
</Grid>
</navigation:Page>