Reputation: 7
So my setup is as such; I have, in my C# program for Windows Phone 8, multiple Ellipse elements, all of which call the same method, Checkpoint, when the mouse enters one. The problem is that since I will be drawing a line between the more recently entered ellipse and the previously entered ellipse, I need to know which ellipse any given call came from. If it helps, the code is below:
Point old;
private void CheckPoint(object sender, System.Windows.Input.MouseEventArgs e)
{
if (old.Equals(null))
{
old.Equals(this.);
}
else
{
System.Windows.Shapes.Line connectline = new System.Windows.Shapes.Line();
connectline.X1 = old.Margin.Left;
connectline.Y1 = old.Margin.Top;
connectline.X2 = this. ;
connectline.Y2 = this.
}
}
As you can see, this code is incomplete; old is supposed to be set to whichever ellipse is pressed after it runs through the code block. The "this." are incomplete, and are to be substituted with the margin properties from the ellipse that called the method. Thanks all!
Upvotes: 0
Views: 74
Reputation: 3031
You can identify which is the Selected Ellipse
by
private void CheckPoint(object sender, System.Windows.Input.MouseEventArgs e)
{
var selectedEllipse = sender as Ellipse;
if(selectedEllipse!=null)
{
//Your code here
}
}
Upvotes: 2