mynameisasecret
mynameisasecret

Reputation: 1

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

I've got a problem:

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

For example:

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.

Upvotes: 0

Views: 298

Answers (1)

Imran Shaik
Imran Shaik

Reputation: 326

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;
}

Upvotes: 0

Related Questions