I’m trying to get the position of a canvas from a mouse move handler but it returns NeuN.
The canvas is inside another canvas and the code is:
Console.WriteLine(Canvas.GetTop(canvas2));
this is inside:
private void move(object sender, MouseEventArgs e)
{
Console.WriteLine(Canvas.GetTop(canvas2));
}
I’d say it can’t be a scope problem because as SetTop works fine.
Any ideas?
Thanks in advance 🙂
Ok, I found a workaround. I’d still appreciate alternatives if somebody has a better way of doing this.
Basically, as GetTop doesn’t work I thought I could get the RenderTransform object. And it worked!
Thanks.
EDIT:
You can also do this: