What is Silverlight?

Silverlight is a new Web presentation technology that is created to run on a variety of platforms. It enables the creation of rich, visually stunning and interactive experiences that can run everywhere: within browsers and on multiple devices and desktop operating systems (such as the Apple Macintosh). In consistency with WPF (Windows Presentation Foundation), the presentation technology in Microsoft .NET Framework 3.0 (the Windows programming infrastructure), XAML (eXtensible Application Markup Language) is the foundation of the Silverlight presentation capability. For more details, see Getting Started with Silverlight.

 

What is the difference between Silverlight 1.0 and Silverlight 2.0?

Silverlight 1.0 is a cross-browser, cross-platform plug-in allowing rich media experiences and interactive applications for the Web. Silverlight 2.0 extends the 1.0 plug-in by also including a light-weight .NET framework. This light-weight .NET framework supports the C# and Visual Basic programming languages.

 

Why was Silverlight 1.1 changed to Silverlight 2.0?

Previously, Microsoft had been referring to the .NET-enabled Silverlight release as "Silverlight V1.1".  After stepping back and looking at all the new features in it, they realized that calling it a point release doesn't reflect the true nature of it. Consequently, they decided to change the name and refer to it as "Silverlight V2.0" going forward. For more details, see Scott Gu’s blog.

What platforms does the Silverlight 1.0 Plug-in support?

The runtime is available for Microsoft Windows and Mac OS X, with Linux support under development via the third-party Moonlight runtime.

 

How do I control the Silverlight 1.0 Plug-in?

You control the Silverlight 1.0 Plugin using the JavaScript programming language. Specifically, see the Client Reference section of the Microsoft AJAX Library.

 

What is the Silverlight client namespace?

Sys.UI.Silverlight. For preview information about the Silverlight client namespace, see the ASP.NET 3.5 Extensions Preview.

 

Can I completely control the Silverlight Plug-in using client script?

Yes. For more information, see the section title Using Client Script with the MediaPlayer Control of the topic titled ASP.NET MediaPlayer Server Control.

 

Where can I find out more about the JavaScript syntax and capabilities?

The ASP.NET web site details the Microsoft AJAX Library and has a Client Reference section that is helpful. For more information about AJAX, see the ASP.NET AJAX Roadmap.

 

Are there server side controls for Silverlight?

Yes. These are also in development based on the time of this blog post. For preview information about the Silverlight server namespace and controls, see the ASP.NET 3.5 Extensions Preview.

 

What are the Silverlight ASP.NET Controls?

System.Web.UI.SilverlightControls.MediaPlayer

This control provides a XAML-based player that runs media (movie or audio) in an ASP.NET Web page. The player can be represented through a number of pre-defined skins. The Media server control inherits from the Sys.Web.UI.SilverlightControls.Silverlight control. For more information see, the ASP.NET 3.5 Extensions Preview.

System.Web.UI.SilverlightControls.Silverlight

This control provides a way to integrate Silverlight in an ASP.NET Web page. This control inherits from System.Web.UI.Controls.WebControl, and implements System.Web.UI.IScriptControl. The Silverlight server control uses XAML in combination with the Silverlight plug-in and the JavaScript Sys.UI.Silverlight.Control class. Unlike the MediaPlayer server control, the Silverlight server control is generic and is not designed only to manage media files. For more information see, the ASP.NET 3.5 Extensions Preview.

 

*** Of course, the above information contains preview details. Details may change.

 

What is the difference between the MediaPlayer server control and the Silverlight server control?

The MediaPlayer control inherits from the Silverlight control. The MediaPlayer control offers ways to play media in a skin (frame with controls). The skin can be modified. It is XAML.

 

What DLL are the Silverlight server controls contained in?

System.Web.Extensions.dll. Note the latest version at the time of this blog post is version 3.6.

 

How do I use the ASP.NET MediaPlayer server control?

To use the MediaPlayer server control, you reference a media source file and select a built-in skin.

The following example shows the declarative markup for a MediaPlayer server control with property settings.

<asp:MediaPlayer runat="server" ID="Media1"

   ScaleMode="Stretch"

   AutoPlay="true"

   MediaSource="MyVideoFile.wmv"

   PluginBackColor="blue"

   MediaSkin="Professional"

   Height="240"

   Width="320" />

The MediaPlayer control creates the Sys.UI.Silverlight.MediaPlayer client script class (based on the model used in the ASP.NET AJAX Extensions) that provides a JavaScript programming model to control the client player. By default, the Silverlight client player is the Silverlight 1.0 browser plug-in. For more information, see ASP.NET MediaPlayer Server Control.

 

What does the MediaPlayer server control use as its source?

The MediaPlayer control supports a variety of media file types, including .wmv, .wma and .mp3.

 

What is a MediaSkin file?

The MediaSkin is the frame for the media. It is XAML based. If you want to change the appearance of the MediaPlayer control's rendered skin, you can create your own XAML markup in a .xaml file. You can then reference the .xaml file by setting the MediaSkin property of the MediaPlayer control.

 

How do I use the ASP.NET Silverlight server control?

The following example shows the markup for a Silverlight server control that defines a simple calculator in XAML. The logic for interacting with the XAML is defined in a separate JavaScript class. The Silverlight server control references the file that contains the XAML markup (Calculator.xaml). You can also see how to reference the client-script library (Calculator.js) for the calculator code, and how to reference the JavaScript class (Custom.Calculator).

<asp:ScriptManager ID="ScriptManager1" runat="server">

  <Scripts>

    <asp:ScriptReference Name="SilverlightControl.js" />

    <asp:ScriptReference Path="calculator.js" />

  </Scripts>

</asp:ScriptManager>

 

<asp:Silverlight runat="server" ID="Silverlight1"

    Height="340"

    Width="320"

    Source="calculator.xaml"

    ClientType="Custom.Calculator"

    OnClientPluginError="onXamlError">

In its basic form, the Silverlight server control provides a JavaScript type that includes members such as the pluginLoaded event and the pluginError event. The Silverlight server control references a XAML file through the Source property. The code for interacting with the XAML can be in a managed-code assembly or in a client JavaScript library (.js file).

 

What does the Silverlight server control use as its source (the information it renders)?

XAML.

 

What is XAML?

XAML simplifies creating a UI for the .NET Framework programming model. You can create visible UI elements in the declarative XAML markup, and then separate the UI definition from the run-time logic by using code-behind files, joined to the markup through partial class definitions. The ability to mix code with markup in XAML is important because XML by itself is declarative, and does not really suggest a model for flow control. An XML based declarative language is very intuitive for creating interfaces ranging from prototype to production, especially for people with a background in web design and technologies. Unlike most other markup languages, XAML directly represents the instantiation of managed objects. This general design principle enables simplified code and debugging access for objects that are created in XAML. For more information, see XAML Overview.

What tools can I use to help me create XAML files?

Microsoft Expression Blend. For more information, see Silverlight QuickStart

Using Microsoft Expression Blend, Expression Blend and Expression Blend and Design – Team Blog.

 

 

Let me know if this information is helpful. I'll add aditional details.

 

Erik Reitan

Programming Writer - ASP.NET User Education