Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Silverlight 3
UIElement Class
UIElement Events
 MouseEnter Event
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Silverlight 3

Other versions are also available for the following:
.NET Framework Class Library for Silverlight
UIElement..::.MouseEnter Event

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

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
Public Event MouseEnter As MouseEventHandler
Visual Basic (Usage)
Dim instance As UIElement
Dim handler As MouseEventHandler

AddHandler instance.MouseEnter, handler
C#
public event MouseEventHandler MouseEnter
XAML Attribute Usage
<uiElement MouseEnter="eventhandler"/>

The MouseEnter event is raised in response to the mouse (or a stylus) moving into the object's bounding area. The MouseEnter event precedes the MouseMove event for the object. The MouseEnter event is not raised if the mouse (or a stylus) did not actually move. For instance, MouseEnter is not raised if the mouse pointer (or the stylus tip) remains stationary, and an object with a MouseEnter handler has its position animated or otherwise adjusted to move under the mouse pointer.

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

The mouse position that is reported in the event data may not be exactly on the boundary of the object because of the coalescing of mouse movements.

MouseEnter and OnMouseEnter

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

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

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker