Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ImageFailed Event (Image)

Occurs when there is a media related error.

<object ImageFailed="eventhandlerFunction" .../>
[token = ]object.AddEventListener("ImageFailed", 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 script. When used as an AddEventListener parameter, quotes around the function name are not required. See Remarks.

Event Handler Parameters



Identifies the object that invoked the event.



This parameter is always set to null.


Conditions in which this event can occur include:

  • File not found.
  • Invalid file format - unrecognized or unsupported format.
  • Unknown file format decoding error after upload.

The event can occur if the initial Source attribute value in XAML does not specify a valid source, or can occur if the Source value of an existing image is subsequently set to an invalid source in JavaScript.

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

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.

For more information on Silverlight errors and error handling, see Silverlight Error Handling. For a list of error messages associated with this event, see Error Messages.

Applies To


See Also

Error Handling
Error Messages
Silverlight Events
ImageFailed (ImageBrush)

Community Additions

© 2015 Microsoft