Unregisters an event listener on the event target object.
| XAML | Cannot use methods in XAML. |
| Scripting | object.RemoveEventListener(eventName, token)
-or-
object.RemoveEventListener(eventName,functionName)
|
Parameters
| eventName | string The type of event, such as "KeyDown". This is a true string, and the value must be quoted. An exception is thrown if eventName is invalid (not a known event name). |
| token | integer A token that is returned from an AddEventListener call. If you have no token, and the handler was added in XAML, you can pass 0. |
| functionName | string The name of the event handler function. This syntax only works in two cases: either the handler was added in XAML, or the original AddEventListener call that added the handler used a quoted string rather than a delegate reference. |
Examples
The following JavaScript example shows
how to remove events from a TextBlock object, using tokens that were obtained from earlier AddEventListener calls:
| JavaScript |
function removeEvents()
{
textBlock.removeEventListener("MouseEnter", entertoken1);
textBlock.removeEventListener("MouseLeave", leavetoken1);
}
|
Applies To
Canvas,
Ellipse,
Glyphs,
Image,
InkPresenter,
Line,
MediaElement,
Path,
Polygon,
Polyline,
Rectangle,
TextBlock
See Also
Silverlight Events
AddEventListener