There has been a talk around Windows 7 phone and so I thought I would start looking into Silverlight. So lets begin at the beginning: Silverlight is an add-on that allows the the use of images, sound and video on various platforms such as Windows 7 phone or the web. Since the point of this really is to learn, I will be learning at the same time.
To get started with Silverlight you will need the following tools:
- Visual Studio 2010 (you can download the express version here)
- Expression Blend 2010
- Silverlight toolkit. These are the tools you will need for building apps for windows phone as well as the general Silverlight tools that contain their controls.
Basics of Silverlight:
Silverlight is primarily made of of xaml and normal code. Xaml stands for Extensible Application Markup Language. This resembles aspx webforms look and feel. You would define xaml objects and modify them in code.
Setting up a Silverlight Solution:
- Open Visual Studio 2010.
- Click on New Project.
- Select Silverlight application, and enter in your project name. In this case I have selected “Basic”.
- Enter in the Web project name. By default there will be a name based on the solution name: “SolutionName.Web”.
- This should build the solution and create a web project automatically. To start with we will create a very simple form that changes the text of a label on a button click event.
- Click and drag a label and button onto the the design surface, Set the Name properties of both controls. To set the text field you would need to change the Content property.
- Setting events works in the same way as events in aspx webforms. Set the Event Handler on the control and create the event handler in the behind code.
- All that there is left to do is run the app.
I will continue going further into Silverlight each week so that we can learn the more advanced features.