Export (0) Print
Expand All

Overview of Silverlight 2

Expression Studio 2.0
This page applies to Silverlight 2 projects only

Microsoft Silverlight 2 is a cross-browser, cross-platform plug-in for delivering rich applications over the web that incorporate video, animation, interactivity, and stunning user interfaces. Silverlight 2 applications look and behave the same on Microsoft Windows-based computers as they do on Apple Macintosh computers, in most browsers, and without any additional installation requirements.

Silverlight 2 provides a consistent presentation model by using XAML. In Microsoft Expression Blend 2 with Service Pack 1 installed, you can quickly design stunning user interfaces for your Silverlight 2 applications and test the results.

The best way to understand what you can create using Silverlight 2 is to see example applications. Expression Blend 2 Service Pack 1 includes sample Silverlight 2 projects that you can open on the artboard by clicking Welcome Screen on the Help menu, and then clicking one of the following samples from the Samples tab:

  • Memory

  • ImageGallery

Additionally, you can find other examples and samples online at the Silverlight Showcase and Silverlight Gallery.

Dd185505.7e183f1f-37d8-4dcb-980c-19a5d61ca087(en-us,Expression.10).gif Back to top

You can create and work with Silverlight 2 projects in Expression Blend 2 with Service Pack 1 installed.

Silverlight 2 supports many features that are in common with Windows Presentation Foundation (WPF) that Silverlight 1 did not support. For example, more layout panels are available, and more controls such as the Button and TextBox control are available.

Dd185505.alert_note(en-us,Expression.10).gifNote:

3D objects, dynamic resources, external resource dictionaries, XML data sources, and element-to-element data binding are not supported in Silverlight 2 projects. Triggers are not supported, but a feature named States provides similar functionality.

Workspace

When a Silverlight 2 project is open, the Expression Blend user interface shows only Silverlight 2-applicable controls, properties, and tools. For example, the controls that are not supported do not appear in the Toolbox or the Asset Library.

Controls

To design the user interface of your Silverlight 2 application, you add controls and other elements to a XAML document (usually Page.xaml) in a Silverlight 2 project. The Controls tab of the Asset Library in Expression Blend lists the controls that are available in the Silverlight 2 runtime.

For information about how to add controls to your project, see Draw a control in your Silverlight 2 project. For information about how to add more controls to the Asset Library, see Import a custom control by adding a reference.

Resources

Static resources and templates are supported, which means that you can create reusable colors, brushes, and skins for controls. Dynamic resources are not supported. For more information about resources and templates, see Modify the appearance of a system control in different states and Create a skin for a control in a Silverlight 2 project.

States

Controls can look different depending on which state they are in. For example, a button changes color slightly when you move the mouse pointer over it. "MouseOver" is one of the states of a button.

You can customize the appearance of the different states of any system control that is included with Expression Blend or any imported custom Silverlight 2 control that inherits from the Control class. You can modify the states of these controls in a copy of the control's template. For more information, see Modify the appearance of a system control in different states.

The length of time it takes to transition between states is also customizable. For more information, see Modify the transition time between state changes in system controls.

You cannot create a template for a user control (a control that inherits from the UserControl class), but you can customize a user control by designing it from scratch and adding custom states. For more information, see Create a new user control in your Silverlight 2 project and Define different visual states and transition times for a user control.

Media

Media files are supported in Silverlight 2 projects. When you insert a media file into an open XAML document, a MediaElement object is created to display the media file. MediaElement objects include an AutoPlay property that you can set to True to make the object start to play the media file as soon as the object loads in your application. The MediaElement also has events that relate to download progress and buffering that you can access in the Events Dd185505.6c67bb3b-e8a2-4a63-bad5-54d5c15b04dd(en-us,Expression.10).png view of the Properties panel. For more information about how to hook up to events, see Create a new event handler method.

Data

Common Language Runtime (CLR) data sources are supported, but XML data sources and element-to-element data binding are not.

Code-behind files

XAML document code-behind files are written in C# or Visual Basic .NET. For an example of using code-behind files in a Silverlight 2 application, see Load a new page dynamically in your Silverlight 2 application.

