* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
1.8 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | |||||
|---|---|---|---|---|---|---|---|---|---|
| How to: Make an Object Follow the Mouse Pointer | 03/30/2017 |
|
|
50b20415-14bc-405c-baf3-2fb254fffde3 |
How to: Make an Object Follow the Mouse Pointer
This example shows how to change the dimensions of an object when the mouse pointer moves on the screen.
The example includes an [!INCLUDETLA#tla_xaml] file that creates the [!INCLUDETLA#tla_ui] and a code-behind file that creates the event handler.
Example
The following XAML creates the [!INCLUDETLA2#tla_ui], which consists of an xref:System.Windows.Shapes.Ellipse inside of a xref:System.Windows.Controls.StackPanel, and attaches the event handler for the xref:System.Windows.UIElement.MouseMove event.
[!code-xamlmouseMoveWithPointer#MouseMoveWithPointerXAML]
The following code behind creates the xref:System.Windows.UIElement.MouseMove event handler. When the mouse pointer moves, the height and the width of the xref:System.Windows.Shapes.Ellipse are increased and decreased.
[!code-csharpmouseMoveWithPointer#MouseMovePointerGetPosition] [!code-vbmouseMoveWithPointer#MouseMovePointerGetPosition]