Wednesday, January 11, 2012

Surface Tip: Setting ScatterView Position

icon








Just beginning a series of small quick tips for Surface 2/0 development that will go from basic to advanced tips and practices, hopefully helping you with common and useful code snippets.

Surface Tip: How to set a ScatterViewItem position?


By default, the ScatterView control will place the items contained in random positions but always ensuring that the item is not too small or too big to provide a good object manipulation. A default ScatterView control will look like the following:

Which when run, it will display the following:

scatterview_01                 scatterview_02

If you need to have control over the starting position, orientation and even size of the items in a ScatterView control, you can do so. Check the following sample which modifies all the mentioned properties:


That will display following:

scatterview_03

You can even modify the default behaviour of the ScatterViewItem control to prevent users from rotate or scale the object. You achieve that restricted behaviour by modifying the CanRotate and CanScale properties as the following sample does:


Hope it helps. Happy Surface !

No comments:

Post a Comment