First XAML program
This first program shows how to use the Silverlight plugin to display plain text on a web page.
We'll start the tutorial with a simple example that shows the classic "Hello World!"
If you have already created an XAML project or as specified in the Silverlight tutorial, you have an HTML page mapage.html and the necessary files in the project directory.
1) Create a canevas
XAML content is placed inside Canvas tags in the Silverlight environment:
<Canvas
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</Canvas>
2) Add a text frame
The TextBlock tag lets you place text in a channel:
<TextBlock>
Salut le Monde!
</TextBlock>
3) Set attributes
You can select the font, size, color, and other text attributes.
<TextBlock
FontFamily="Verdana"
FontSize="30" >
Salut le Monde!
</TextBlock>
4) Full XAML code
<Canvas
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBlock
FontFamily="Verdana"
FontSize="30" >
Salut le Monde!
</TextBlock>
</Canvas>
5) Show Page
You can now view the mapage.html page using your browser.