Getting Started with WP7 Development: Learning Siverlight

This post aims to present a structured collection of resources for developers wanting to get started developing for Windows Phone 7 in Silverlight, but don’t have any Silverlight or WPF experience. I’m also aiming this post at peopleĀ  who’ve started developing for WP7 without too much WPF/Silverlight experience and would like to learn more about the framework to move on.

Why Silverlight?

Developing for Windows Phone 7 can be done using two frameworks: Silverlight and XNA. XNA is a framework targeting game development. Those who are looking to develop either games or graphically intensive applications are advised to use that framework.

Silverlight, on the other hand started off as a web application framework, a “web” light version of Windows Presentation Framework (WPF), the successor of Windows Forms. Microsoft decided to support Silverlight as the other application development framework on Windows Phone 7 next to XNA, specifically version 3.0 with some extra libraries. It’s safe to say that if one’s goal isn’t game development, the obvious (and easier) choice is to develop applications in Silverlight for WP7.

What is Silverlight?

Silverlight is a similar framework to Adobe Flash, allowing the developer to create applications that manipulate media, are interactive all built on the .NET platform. .NET developers will be familiar with lots of the libraries used, however Silverlight introduces several new concepts and libraries. With Out Of Browser support and Windows Phone 7 development announced, Silverlight is no longer just a web framework, but more an application development platform.

Some useful resources on understanding what Silverlight is:

Developer tools

Silverlight development can be done with Visual Studio 2008 and upwards, I’d recommend using Visual Studio 2010 – a free, express version is available for use. Expression Blend is an additional tool that makes creating the UI much easier.

If you’re planning on doing WP7 development, download the developer tools for WP7 which will either install the expression version of Visual Studio 2010 and a phone version of Expression Blend or if VS and Expression Blend are already installed, it will just add the new supported project types and the emulator.

Understanding how Silverlight Works

There are some key areas anyone from an OO background needs to understand to be able to develop with Silverlight.

XAML

XAML (eXtensible Markup Language) is the markup language for Silverlight. A Silverlight page always consists of a XAML file (the markup) and a code behind file (the logic). Understanding how XAML works is vital to developing any Silverlight applications.

Some useful resources that give on overview of XAML are:

Silverlight Controls

Building a Silverlight application involves with creating pages, then adding visual elements and controls to them. Silverlight has mostly the same controls as WPF – for someone who’s not worked with any of these, getting to know the basic controls can be challenging. The most important Silverlight controls to get to know are the following:

  • Layout controls. Most important ones are Canvas, Grid and StackPanel.
  • Input & selection: Button, CheckBox, ComboBox, RadioButton, Slider, TextBoxc
  • Text display: TextBlock

The easiest way to explore the tools is to either add them on an example project in Visual Studio 2010 from the toolbox or in Expression Blend. There are also some good resources covering what the individual controls are designed for:

Styling and templating

Visuals are important in Silverlight and as such, the framework has good support for customization of visual elements. This customization can be done by using Styles on elements or by setting the Template of some controls.

Some resources on understanding styling and templating:

Dependency Properties

Dependency properties are new kinds of properties Silverlight (and WPF) introduces: compared to the standard properties (the CLR properties) they provide additional services: change notification, binding, styling and resetting to default value.

Most of the properties on visual elements are dependency properties meaning they can be bound to, styled and change can be detected on them. Dependency properties are mostly used in bindings and styling – a lot of developers not even always aware that they’re using DPs. Understanding how they work is a stepping stone to understanding how MVVM works.

Some resources on understanding what dependency properties are:

MVVM

When writing larger Silverlight applications it’s important both to separate different parts of the application, such as the model, the view and the in between layer and also to be able to test the application as much as possible. The recommended way of designing larger Silverlight (and WPF) applications is using the MVVM: Model-View-ViewModel pattern.

This patterns shows some similarities to the MVC (Model-View-Controller) pattern in terms that it also separates the model and the view. However instead of the controller layer, something different, a ViewModel layer is used which acts as a wrapper around the model, presenting it to the view. The pattern very heavily relies on bindings that are available in Silverlight (and WPF).

Anyone planning on creating a more complex Silverlight application or working on an application with a team should understand and be able to use this pattern. Some good resources on learning MVVM are the following:

MVVM can be implemented on its own, but for more complex applications it’s worth using an MVVM framework that has most of the infrastructure implemented. If you’re looking into developing in WP7, the obvious choice is MVVM Light, the only MVVM framework at the moment I’m aware of that works on WP7, Silverlight and WPF.

Unfortunately there are few resources on MVVM Light – you’ll have to explore a lot on your own to master it. The few helpful ones I’m aware of are the following:

Other great tutorials

Others have put together great tutorials that help getting started with Silverlight. Some of the ones I’m aware of are the following:

Conclusion

This post aimed to collect useful resources for those wanting to gain some understanding of Silverlight before jumping on to develop for Windows Phone 7 using it, hope you found it useful.

In my next post I’ll be presenting a similar list of resources specifically about developing for Windows Phone 7.

7 Responses to Getting Started with WP7 Development: Learning Siverlight
  1. Trackback: DotNetShoutout
    Getting Started with WP7 Development: Learning Siverlight... Thank you for submitting this c... dotnetshoutout.com/Getting-Started-with-WP7-Development-Learning-Siverlight
  2. [...] Getting Started with WP7 Development: Learning Siverlight [...]... weblogs.asp.net/yuanjian/archive/2010/09/30/cheatsheet-2010-09-16-09-30.aspx
  3. [...] The blog of Gergely Orosz on Silverlight, .NET and other IT related topics. Follow me @gergelyorosz on T... gregdoesit.com/2010/10/getting-started-with-wp7-development-learning-the-wp7-ecosystem
  4. [...] Source : http://gregdoesit.com/2010/09/getting-started-with-wp7-development-learning-siverlight/ [...]... dotnet.rvduren.nl/?p=43
  5. ellipse

    Thanks alot. Well put. Just what i needed.

  6. creative magazine... [...]Greg Does IT » Blog Archive » Getting Started with WP7... takula.net/2012/03/page/2