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, IIterable, ICompositionInteractionSourceCollectionpublic sealed class CompositionInteractionSourceCollection : CompositionObject, IEnumerable, ICompositionInteractionSourceCollectionPublic NotInheritable Class CompositionInteractionSourceCollection Inherits CompositionObject Implements IEnumerable, ICompositionInteractionSourceCollection// This API is not available in Javascript.
Inheritance
CompositionInteractionSourceCollectionCompositionInteractionSourceCollectionCompositionInteractionSourceCollectionCompositionInteractionSourceCollection
Attributes
Windows 10 requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Inherited Members

Inherited methods

Inherited properties

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

Count Count Count Count

The number of interaction sources in the collection.

public : int Count { get; }public int Count { get; }Public ReadOnly Property Count As int// This API is not available in Javascript.
Value
int int int int

The number of interaction sources in the collection.

Methods

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

Adds an interaction source to the collection.

public : void Add(ICompositionInteractionSource value)public void Add(ICompositionInteractionSource value)Public Function Add(value As ICompositionInteractionSource) As void// This API is not available in Javascript.
Parameters

First() First() First() First()

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

public : IIterator<ICompositionInteractionSource> First()This member is not implemented in C#This member is not implemented in VB.Net// This API is not available in Javascript.
Returns

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the collection.

This member is not implemented in C++IEnumerator<T> GetEnumerator()Function GetEnumerator As IEnumerator(Of T)IEnumerator<T> GetEnumerator()
Returns

An enumerator that can be used to iterate through the collection.

Remove(ICompositionInteractionSource) Remove(ICompositionInteractionSource) Remove(ICompositionInteractionSource) Remove(ICompositionInteractionSource)

Removes the specified interaction source from the collection.

public : void Remove(ICompositionInteractionSource value)public void Remove(ICompositionInteractionSource value)Public Function Remove(value As ICompositionInteractionSource) As void// This API is not available in Javascript.
Parameters

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

Removes all interaction sources from the collection.

public : void RemoveAll()public void RemoveAll()Public Function RemoveAll() As void// This API is not available in Javascript.

See Also