Partilhar via


New API for the Silverlight 1.0 Beta

With the substantial number of new features and API added to the Silverlight 1.0 Beta release since the February CTP release, I decided to compile a list of the new API. I've grouped them into feature areas.

  • New Inking Support
  • Enhanced Error Handling Support
  • New Animation, Graphics, and Media Features
  • Redesigned Silverlight Control Model
  • New Text and Font Support
  • Other New Support

See Silverlight 1.0 Beta Enhancements and Converting a WPF/E Application to a Silverlight Scripting Application for other info on changes to the Silverlight programming model.

New Inking Support

API Description
InkPresenter Element that displays ink and can be a child, sibling or parent of other elements.
InkPresenter.Strokes The collection of ink strokes that correspond to the InkPresenter.
Stroke Represents a collection of points that correspond to a stylus-down, move, and stylus-up sequence.
Stroke.DrawingAttributes Specifies the appearance of the Stroke.
Stroke.GetBounds() Returns a Rect which is the bounding box of the Stroke.
Stroke.HitTest() Returns true if the StylusPointCollection passed intersects the Stroke object; otherwise, false.
Stroke.StylusPoints The collection of StylusPoint objects that make up the Stroke.
StrokeCollection Represents zero or more Stroke objects that are grouped together.
StrokeCollection.GetBounds() Returns a Rect which is the bounding box of the strokes in the collection.
StrokeCollection.HitTest() Returns a collection of strokes that are intersected by the points in the StylusPointCollection passed.
StylusInfo Represents information about the state of the stylus.
StylusInfo.IsInverted Specifies whether the stylus is inverted.
StylusInfo.DeviceType Indicates if the stylus represents mouse, stylus, or touch input.
StylusPoint Represents a single point collected while the user is inking with the stylus or mouse.
StylusPoint.PressureFactor The pressure of the stylus on the screen.
StylusPoint.X The X coordinate of the StylusPoint in pixels.
StylusPoint.Y The Y coordinate of the StylusPoint in pixels.
StylusPointCollection Represents a set of related StylusPoint objects.
StylusPointCollection.AddStylusPoints Adds a collection of StylusPoint objects to the collection.
DrawingAttributes Represents the appearance of a Stroke.
DrawingAttributes.Color The color of the associated stroke.
DrawingAttributes.Height The height of the associated stroke.
DrawingAttributes.OutlineColor The outline color of the associated stroke.
DrawingAttributes.Width The width of the associated stroke.
DeviceType Specifies the basic classes of pointing devices supported.
MouseEventArgs.GetStylusInfo() Returns a StylusInfo object which gives information about the state of the Stylus.
MouseEventArgs.GetStylusPoints() Returns a clone of the stylus points collected since the last mouse event.

For more information about inking in Silverlight, see the following topic: Ink Support In Microsoft Silverlight .

Enhanced Error Handling Support

API Description
ErrorEventArgs Provides data for the OnError event.
ErrorEventArgs.ErrorCode Gets the error code associated with the error.
ErrorEventArgs.ErrorMessage Gets the error description associated with the error.
ErrorEventArgs.ErrorType Gets the ErrorType of the error associated with the event.
ErrorType Describes the possible types of errors.
ParserErrorEventArgs Provides data for XAML parser error events.
ParserErrorEventArgs.CharPosition The character position within the line that the parser error occurred on.
ParserErrorEventArgs.LineNumber Gets the line number at which the parser error occurred.
ParserErrorEventArgs.XamlFile Gets the name of the Xaml file that the parser error occurred in.
ParserErrorEventArgs.XmlAttribute Gets the xml attribute that the parser error occurred in.
ParserErrorEventArgs.XmlElement Gets the xml element that the parser error occurred in.
RuntimeErrorEventArgs Provides data for runtime error events.
RuntimeErrorEventArgs.CharPosition The character position within the line that the runtime error occurred on.
RuntimeErrorEventArgs.LineNumber Gets the line number at which the runtime error occurred.
RuntimeErrorEventArgs.MethodName Gets the name of the method associated with the runtime error.

For more information about error handling in Silverlight scripting applications, see the following topic: Silverlight Application Scripting Error Handling.

New Animation, Graphic, and Media Features

