First Program with Expression Blend

Once the project created, making a first program with Expression Blend is of a disconcerting facility.

The main window of the tool has two side vertical tags, Design and XAML.
- Design displays the visual mode in which one places graphic components and then one modifies the properties, while
- XAML displays the corresponding source code.

Go to the XAML panel, the following code has been automatically generated with the project:

<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	x:Class="UntitledProject1.Window1"
	x:Name="Window"
	Title="Window1"
	Width="640" Height="480">
 <Grid x:Name="LayoutRoot"/>
</Windows>

If you already have read the chapter First XAML program in the Silverlight tutorial, you will note that here the top container is a window and not a canvas, as it is the case for a Web page.

In addition, the contents is included into an empty Grid tag:

<Grid x:Name="LayoutRoot"/>

It is in this tag where we will put out code, it thus has to be opened:

<Grid x:Name="LayoutRoot">

</Grid>

Let us take again the code which we used in the previous chapter and place it into the container:

<Grid x:Name="LayoutRoot">
    <TextBlock
       FontFamily="Verdana"
       FontSize="30" >
           Hello World!
    </TextBlock>
</Grid>

The code is saved with both the Ctrl and S keys pressed, which causes a syntax check of our code.
Our first program is finished! It remains to compile it.
To build the program, open the Project menu and click on the first command: Build Project. Check that there is no error message in the window at bottom.

If the following message is displayed, all is perfect:

Build completed

To launch our program, click on the last line of the same menu: Test project.
You should get the following window:


The binary executable program (.exe) is stored in the sub-directory bin\Debug, in the directory of your project.
(c) 2007-2008 Denis Sureau. Scriptol.com