Assembly: Microsoft.Surface.Presentation (in microsoft.surface.presentation.dll)
A ScatterView control is a container for other controls or objects of any type. It provides the framework for moving and manipulating objects on the Microsoft Surface screen. When you add an object to the Items property of a ScatterView control, the event handlers required to move and manipulate the object are established automatically.
The Items property is a collection of ScatterViewItem controls, even if your application does not explicitly create ScatterViewItem controls when it adds to the Items collection. When you add an object that is not of type ScatterViewItem, the ScatterView control first wraps your object in a ScatterViewItem control before adding it to the collection. The following code example illustrates this behavior.
<UserControl x:Class="Classes_ScatterView.Controls.ScatterViewControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="http://schemas.microsoft.com/surface/2008" Background="Aquamarine"> <s:ScatterView Name="MainScatterView"> <!-- These controls will automatically be wrapped in a ScatterViewItem control--> <Rectangle Width="42" Height="42" Margin="8" Fill="Blue"/> <Rectangle Width="42" Height="42" Margin="8" Fill="White"/> <Label Content="Label" Margin="8"/> <s:SurfaceButton Content="Button" Margin="16" /> <!-- These controls are explicitly placed inside a ScatterViewItem control--> <s:ScatterViewItem DecelerationRate="25.25"> <Label Content="1. Pizza"/> </s:ScatterViewItem> <s:ScatterViewItem DecelerationRate="167.35"> <Label Content="2. Laundry"/> </s:ScatterViewItem> <s:ScatterViewItem DecelerationRate="739.53"> <Label Content="3. Movie"/> </s:ScatterViewItem> </s:ScatterView> </UserControl>
After a ScatterViewItem control has been added to the Items collection, users can manipulate it on the Microsoft Surface screen in a variety of ways. By using simple gestures, users can move, rotate, and scale the ScatterViewItem control. These manipulations can occur simultaneously.
When contacts that are captured by the ScatterViewItem control are released, inertia processing is used to gradually slow the movement and rotation. You can control the speed at which the inertia processing occurs through the DecelerationRate and AngularDecelerationRate properties.
As an item is decelerating, if it encounters the bounds of the ScatterView control, it bounces and decelerates more rapidly.
When you use a ScatterView control, multiple objects can simultaneously be the target of user interaction. Active items move to the top of the z-order.
Activation and Deactivation
A ScatterView control activates a ScatterViewItem control when a user starts manipulating the item. By default, when a ScatterViewItem object is activated, it grows slightly larger and displays a shadow beneath it. To disable these effects, set the ShowsActivationEffects property to false.
You can change the activation state of a ScatterViewItem control programmatically. The Activate and Deactivate methods and the IsActive and StaysActive properties enable you to control the activation state in the manner that your application requires.