Wahlin on .NET
Introducing Silverlight 2.0
Dan gives a rundown of the newest features and controls.
I originally planned to cover XAML animation features for this week's column. However, with the release of
Silverlight 2.0 beta 1, I decided to take a quick break from XAML to discuss the new and exciting features that version 2.0 brings to the world of rich Web application development. Fortunately, all of the
XAML articles I've been writing still apply to Silverlight 2.0, though it brings a lot more to the table than just XAML, JavaScript, media and fancy animations.
Silverlight 2.0 provides a way to write C#, VB.NET and even dynamic language code that can run in the browser (Internet Explorer, Firefox and Safari) on Windows and Mac machines. It includes a subset of the namespaces and classes found in the .NET 3.5 framework and supports brand-new framework features such as Language Integrated Query (LINQ). Silverlight 2.0 applications can be built using tools such as Expression Blend 2 and Visual Studio 2008.
Microsoft officially announced Silverlight 2.0 at the MIX08 conference in Las Vegas and provided several great demos of what the product is capable of doing. Silverlight talks from MIX08 are available to view online here, with topics ranging from introductory looks at what Silverlight 2.0 offers to interacting with remote data and building custom Silverlight controls.
A great example of what can be built using Silverlight 2.0 is available at the Hard Rock Memorabilia Web site. The Hard Rock Web site uses a built-in Silverlight 2.0 technology called Deep Zoom to allow users to get a close-up view of historic rock 'n' roll items.
Infragistics also released a nice line of business applications that demonstrates what can be done with Silverlight 2.0. You can view the application and download the code here.
Silverlight 2.0 Controls
Silverlight 1.0 provides a solid framework for displaying media and shapes, animating objects and performing transformations, but it doesn't provide many built-in UI controls aside from the MediaElement and TextBlock controls.
Silverlight 2.0 fills in that gap by adding many standard controls such as TextBox, CheckBox, ListBox and Button; layout controls such as Canvas, StackPanel and Grid; and several other controls such as the Slider, WatermarkTextBox and ScrollViewer.
An online example that provides a live look at how some of the controls can be used is available here. .NET developers with Windows Forms, ASP.NET or WPF experience will find the controls simple to use, especially since you can drag them from the Visual Studio 2008 Toolbox (see Figure 1). There's certainly a learning curve (as with any new technology), but the rich features available in Silverlight 2.0 make it a worthwhile curve to conquer.
This table describes some of the main controls available in Silverlight 2.0:
Control |
Description |
Border |
Acts as a container with support for rounded corners and other border features. |
Button |
Standard button control. |
Calendar |
Standard calendar control capable of multiple display formats. |
Checkbox |
Standard checkbox control capable of handling multiple states. |
DataGrid |
Data bound control capable of showing columnar data. |
DatePicker |
Allows users to type or select dates from a calendar. |
Grid |
Layout control similar to the HTML Table tag. Capable of defining rows and columns. |
GridSplitter |
Allows grid columns and rows to be resized by an end user. |
HyperLinkButton |
Displays text that can be clicked to navigate to a target URL. |
Image |
Control used to display different types of images. |
ListBox |
Flexible control capable of displaying lists of items. |
MediaElement |
Control used to play audio or video files. |
MultiScaleImage |
Can be used in conjunction with Microsoft's Deep Zoom technology to zoom in and out of images. |
RadioButton |
Standard radio button control. |
RepeatButton |
Causes a click event to be raised until the end user releases the button. |
ScrollViewer |
Allows large content to be displayed in a confined area and viewed using scrollbars. |
Slider |
Standard slider control that can be displayed vertically or horizontally. |
StackPanel |
Layout control used to stack content/controls vertically or horizontally. |
TextBlock |
Label type control used to display text content. |
TextBox |
Standard text box control. |
ToggleButton |
Button capable of showing multiple states. |
ToolTip |
Tooltip control that can be used to display tooltips as users mouse over other Silverlight controls. |
WatermarkedTextBox |
Text box control capable of displaying watermarks to provide hints to users. |
Additional Silverlight Features
In addition to the many controls offered by Silverlight 2.0, several other key features are available. As mentioned earlier, you'll be able to choose between multiple languages when building a Silverlight 2.0 application, which adds to overall productivity. While working with your preferred language, you can still use standard Visual Studio features such as code snippets and IntelliSense.
Silverlight 2.0 applications can leverage features available in standard ASP.NET
or WPF applications such as Web Service proxy objects, the ability to make cross-domain
calls to remote URLs (REST/POX calls), support for data binding, centralized
definition of control styles, control templates and more.
While I won't provide
a complete discussion of the many new features in this article, Microsoft's
Scott Guthrie put together a great set of tutorials that walk through Silverlight
2.0 features. I've converted these tutorials into videos that can be viewed,
as well, to see the new features in action. View Scott's written tutorials and
the associated videos at the links below:
While I plan to continue covering key XAML concepts available in Silverlight 1.0 in upcoming articles, I'll start writing about new Silverlight 2.0 features as well in the near future.
About the Author
Dan Wahlin (Microsoft MVP for ASP.NET and XML Web Services) is the founder of The Wahlin Group which specializes in .NET and SharePoint onsite, online and video training and consulting solutions. Dan also founded the XML for ASP.NET Developers Web site, which focuses on using ASP.NET, XML, AJAX, Silverlight and Web Services in Microsoft's .NET platform. He's also on the INETA Speaker's Bureau and speaks at conferences and user groups around the world. Dan has written several books on .NET including "Professional Silverlight 2 for ASP.NET Developers," "Professional ASP.NET 3.5 AJAX, ASP.NET 2.0 MVP Hacks and Tips," and "XML for ASP.NET Developers." Read Dan's blog here.