Go to DotNetFunda.com
 Online : 860 |  Welcome, Guest!   Login
 
<<= Please see left side tutorials menu.


ASP.NET Tutorials | Report a Bug in this Tutorial

Interesting?   Share and Bookmark this

Silverlight TextBlock element tutorials
Silverlight supports TextBlock that allows you to place text into your Silverlight objects.
 
DEMO : TextBlock element Show Source Code
To simply write any text inside the Silverlight object, you need to specify the Text property of the TextBlock element.
<Canvas 
    xmlns="http://schemas.microsoft.com/client/2007" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <TextBlock Text="DotNetFunda.com" />
</Canvas>                 
                    
Common properties of TextBlock element
FontSize allows you to specify the font size of the text.
FontFamily allows you to specify the font names, separated by comma. If the 1st couldn't find, Silverlight will render the text in next font.
FontStyle> allows you to specify the style of the text.
FontWeight allows you to specify the weight of the text.
FontStretch allows you to specify the stretch pattern of the text.
Foreground allows you to specify the color of the text.
Opacity allows you to specify the alpha or transparency of the text.
<Canvas 
    xmlns="http://schemas.microsoft.com/client/2007" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <TextBlock FontSize="20" FontFamily="Arial, Verdana"
      FontStyle="Oblique" FontWeight="Bold" Canvas.Top="20" Canvas.Left="20"
       FontStretch="ExtraCondensed" Foreground="Red" Opacity=".5" >
        DotNetFunda.com
  </TextBlock>
 </Canvas>
                    
Run / LineBreak
Runelement allows you to change the look of specific text inside the TextBlock.
LineBreak allows you to place the text into next line. New line text can be specified inside Run element, otherwise TextBlock properties will be applied to the text.
<Canvas 
    xmlns="http://schemas.microsoft.com/client/2007" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <TextBlock FontSize="15" FontFamily="Arial, Verdana" Canvas.Left="5"
              FontStyle="Oblique" FontWeight="Bold" Canvas.Top="20"
               FontStretch="ExtraCondensed" Foreground="Red" Opacity=".75" >
    Silverlight <Run FontSize="25" Foreground="Blue" FontStyle="Normal">Tutorials</Run>
    <LineBreak />
    <Run FontFamily="Trebuchet MS, Arial" Foreground="Blue" 
        FontStyle="Normal" FontWeight="Thin">
         written by 
        </Run>
        Sheo Narayan
      </TextBlock>
  </Canvas>                    



About Us | The Team | Advertise | Contact Us | Feedback | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you found copied contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
All rights reserved to DotNetFunda.Com. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
(Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher)