Silverlight horizontal stretch and get position issue
Posted
by
David
on Stack Overflow
See other posts from Stack Overflow
or by David
Published on 2012-04-14T04:51:17Z
Indexed on
2012/04/14
11:29 UTC
Read the original article
Hit count: 217
I have a Grid (container) wich in turn has several grids(subContainers) arranged by rows. Each one of those "subContainers" has diferent columns and controls. And each of those "subContainers" has the horizontal alignment set to stretch, and it has to stay that way, since the layout this viewer depends on it.
I use the "container" to set each control on it's adequate position. So far so good. Now comes my headache... I want to remove the control from the grid and put it in a canvas, at the same exact position, only, the position it returns is as if the control is set to the beggining of the grid and not it's true position. For testing purposes, I've set the "subContainters" horizontal alignment to center and (despite the layout is totally wrong) every control is in it's right position when sent to a canvas, wich it doesn't happen when HA = stretch. Here's the code I'm using to get position:
GeneralTransform gt = nc.TransformToVisual(gridZoom);
Point offset = gt.Transform(new Point());
So you can understand, for example, my first control should be somewhere like (80, 1090), but the point that I get is (3,3).
Can anyone help me? Thanks
© Stack Overflow or respective owner