Creating Hello World in Silverlight 2 - Page 2
       by kirupa  |  27 March 2008

In the previous page, we started creating our Hello World app and made quite a bit a progress by drawing a textfield on our design surface. In this page, let's pick up from where we left off and continue making more modifications:

  1. First, let's customize our text a little bit. Select your textblock, and make sure you are displaying your Properties panel by clicking on the Properties tab found towards the top-right of your window:

[ click on the Properties tab to see all of the properties available for your textblock ]

  1. Your Properties panel contains all of the various knobs and buttons you can tweak to modify your selected control. The Properties panel is also categorized to help you find similar sets of properties.
     
    We want to change both the font used and the font size, so let's find the Text category where we can accomplish both of those tasks:

[ find the Text category which contains....text properties! ]

  1. From your Text category, find the font size drop-down menu. Click on that menu and select a large number such as 36:

[ change your font size to 36 ]

  1. From this same area (to the left of your font size drop-down menu), you will also see a drop-down menu to select which font your text will be displayed in. The default is usually Arial, but let's change it to Trebuchet MS.

    Click on the font drop-down menu, and select Trebuchet MS:

[ select the Trebuchet MS font ]

After having made both your font and font size changes, your textblock's text will look a little bit different now:

[ your textblock's text reflects the new font modifications you made ]

  1. All this time, we have been making modifications to a textblock control that displays the text TextBlock. Let's change our text to actually say hello, world.

    In your Properties Panel, find your Text property. It will be located inside the Common Properties category which is located directly above your Text category:

[ find the Text property under Common Properties ]

  1. Change the displayed TextBlock text to instead say hello, world. Once you have done that, press Enter to accept your changes. Your textblock will now look like the following:

[ your textblock no longer says TextBlock ]

  1. If you are curious to see how this looks in your browser, simply hit F5 or go to Project | Test Solution. A few seconds later, your browser will launch with your hello, world text displayed:

[ you can preview your creation in your browser ]

We are making great progress, and the light at the end of the tunnel is now visible! We'll wrap things up on the next page!

Onwards to the next page!

1 | 2 | 3




SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple.