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
Answer: 1
You should try using the top level container (which contains all other subcontainers) to get the offset point.
Also you can try:
var transform = mySubSubSubElement.TransformToVisual(Application.Current.RootVisual); var position = transform.Transform(new Point(0, 0)); Answer by Jevgeni Tsaikin for Silverlight horizontal stretch and get position issueAnswer: 2
can any one tell me what is nc or mySubSubSubElement here
Thanks
Answer by Nag Arjun for Silverlight horizontal stretch and get position issue
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog