Occurs when the image source for an Image or ImageBrush is downloaded and decoded with no failure.

<object ImageOpened="eventhandlerFunction"  .../>
[token = ]object.AddEventListener("ImageOpened", eventhandlerFunction)

AddEventListener Parameters



A token that is returned from the function, which you can optionally retain as a variable. If you intend to call RemoveEventListener to remove the handler, you will need this token.



The name of your event handler function as it is defined in JavaScript. When used as an AddEventListener parameter, quotation marks around the function name are not required. (For more information, see the "Remarks" section.)

Event Handler Parameters



The object that invoked the event.



This parameter is always set to null.

In the managed API, you can use the PixelWidth and PixelHeight properties on the ImageSource to determine the image characteristics before rendering it. In the JavaScript API, you can use this technique, but you must explicitly declare a BitmapImage object in the XAML markup, so that there is an object available that reports PixelWidth and PixelHeight. Otherwise, the image source is interpreted as a URI and does not create an intermediate object that you can use in JavaScript. The following is an example of the markup:

    <BitmapImage ImageOpened="imgOpened" UriSource="cocointhesnow.png"/>

For the imgOpened handler (not shown), the sender is a BitmapImage, and the PixelHeight and PixelWidth properties are available.

You can also attach an ImageOpened handler for either Image or ImageBrush. However, this is considerably less useful for obtaining a pre-rendered image dimension because PixelHeight and PixelWidth are not available properties without the explicit BitmapImage.

Silverlight 3

Community Additions