Compartir a través de


ImageFailed (Image)

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

Occurs when there is an error associated with image retrieval or format.

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

Arguments

AddEventListener Parameters

token

integer

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.

eventhandlerFunction

object

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

Event Handler Parameters

sender

object

The object that invoked the event.

eventArgs

object

This parameter is always set to null.

Managed Equivalent

ImageFailed

Remarks

Conditions in which this event can occur include the following:

  • File not found.

  • Invalid (unrecognized or unsupported) file format.

  • Unknown file format decoding error after upload.

The ImageFailed event can occur if the initial Source attribute value in XAML does not specify a valid source, or if the Source value of an existing image is subsequently set to an invalid source in JavaScript. For more information about image format, see Image.

You can also add handlers in script by using a quoted string for the event handler name, as follows:

object.AddEventListener("ImageFailed", "eventhandlerFunction")

This syntax also returns a token. However, the token is not an absolute requirement for removing the handler in cases where the handler was added by using a quoted string. For details, see RemoveEventListener.

Applies To

Image