CompositionInteractionSourceCollection CompositionInteractionSourceCollection CompositionInteractionSourceCollection CompositionInteractionSourceCollection Class

Definition

A collection of interaction sources.

This is the collection of interaction sources that are associated with a given InteractionTracker. The only valid member of this collection is a VisualInteractionSource. Each VisualInteractionSource needs to have a unique hit-test (source) visual. Each VisualInteractionSource will be configured individually for the desired input to be sent to the InteractionTracker.

public : sealed class CompositionInteractionSourceCollection : CompositionObject
struct winrt::Windows::UI::Composition::Interactions::CompositionInteractionSourceCollection : CompositionObject
public sealed class CompositionInteractionSourceCollection : CompositionObject
Public NotInheritable Class CompositionInteractionSourceCollection Inherits CompositionObject
Inheritance
CompositionInteractionSourceCollectionCompositionInteractionSourceCollectionCompositionInteractionSourceCollectionCompositionInteractionSourceCollection
Attributes

Windows 10 requirements

Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Examples


void SetupMultipleSourceInteractionTracker(Visual horizontalVisual, Visual verticalVisual, Visual contentVisual)
{
  //
  // Create the InteractionTracker and set its min/max position.  These could 
  // also be bound to expressions.  Note: The scrollable area can be changed from either 
  // end to facilitate content updates/virtualization.
  //
 
  _tracker = InteractionTracker.Create(_compositor);
 
  _tracker.MaxPosition = new Vector3(
    contentVisual.Size.X - viewportVisual.Size.X,
    contentVisual.Size.Y - viewportVisual.Size.Y,
    0.0f);
 
 
  //
  // Configure the two interaction sources.  Enable input with inertia.  
  //
 
  var interactionSource1 = VisualInteractionSource.Create(horizontalVisual);
  var interactionSource2 = VisualInteractionSource.Create(verticalVisual);
 
  interactionSource1.PositionXSourceMode = 
  InteractionSourceMode.EnabledWithInertia; 

  interactionSource2.PositionYSourceMode = 
  InteractionSourceMode.EnabledWithInertia;


  _tracker.InteractionSources.Add(interactionSource1);
  _tracker.InteractionSources.Add(interactionSource2);
 
 
  //
  // Bind the InteractionTracker outputs to the contentVisual.
  //
 
  var positionExpression = _compositor.CreateExpressionAnimation("- tracker.Position");
  positionExpression.SetReferenceParameter("tracker", _tracker);
 
  contentVisual.StartAnimation("Offset", positionExpression);
}
         
         

Remarks

While multiple CompositionInteractionSources can be added to the same CompositionInteractionSourceCollection the most common case is to only have one member in this collection. Multiple can be used if multiple hit-test regions should drive the same InteractionTracker. If multiple source visuals are hit-test at the same time the visual tree hierarchy will determine which one takes precedence. If any common parent contains more hit-test contacts than a single child, the input will be promoted to that parent.

Properties

Comment Comment Comment Comment

A string to associate with the CompositionObject.

(Inherited from CompositionObject)
Compositor Compositor Compositor Compositor

The Compositor used to create this CompositionObject.

(Inherited from CompositionObject)
Count Count Count Count

The number of interaction sources in the collection.

Dispatcher Dispatcher Dispatcher Dispatcher

The dispatcher for the CompositionObject.

(Inherited from CompositionObject)
DispatcherQueue DispatcherQueue DispatcherQueue DispatcherQueue

Gets the DispatcherQueue for the CompostionObject.

(Inherited from CompositionObject)
ImplicitAnimations ImplicitAnimations ImplicitAnimations ImplicitAnimations

The collection of implicit animations attached to this object.

(Inherited from CompositionObject)
Properties Properties Properties Properties

The collection of properties associated with the CompositionObject.

(Inherited from CompositionObject)

Methods

Add(ICompositionInteractionSource) Add(ICompositionInteractionSource) Add(ICompositionInteractionSource) Add(ICompositionInteractionSource)

Adds an interaction source to the collection.

Close Close Close Close

Closes the CompositionObject and releases system resources.

(Inherited from CompositionObject)
First() First() First() First()

Returns an iterator pointing to the first object in the collection.

PopulatePropertyInfo(String,AnimationPropertyInfo) PopulatePropertyInfo(String,AnimationPropertyInfo) PopulatePropertyInfo(String,AnimationPropertyInfo) PopulatePropertyInfo(String,AnimationPropertyInfo)

Defines a property that can be animated.

(Inherited from CompositionObject)
Remove(ICompositionInteractionSource) Remove(ICompositionInteractionSource) Remove(ICompositionInteractionSource) Remove(ICompositionInteractionSource)

Removes the specified interaction source from the collection.

RemoveAll() RemoveAll() RemoveAll() RemoveAll()

Removes all interaction sources from the collection.

StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation)

Connects an animation with the specified property of the object and starts the animation.

(Inherited from CompositionObject)
StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase)

Starts an animation group.

The StartAnimationGroup method on CompositionObject lets you start CompositionAnimationGroup. All the animations in the group will be started at the same time on the object.

(Inherited from CompositionObject)
StartAnimationGroupWithIAnimationObject(IAnimationObject,ICompositionAnimationBase) StartAnimationGroupWithIAnimationObject(IAnimationObject,ICompositionAnimationBase) StartAnimationGroupWithIAnimationObject(IAnimationObject,ICompositionAnimationBase) StartAnimationGroupWithIAnimationObject(IAnimationObject,ICompositionAnimationBase)

Starts an animation group on the specified target.

(Inherited from CompositionObject)
StartAnimationWithIAnimationObject(IAnimationObject,String,CompositionAnimation) StartAnimationWithIAnimationObject(IAnimationObject,String,CompositionAnimation) StartAnimationWithIAnimationObject(IAnimationObject,String,CompositionAnimation) StartAnimationWithIAnimationObject(IAnimationObject,String,CompositionAnimation)

Connects an animation with the specified property of the target object and starts the animation.

(Inherited from CompositionObject)
StopAnimation(String) StopAnimation(String) StopAnimation(String) StopAnimation(String)

Disconnects an animation from the specified property and stops the animation.

(Inherited from CompositionObject)
StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase)

Stops an animation group.

(Inherited from CompositionObject)
TryGetAnimationController(String) TryGetAnimationController(String) TryGetAnimationController(String) TryGetAnimationController(String)

Returns an AnimationController for the animation running on the specified property.

(Inherited from CompositionObject)

See also