Tried just a few examples. The msdn documentation is, I think, incorrectly worded
"How to make an object Follow the mouse pointer" should be
"How to make an increase in the size of the object depending on the position of the mouse" in any case.
I was able to achieve this effect by changing the properties of the canvas. I'm also not sure why everyone attached the event handler to the object of the next top-level layout property, and not to the window. Perhaps you and most examples on the Internet are looking for a different effect.
<Window x:Class="FollowMouse.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" MouseMove="MouseMoveHandler"> <Canvas> <Ellipse Name="ellipse" Fill="LightBlue"Width="100" Height="100"/> </Canvas>
code for
private void MouseMoveHandler(object sender, MouseEventArgs e) {
user1752532
source share