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
| 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
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.
- value
- ICompositionInteractionSource ICompositionInteractionSource ICompositionInteractionSource ICompositionInteractionSource
The interaction source to add to the collection.
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 an iterator pointing to the first object in the collection.
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()
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.
- value
- ICompositionInteractionSource ICompositionInteractionSource ICompositionInteractionSource ICompositionInteractionSource
The interaction source to remove from the collection.