共用方式為


Silverlight Architecture

Microsoft Silverlight will reach end of support after October 2021. Learn more.

This topic describes the essential architecture and components of Microsoft Silverlight. Silverlight is not only an appealing canvas for displaying rich and interactive Web and media content to end users. It is also a powerful yet lightweight platform for developing portable, cross-platform, networked applications that integrate data and services from many sources. Furthermore, Silverlight enables you to build user interfaces that will significantly enhance the typical end user experience compared with traditional Web applications.

While Silverlight as a client-side runtime environment seems simple and compact in size, the Silverlight development platform integrates a number of features and complex technologies, making them accessible for developers. To create effective Silverlight-based applications, developers need a working knowledge of the platform architecture.

NoteNote:

Silverlight supports two programming models: the JavaScript API for Silverlight and the managed API for Silverlight. The managed API is based on a subset of the .NET Framework. Many of the features in this article are supported only by the managed API. For more information,  see Application and Programming Models.

This topic contains the following sections.

  • The Silverlight Platform
  • Core Presentation Components
  • The .NET Framework for Silverlight
  • Additional Silverlight Programming Features
  • Related Technologies and Tools
  • Related Topics

The Silverlight Platform

The Silverlight platform as a whole consists of two major parts, plus an installer and update component, as described in the following table.

Component

Description

Core presentation framework

Components and services oriented toward the UI and user interaction, including user input, lightweight UI controls for use in Web applications, media playback, digital rights management, data binding, and presentation features, including vector graphics, text, animation, and images. Also includes the Extensible Application Markup Language (XAML) for specifying layout.

.NET Framework for Silverlight

A subset of the .NET Framework that contains components and libraries, including data integration, extensible Windows controls, networking, base class libraries, garbage collection, and the common language runtime (CLR).

Some parts of the .NET Framework for Silverlight are deployed with your application. These "Silverlight Libraries" are assemblies not included in the Silverlight runtime and are instead shipped in the Silverlight SDK. When Silverlight Libraries are used in your application, they are packaged up with your application and downloaded to the browser. These include new UI controls, XLINQ, Syndication (RSS/Atom), XML serialization, and the dynamic language runtime (DLR).

Installer and updater

An installation and update control that simplifies the process of installing the application for first-time users, and subsequently provides low-impact, automatic updates.

The following illustration shows these components of the Silverlight architecture, along with related components and services.

Silverlight architecture

SilverLight Architecture

There is a particular value in the combined set of tools, technologies, and services included in the Silverlight platform: They make it easier for developers to create rich, interactive, and networked applications. Although it is certainly possible to build such applications using today's Web tools and technologies, developers are hindered by many technical difficulties, including incompatible platforms, disparate file formats and protocols, and various Web browsers that render pages and handle scripts differently. A rich Web application that runs perfectly on one system and browser may work very differently on another system or browser, or may fail altogether. Using today's large array of tools, protocols, and technologies, it is a massive and often cost-prohibitive effort to build an application that can simultaneously provide the following advantages:

  • Ability to create the same user experience across browsers and platforms, so that the application looks and performs the same everywhere.

  • Integration of data and services from multiple networked locations into one application using familiar .NET Framework classes and functionality.

  • A media-rich, compelling, and accessible user interface (UI).

  • Silverlight makes it easier for developers to build such applications, because it overcomes many of the incompatibilities of current technologies, and provides within one platform the tools to create rich, cross-platform, integrated applications.

Core Presentation Components

The core presentation features of the Silverlight platform, shown in the previous section and illustration, are described in the following table.

Feature

Description

Input

Handles inputs from hardware devices such as the keyboard and mouse, drawing, or other input devices.

UI rendering

Renders vector and bitmap graphics, animations, and text.

Media

Features playback and management of various types of audio and video files, such as .WMP and .MP3 files.

Deep Zoom

Enables you to zoom in on and pan around high resolution images.

Controls

Supports extensible controls that are customizable through styling and templating.

Layout

Enables dynamic positioning of UI elements.

Data binding

Enables linking of data objects and UI elements.

DRM

Enables digital rights management of media assets.

XAML