API Description
MediaAttribute Represents an attribute from an entry in a ASX file.
MediaAttribute.Name Gets the name of the MediaAttribute which is the name of the xml element in the ASX file that the MediaAttribute corresponds to.
MediaAttribute.Value Gets the value of the MediaAttribute which is the value of the xml element in the ASX file that the MediaAttribute corresponds to.
MediaAttributeCollection Represents a collection of MediaAttribute objects.
MediaAttributeCollection.GetItemByName() Gets the MediaAttribute for the collection with the Name equal to the specified string.
MediaElement.Attributes Gets the collection of MediaAttribute objects which corresponds to the current entry in the ASX file that Source is set to.
MediaElement.MarkerReached Occurs when a timeline marker is encountered during media playback.
MediaElement.Markers Gets the collection of timeline markers associated with the currently loaded media file.
TimelineMarker Represents metadata associated with a specific point in a media file.
TimelineMarker.Collection Represents metadata associated with a specific point in a media file.
TimelineMarker.Text Gets or sets the text value of this TimelineMarker.
TimelineMarker.Time Gets or sets the time at which this TimelineMarker is reached.
TimelineMarker.Type Gets or sets the type of this TimelineMarker.
TimeLineMarkerCollection Represents a collection of TimelineMarker objects.
TimeLineMarkerEventArgs Contains arguments for the MediaElement.MarkerReached event.
TimelineMarkerEventArgs.Marker Gets the TimelineMarker that triggered this event.
VideoBrush Paints an area with video.
VideoBrush.SourceName Gets or sets the Name of the MediaElement that provides video for this VideoBrush.
VideoBrush.Stretch Gets or sets a value that specifies how the video of this brush stretches to fill the painted area.
UIElement.Resources Gets or sets a collection of Storyboard objects that you can use to control animations.
ResourceCollection Represents a collection of Resource objects.

For more information about using animations, graphics, and media in Silverlight scripting applications, see the following topics: Animation Overview, Media Overview, Silverlight Brushes Overview, and Silverlight VideoBrush Overview .

Redesigned Silverlight Control Model (previously the WPFE Control)

API Description
Background API name changed from BackgroundColor.
EnableFramerateCounter Gets or sets a value that determines whether to display the current framerate in the hosting browser's status bar. (Microsoft Internet Explorer only)
EnableHtmlAccess Determines whether the hosted content in the Silverlight control has access to the browser Document Object Model (DOM).
InitParams Specifies the optional set of user-defined initialization parameters.
OnError API redesigned to use enhanced error handling support.
OnFullScreenChange API name changed from FullScreenChanged.
OnLoad API redesigned to reflect changes to Silverlight control model.
OnResize API name changed from OnResized.
Windowless API name changed from WindowlessMode.

For more information about new and breaking changes on the Silverlight control, see the following topics: Silverlight Object Models, Using a Silverlight Control, Using CreateSilverlight.js and Silverlight.js, and Resizing a Silverlight Control.

New Text and Font Support

API Description
SetFontSource() Adds font files in the downloaded content to the object's collection of type faces.
FontSize Gets or sets the font size for the content in this element.
FontStretch Gets or sets the font stretch for the content in this element.
TextDecorations Gets or sets the text decoration for the content in this element.

For more information on using text in Silverlight scripting applications, see the following topic: Text and Fonts Overview.

Other New Support

API Description
MouseEventArgs.GetPosition() Gets the x- and y-coordinates of the mouse pointer position. Note: the x and y properties on the MouseEventArgs have been removed and replaced this method call.
Downloader.GetResponseText() Gets a string representation of the downloaded data.
UIElement.Canvas.ZIndex Gets or sets a value that represents the z-order rendering behavior of objects in a collection.
UIElement.IsHitTestVisible Gets or sets whether the contained area of this UIElement can be used for hit-testing.
UIElement.Visibility Gets or sets the user interface (UI) visibility of this element.

--Brian
  Silverlight SDK Team

Comments

  • Anonymous
    April 30, 2007
    昨天发了个帖子 Silverlight for linux 和 DLR(Dynamic Language Runtime) 。早上看有了新帖子 silverlight1.0beta 和 silverlight1.1

  • Anonymous
    May 01, 2007
    昨天发了个帖子 Silverlight for linux 和 DLR(Dynamic Language Runtime) 。早上看有了新帖子 silverlight1.0beta 和 silverlight1

  • Anonymous
    May 01, 2007
    昨天发了个帖子 Silverlight for linux 和 DLR(Dynamic Language Runtime) 。早上看有了新帖子 silverlight1.0beta 和 silverlight1