Disables mouse capture for the object.
| XAML | Cannot use methods in XAML. |
| Scripting | object.ReleaseMouseCapture()
|
Examples
The following JavaScript example shows the mouse being captured and released using event handler functions for the MouseLeftButtonDown and MouseLeftButtonUp events.
| JavaScript |
// Display the current mouse position for the Rectangle object.
function onMouseMove(sender, mouseEventArgs)
{
var msg = "x:y = " + mouseEventArgs.getPosition(null).x + ", " + mouseEventArgs.getPosition(null).y;
sender.findName("statusTextBlock").Text = sender.Name + ": " + msg;
}
// Enable mouse capture when the mouse is depressed over the green Rectangle object.
function onLeftButtonDown(greenRect, mouseEventArgs)
{
greenRect.captureMouse();
}
// Disable mouse capture when the mouse is released over the green Rectangle object.
function onLeftButtonUp(greenRect, mouseEventArgs)
{
greenRect.releaseMouseCapture();
}
|
Applies To
Canvas,
Ellipse,
Glyphs,
Image,
InkPresenter,
Line,
MediaElement,
Path,
Polygon,
Polyline,
Rectangle,
TextBlock
See Also
Silverlight Mouse Support
CaptureMouse
MouseLeftButtonDown
MouseLeftButtonUp
MouseMove