Unloaded (FrameworkElement)

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

Occurs when this object is no longer connected to the main object tree.

<object Unloaded="eventhandlerFunction"  .../>
[token = ]object.AddEventListener("Unloaded", 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

Unloaded

Remarks

Unloaded is not raised for any object if the Silverlight application shuts down for any reason. This includes cases where the browser host application is closed by the user. An example case that would raise Unloaded is if you clear the Children collection of the root visual that contained the object.

Applies To

Border (Silverlight 2)

Canvas

Ellipse

Glyphs

Image

InkPresenter

Line

MediaElement

MultiScaleImage (Silverlight 2)

PasswordBox (Silverlight 2)

Path

Polygon

Polyline

Popup (Silverlight 2)

Rectangle

StackPanel (Silverlight 2)

TextBlock

TextBox (Silverlight 2)