Technologies come and technologies go, but every so often a technology appears, destined for great things. For me personally Silverlight is one of these technologies. I believe Silverlight will take web applications into the next generation, not alone, but alongside Flash and JavaFX, and whilst there may not be a coherent standard for these technologies, the technologies will shine through. The ability to write c#, or vb.net code, instead of JavaScript is one of the most compelling reasons for adopting Silverlight 2.0 – In a nutshell any Web Developer, or even Windows Developer can transition to Silverlight 2.0 without having to learn new technologies, and understand JavaScript or browser specific Implementations.
So, when I was asked to review Manning’s upcoming “Silverlight in Action” book – I jumped at the chance. I do have the advantage of knowing the subject matter, but I learnt stuff in this book and I’m sure you will too.
So let’s dive into each chapter and see where we are heading.
Chapter 1 – Introducing Silverlight
This chapter starts off with the positioning of Silverlight, It’ covers the Why’s of Silverlight, and then talks about the performance versus Flex and Java Swing and it’s cross platform and cross browser support. It then moves on to the Designer/Developer relationship and how Silverlight solves this problem. We then dive into XAML (eXtensible Application MarkUp Language) and shows the relationship between the XAML markup code and the C# and vb.net code behind. In essence you could create all your XAML in code, but why not let a tool, such as Expression Blend or Design create that for you in a format which it and you can understand (XAML). This chapter then dives in pretty deep with the nuts and bolts, around namespaces, partial classes, compound and attached properties before getting the reader to get their hands dirty with a short walkthough of creating an application in Visual Studio and Blend. The only real absence here is letting the user know what they need to download and where to get it from. At the end of chapter one, we understand the problems that Silverlight solves, and have built an application – nice start!
Chapter 2 – Harmony with the Web.
In this chapter we cover the integration between the Silverlight plug-in and HTML . I can’t help but think that this chapter should have appeared later in the book. The author made a great job in chapter 1 of getting the reader comfortable with the technology and it’s environment, and I think the chapter on layout (3) – would have been better to follow this. You can in essence build a Silverlight application in Visual Studio blissfully unaware of all the plumbing behind the scenes. Sure, you’ll need it at some point, and it’s important, but i’d have left this towards the end of the book. This chapter talks about where the Silverlight plugin sits within the HTML document model, an exploration of the Silverlight.js file, window and windowless modes, the properties available off the Silverlight Plugin and how the Silverlight plugin can access the HTML object model,CSS styling information and querystring values from within managed code. The chapter then ends with talking to the Silverlight plugin from Javascript.
Chapter 3 – Back to Basics – Layout
Chapter 3 talks about the layout options available to the user. The Chapter starts with coverage of the Canvas control, which, in early releases used to be the default container, when you created a new Silverlight Page. The Canvas allows absoluter positioning, useful for games etc. The Author takes us through canvas layout and ZIndex ordering before moving onto the stackpanel and then onto the new default container – The Grid. The Grid section covers layout and how the renderer allocated space to the grid rows and columns. It then goes on to describe simple and advanced font usage, before dropping down to FrameWorkElement level, to show properties common to most of the controls. One of the issues facing developers trying to understand XAML is layout – this Chapter provides you with all the information you need to get going with XAML.
Chapter 4 – User Input
This chapter covers keyboard and mouse input, including Drag and Drop functionality. It then covers managing the TextBox and the InkPresenter control, which captures ink strokes. We then explorer the rest of the Silverlight control set, including the new for Beta 2 – Tab Control, and covering the Popup control and the FileDialog – Chapter 4 is another good solid chapter well worth the time.
Chapter 5 – Databinding
Frowned upon in Windows forms and used with care in Web applications, DataBinding in Silverlight/WPF is a first class citizen – something everyone should be using. It starts of discussing the BindingContext, before moving on to the types of DataBinding – OneWay, OneTime and TwoWay, Binding to different types of Object/Collection and also an explanation of Converters. It then looks at another powerful feature of XAML – DataTemplates – allows complete control over the UI presented to the user. WPF developers will have to wait for .NET V3.5 sp1 for the DataGrid, but Silverlight has it now. A large section of this chapter is devoted to this beast, using, configuring and customising the DataGrid. The remainder of this chapter is devoted to LINQ.
Chapter 6
Manning only sent me 11 chapters of the book and Chapter 6 is the one which was missing – I can’t comment on this chapter, but the Table of Contents says it covers the Networking Stack and communication
Chapter 7 – Multimedia
Chapter 7 covers MultiMedia – Audio and Video, it’s events, lifetimes and properties – Media is huge in Silverlight – I’ve spent some time in this – It also covers something I use a lot in my presentations on Silverlight – The MarkerReached event on a media element. I’d have like to have seen a small amount of space devoted to Encoder here, and an example on how it can be utilised – this is huge for Education! We then discuss full screen mode, and the security implications – The book states that NO keyboard input is allowed – this is actually incorrect as arrow keys, space bar etc are allowed, although this is a very recent change (Beta2) and has not been publicised much. This chapter then moves on to protected content, images and the use of DeepZoom through the MultiScaleImage control, before rounding off with different ways to ‘stretch’ images to fill their allotted space.
Chapter 8 – Graphics
This chapter takes us on a journey through all the drawing objects supported through Silverlight – Lines, Rectangles, Ellipses, Paths, and geometries. Generally you’d let Blend/Design do all the hard work here, but it’s good to know what’s going on under the covers. We then look at the different kinds of brushes you can use to ‘fill’ these object – Solid, LinearGradientBrush, RadialGraidentBrush, ImageBrush and VideoBrush, not Basil Brush ?, before we look at all the Transforms available to use, to adjust our shape. The chapter then rounds off with a nice little walkthrough of using Blend to create this, before firing up Visual Studio to perform some additional transformations in code – proof that anything you can do in Blend you can do in code.
Chapter 9 – Animations
Now we have all our shapes – we can animate them using TimeLines and that’s what Chapter 9 covers – this kind of stuff is best left to hardened pros and/or Blend. Animations can get complex quickly, but this chapter explains this complex XAML topic with simple examples – again, it’s worth reading so if you ever have to identify the XAML you’ll know where to look and what to look for! It then moves onto StoryBoards as a way to control animations, and storing all this information as Resources. We are then treated to KeyFrames and Interpolation types and TimeSpans.
Chapter 10 – Templates and Styling
Just like with HTML and CSS, Silverlight has best practices around Styling, which is covered in this chapter – it talks about Styling controls, and using resources to hold this styling information. It’s then in this chapter where we come across Silverlight functionality, which only appeared in Beta 2 – and thankfully the author, who could have ignored it, devoted half a chapter to the VisualStateManager. The VisualStateManager is destined for WPF too, but Silverlight has it first – It allows an easy way to change the Visual Representation of a control, taking into account – States, such as GotFocus, LostFocus, Clicked, Hover etc, along with the transitions between the different states – All this is supported in Blend 2.5 June Preview – and my only criticism is that this is so easy in Blend it would have been nice for a Blend based tutorial.
Chapter 11 - Enhancing the Experience.
This chapter is the bucket to throw all the other stuff, which doesn’t fit in anywhere else. It covers Isolated Storage, and correctly picks up on the subtle Beta 2 change to a default of 1MB storage from 100KB – Isolated storage is covered comprehensively in this chapter, and then we move onto Reading XAML at Runtime – allowing for Dynamic Content. The BackgroundWorker is another item discussed, which is good for the Silverlight developer tool belt. It then covers the WebClient, downloading Custom Fonts, reading compressed packages and loading/instantiating assemblies at runtime. It then covers dynamic languages – not something I’ve personally bought in to, so I skipped this bit.
Chapter 12 – Deployment and Distribution
This final chapter in the book covers UserControls – you’ll soon be needing these, A Framework for navigation in Silverlight – something I’m hoping will come in future releases out of the box – like ASP.NET. It then covers creating a Splash Screen – which has a few quirks, but you’ll soon have to do one, and final hosting your Silverlight Application on Microsoft’s Silverlight Streaming Services.
Conclusion
Silverlight has now reached Beta 2, and has started to settle, but prior to that, the API changed with every release and I can only think Chad Campbell was pulling his hair out sometimes, having to re-write sections, and even chapter of his book.
The book itself is written in an easy to follow style, covering all the elements of Silverlight you need to get up and running, while answering those questions in the back of your mind.
There will inevitably be a huge amount of books on Silverlight, but judging this one on its own – The others will have some work to do!
Want the Book? - people signed up to NxtGenUG can leave a comment and if I come across one I like, relating to Silverlight or Technology around it - I'll give you the book (when/If I get the final version)!