Surface 2.0 ScatterViewItem.Center load item and check if items on same position

303 Views Asked by At

I've got a problem:

I capture the position of ScatterViewItems: Center.X, Center.Y and Orientation.

For example:

  • Item1: X: 595,037655575406 Y: 322,207060644012 Orientation: 0,660569393375486

  • Item2: X: 606,055258773819 Y: 327,601041845081 Orientation: 180,591312945756

If I load the items via code the position is not the same (it seems to be moved a few pixels).

The next issue is: I want to check if two items are exactly on the same position.

If true raise an event and lock the items.

Thank you in advance.

1

There are 1 best solutions below

0
On

Use ActualCenter property and ActualOrientation property when reading it back.

The Center is moved? Check the margin of the ScatterView Same Position?

Vector v = item1.ActualCenter - item2.ActualCenter;
if (v.Length < 10) //within 10 pixel distance
{
      //Raise your event
      item1.CanMove = item2.CanMove = item2.CanRotate = item2.CanRotate = false;
}