JavaScript API Reference Addendum

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

This topic describes JavaScript API and how it relates to client versioning of releases that have occurred since Silverlight 1.0. It also describes types and members that are available in the current client, but that have limited or no use in the JavaScript API despite possibly having some exposure through the dispatch gateway that Silverlight uses to process JavaScript API scripting calls.

JavaScript API Versioning

The JavaScript API for Silverlight has objects and members that are available for use by silverlight clients, and in some cases these objects and members were added specifically for the latest version of the client. These objects have a native implementation that is exposed to JavaScript in the same way as the objects that existed in the original Silverlight 1.0 release. You can create these objects by instantiating them from XAML and then using JavaScript to manipulate the object tree. .

In general, the additional objects, properties, methods, events, and enumerations for the JavaScript API are included in the JavaScript API for Silverlight Reference. The objects that are available to clients of that version or greater are noted in the Version Information section of each topic. The version information is retained in the documentation in case it is useful to anyone.

The JavaScript API is largely a subset of the object set available for programming to the same client using managed code. There are also occasional APIs where the managed API is not directly analogous. Reference pages in the JavaScript API reference include a Managed Equivalent link and will note an approximate analog if there is no exact one, or include other notes about the differences in programming model approach.

Some of the new objects, properties, methods, events, and enumerations are available to the JavaScript API for Silverlight, but they are not useful unless you are also using functionality that is only available when using the managed API. These types and members are not included in the JavaScript API reference section of the documentation, but they are listed in this topic.

Objects

You can instantiate the following objects by using XAML. However, when you use the JavaScript API, these objects are not accessible, or it is not meaningful to access them.

  • Application

  • AssemblyPart

  • BitmapCache

  • ContentControl

  • ControlTemplate

  • DataTemplate

  • Deployment

  • Extension Part, ExternalPart

  • PixelShader

  • VisualState, VisualStateGroup, VisualTransition

Abstract Types and Collections

The following types can be considered abstract in the native implementation, abstract in the managed API, or both. The JavaScript API does not have a formal definition of abstractness, and only instances of practical objects can be marshaled across the boundary between Silverlight and the host. However, it is possible that such abstract objects might be identified if you call the ToString method to examine objects that are returned by your user code, or otherwise examine prototypes.

The following is a list of abstract objects or of collection types that define no members beyond the base Collection:

  • AssemblyPartCollection

  • ColumnDefinitionCollection

  • Control

  • FrameworkElement

  • FrameworkTemplate

  • GeneralTransform

  • GradientBrush

  • GridUnitType

  • ImageSource

  • Inline

  • InlineCollection

  • MultiScaleSubImageCollection

  • MultiScaleTileSource

  • ObjectKeyFrame

  • Panel

  • PixelShader

  • PresentationFrameworkCollection

  • RootVisual

  • RowDefinitionCollection

  • SetterBase

  • SetterBaseCollection

  • TextBoxBase

  • TileBrush

  • TriggerAction

  • TriggerBase

  • UIElementCollection

  • UserControl

  • Visual

The existing JavaScript API for Silverlight Reference includes some objects that are noted as "(Abstract)" in definitions and links, such as DependencyObject, UIElement, and Transform. This convention lets you know that that these classes parallel the managed APIā€”these abstract types define API that is inherited by multiple objects that you can create from XAML and then use in JavaScript.

Members

The following members of Silverlight objects are available in the JavaScript API. However, it is not useful in the JavaScript API to access them, because some aspect of the API behavior requires that the Silverlight CLR is activated.

AllowDrop, CacheMode, DataContextDragEnter, DragLeave, DragOver, Drop, TextInput, TextInputStart, TextInputUpdate (UIElement)

Template (TextBox, PasswordBox)

AllowNavigation, EnableCacheVisualization, EnableGPUAcceleration (Silverlight Plug-in)