Dd185505.7e183f1f-37d8-4dcb-980c-19a5d61ca087(en-us,Expression.10).gif Back to top

You can work with Silverlight 2 projects in other products in the following ways:

  • Import Silverlight 2 projects and encoding templates from Microsoft Expression Encoder 2 with Service Pack 1 installed. For more information, see Customize an Expression Encoder template for Silverlight 2.

  • Publish Silverlight 2 applications by using the deployment features of Microsoft Expression Web 2 or Microsoft Visual Studio 2008. You can also copy the compiled application files to a web folder. For more information, see Add a Silverlight 2 application to a website.

  • Debug your Silverlight 2 project by opening it in Visual Studio 2008.

Dd185505.7e183f1f-37d8-4dcb-980c-19a5d61ca087(en-us,Expression.10).gif Back to top

Expression Blend creates the same set of files as Microsoft Visual Studio 2008 when you create a project for a Silverlight 2 application and select the Dynamically generate an HTML test page to host Silverlight within this project option in the Add Silverlight Application dialog box of Visual Studio 2008.

The following files are generated when you create a Silverlight 2 project.

File

Description

ProjectName.sln

A Visual Studio solution file that specifies configuration settings for the solution, and references all the projects in the solution.

ProjectName.csproj

or

ProjectName.vbproj

A project file that specifies configuration settings for the project (including the starting web page), and references all the source files in the project.

App.xaml

A file where application-level resources are defined. For example, if you customize a button template and select to define it at the application level, any document in your project can use the template to style a button.

App.xaml.cs

or

App.xaml.vb

The code-behind file for the App.xaml file.

Page.xaml

A default XAML file in which to begin designing the user interface of your Silverlight 2 application.

Page.xaml.cs

or

Page.xaml.vb

The code-behind file for the corresponding content file. User interaction and application behavior is often programmed in the code-behind file.

AppManifest.xml

Defines the assemblies that are included in the Silverlight 2 application. For example, a Silverlight 2 project created in Expression Blend 2 with Service Pack 1 installed will build a Silverlight 2 application in an assembly file (ProjectName.dll), so an AppManifest.xml will always list at least the assembly created by the project in which it resides.

AssemblyInfo.cs

or

AssemblyInfo.vb

Defines properties for the application, such as the version number, description, loaded assemblies, and so on.

Dd185505.alert_tip(en-us,Expression.10).gifTip:

The file that you will work with most often is Page.xaml, which is where you can design the user interface of your Silverlight 2 application. Other files you might modify are the App.xaml file and any other content files (.xaml) that you add to your project.

When you build and test a Silverlight 2 project, the following files are created in the \bin\debug folder, and Expression Blend tries to open the starting web page.

File

Description

AppManifest.xaml

A Silverlight 2 version of the AppManifest.xml file.

Default.html (or TestPage.html if the project was created with Visual Studio 2008)

A web page that loads the Silverlight 2 application (contained in ProjectName.xap) into the browser.

ProjectName.dll

The compiled assembly of the application that you designed in the content files of your project.

ProjectName.pdb

Debug information for the application.

ProjectName.xap

A compressed archive that includes all the content and resources for the Silverlight 2 application. Users download this file on their browsers and run it with the Silverlight 2 plug-in.

References

Assembly references are listed under Files in the Project panel of Expression Blend.

Dd185505.65aaebe1-ca4c-4805-a869-02d767be3c00(en-us,Expression.10).png

When you create a new project, default references to Silverlight 2 assemblies are added for you. It is in these referenced assemblies that the controls such as Button and TextBox are defined. You can add other Silverlight 2 assembly references as you need them. You can also add references to .dll files that are compiled from other Silverlight 2 projects. For more information, see Import a custom control by adding a reference.

Dd185505.7e183f1f-37d8-4dcb-980c-19a5d61ca087(en-us,Expression.10).gif Back to top

You can learn more about how to create Silverlight applications at the following websites:

Dd185505.7e183f1f-37d8-4dcb-980c-19a5d61ca087(en-us,Expression.10).gif Back to top

Community Additions

ADD
Show:
© 2015 Microsoft