UIElement..::.MouseLeave Event Home
This page is specific to:Microsoft Version:3.03.5Silverlight 34.0
.NET Framework Class Library for Silverlight
UIElement..::.MouseLeave Event

Occurs when the mouse (or the stylus) leaves the bounding area of a UIElement.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
Syntax

'Usage

Dim instance As UIElement
Dim handler As MouseEventHandler

AddHandler instance.MouseLeave, handler


'Declaration

Public Event MouseLeave As MouseEventHandler
<uiElement MouseLeave="eventhandler"/>
Remarks

The MouseLeave event can be defined for any UIElement-derived class, such as Canvas, TextBlock, or Rectangle.

The MouseLeave event is raised in response to the mouse (or the stylus) leaving the object's bounding area.

You can define multiple MouseLeave events for objects in XAML content. However, if a child object and its parent object both define a MouseLeave event, the parent object's MouseLeave event occurs before the child object's MouseLeave event. This is not a case of a bubbling event; it indicates only that the mouse (or the stylus) has entered both objects, potentially at different times depending on the object layout and composition of the visual tree.

Unlike the MouseEnter event, the MouseLeave event does not provide the mouse (or the stylus) position in event data, because the position of the mouse pointer relative to the object is unknown when it is out of bounds. Because it is always nullNothingnullptra null reference (Nothing in Visual Basic), you generally should not use the event data from your MouseLeave event handler, although you may still be interested in the sender parameter.

MouseLeave and OnMouseLeave

Controls that inherit MouseLeave can provide special handling for the event, by overriding the OnMouseLeave method. OnMouseLeave can be useful either for setting visual state, or for public or internal state properties. For instance, Slider implements OnMouseLeave in order to check the Thumb element's value for IsDragging (which cancels a particular behavior mode), and also to set visual state. For more information, see OnMouseLeave.

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

Other Resources

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View