08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

402<br />

CHAPTER 16 ■ PROGRAMMING SILVERLIGHT WITH XAML AND JAVASCRIPT<br />

Figure 16-6 shows the example—a simple yet addictive memory game where you<br />

have to repeat a sequence of colors. Each time you succeed, the sequence will repeat with<br />

one new color added. See how high you can go before you forget the sequence. My record<br />

is 17!<br />

Figure 16-6. <strong>Silverlight</strong> memory game<br />

Designing the Game XAML<br />

The first step in building a game like this is to create the XAML. This can be built using<br />

the Expression Blend tool (www.microsoft.com/expression).<br />

When using Blend, first create a new project, using File ➤ New Project (see<br />

Figure 16-7).<br />

You’ll see an option to create a <strong>Silverlight</strong> 1.0 site, which creates a file system web site<br />

(not an IIS one) containing everything you need to get up <strong>and</strong> running with <strong>Silverlight</strong>.<br />

The .<strong>NET</strong> Orcas option is for the <strong>Silverlight</strong> 1.1./2.0 preview only.<br />

Once you’ve done this, you’ll have a project containing a XAML page (Page.xaml) <strong>and</strong><br />

its associated code-behind (Page.xaml.js), which can be used for the design <strong>and</strong> the<br />

implementation, respectively.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!