Provides a parser for XAML markup.

Developers can interact with this presentation framework by using XAML to specify presentation details. XAML is the primary point of interaction between the .NET Framework and the presentation layer. Developers can programmatically manipulate the presentation layer using managed code.

The .NET Framework for Silverlight

The following table describes a partial list of the .NET Framework for Silverlight features shown in the previous illustration.

Feature

Description

Data

Supports Language-Integrated Query (LINQ) and LINQ to XML features, which ease the process of integrating and working with data from disparate sources. Also supports the use of XML and serialization classes for handling data.

Base class library

A set of .NET Framework libraries that provide essential programming functions, such as string handling, regular expressions, input and output, reflection, collections, and globalization.

Window Communication Foundation (WCF)

Provides features to simplify access to remote services and data. This includes a browser object, HTTP request and response object, support for cross-domain HTTP requests, support for RSS/Atom syndication feeds, and support for JSON, POX, and SOAP services.

CLR (common language runtime)

Provides memory management, garbage collection, type safety checking, and exception handling.

WPF (Windows Presentation Foundation) controls

Provides a rich set of controls, including Button, CheckBox, HyperlinkButton, ListBox, RadioButton, and ScrollViewer.

DLR (dynamic language runtime)

Supports the dynamic compilation and execution of scripting languages such as JavaScript and IronPython to program Silverlight-based applications. Includes a pluggable model for adding support for other languages for use with Silverlight.

The .NET Framework for Silverlight is a subset of the full .NET Framework. It provides the essentials of robust, object-oriented application development for application types (such as Internet applications) for which this support has not traditionally been available.

Developers can interact with the .NET Framework for Silverlight layer by writing managed code using C# and Visual Basic. .NET Framework developers can also access the presentation layer by authoring in Visual Studio or Microsoft Expression Blend.

Additional Silverlight Programming Features

Silverlight provides several additional features that help developers create rich and interactive applications, including those described in the following table.

Feature

Description

Isolated storage

Provides safe access from the Silverlight client to the local computer's file system. Enables local storage and caching of data isolated to a particular user.

Asynchronous programming

A background worker thread carries out programming tasks while the application is freed up for user interaction.

File management

Provides a safe File Open dialog box, to ease the process of creating safe file uploads.

HTML–managed code interaction

Enables .NET Framework programmers to directly manipulate UI elements in the HTML DOM of a Web page. Web developers can also use JavaScript to call directly into managed code and access scriptable objects, properties, events, and methods.

Serialization

Provides support for serialization of CLR types to JSON and XML.

Packaging

Provides the Application class and build tools to create .xap packages. The .xap package contains the application and entry point for the Silverlight plug-in control to run.

XML libraries

XmlReader and XmlWriter classes simplify working with XML data from Web services. The XLinq feature enables developers to query XML data directly within .NET Framework programming languages.

The following Microsoft applications include special features for Silverlight development:

  • Microsoft Expression Blend. This tool can be used to create and modify the presentation layer of an application by manipulating the XAML canvas and controls, working with graphics, and programming the presentation layer with a dynamic language such as JavaScript.

  • Visual Studio. Visual Studio 2010 provides visual design support for creating Silverlight applications. You can build user interfaces for your applications by dragging controls from the Toolbox and setting properties in the Properties window. You can also edit XAML directly in the XAML view. For more information, see Silverlight Tools and Silverlight Designer for Visual Studio 2010.

Because Silverlight-based applications are executed in a run-time environment on the client machine, no particular application is required to be installed on the server. However, developers may find that their ability to create rich applications that integrate services and data from multiple sources on the server is enhanced by integrating the following types of services and server-side applications into their Silverlight-based applications:

  • ASP.NET AJAX. This includes a set of controls, services, and libraries for creating rich and interactive Web-based applications.

  • Microsoft Windows Communication Foundation (WCF) services.

  • Internet servers, including Microsoft Internet Information Services (IIS), and the Apache Web server.

  • Internet-based applications and services, including Microsoft ASP.NET, PHP, Windows Streaming Media services, Windows Live services, and other open Web services.

See Also

Concepts

Other Resources