an example:
.A----------------------------
| .B----- .C---- |
| | | | | |
| | | | | |
| | | | | |
| ------ ----- |
| |
| |
----------------------------
where .A represents the margin of you host and .B represents the margin of a Thumbnail and C also covers a thumbnail.
the margin of your grid inside the Host (A) would be the same as the thumbnail you select (this is based on the fact that your grid also is part of the host container). Else you would need to add both Margins for calculating the correct margin.
A.TopMargin = 50 and LeftMargin = 90 B.TopMargin = 5 and leftMargin = 35 C.TopMargin = 5 and LeftMargin = 95
For in code:
BThum = YourSelectedThumbNailAtThatMoment; //either B or C
Grid.TopMargin = AHost.TopMargin + BThum.TopMargin;
Grid.LeftMargin = AHost.LeftMargin + BThum.LeftMargin;