CompositionPropertySet Class

Definition

Stores values as key-value pairs.

Equivalent WinUI class: Microsoft.UI.Composition.CompositionPropertySet.

public ref class CompositionPropertySet sealed : CompositionObject
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class CompositionPropertySet final : CompositionObject
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 131072)]
class CompositionPropertySet final : CompositionObject
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class CompositionPropertySet : CompositionObject
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 131072)]
public sealed class CompositionPropertySet : CompositionObject
Public NotInheritable Class CompositionPropertySet
Inherits CompositionObject
Inheritance
CompositionPropertySet
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

void CreatePropertySet()
{
  // Create the CompositionPropertySet and insert a scalar value
  CompositionPropertySet sharedPropSet = _compositor.CreatePropertySet();
  sharedPropSet.InsertScalar("offsetChange", 50f);

  // Reference value in CompositionPropertySet in an Expression
  ExpressionAnimation expression =
  _compositor.CreateExpressionAnimation("this.Target.Offset.X + shared.offsetChange");
  expression.SetReferenceParameter("shared", sharedPropSet);
}

void PropertySetRetrieve(CompositionPropertySet propertySet)
{
  // Retrieve the value of key in a CompositionPropertySet
  float tempOffset;
  propertySet.TryGetScalar("offsetChange", out tempOffset);
}

Remarks

CompositionPropertySets are CompositionObject s that allow storage of key values pairs that can be shared across the application and are not tied to the lifetime of another composition object. CompositionPropertySets are most commonly used with animations, where they maintain key-value pairs that are referenced to drive portions of composition animations. CompositionPropertySets provide the ability to insert key-value pairs or retrieve a value for a given key. For more information on using CompositionPropertySet with animations, see the Animations Overview page.

CompositionPropertySet does not support a delete function – ensure you use CompositionPropertySet to store values that will be shared across the application.

Note

Inserting a new value into a CompositionPropertySet for a key that already exists will overwrite the old value with the new one.

Version history

Windows version SDK version Value added
1607 14393 InsertBoolean
1607 14393 TryGetBoolean

Properties

Comment

A string to associate with the CompositionObject.

Equivalent WinUI property: Microsoft.UI.Composition.CompositionObject.Comment.

(Inherited from CompositionObject)
Compositor

The Compositor used to create this CompositionObject.

Equivalent WinUI property: Microsoft.UI.Composition.CompositionObject.Compositor.

(Inherited from CompositionObject)
Dispatcher

The dispatcher for the CompositionObject.

(Inherited from CompositionObject)
DispatcherQueue

Gets the DispatcherQueue for the CompostionObject.

Equivalent WinUI property: Microsoft.UI.Composition.CompositionObject.DispatcherQueue.

(Inherited from CompositionObject)
ImplicitAnimations

The collection of implicit animations attached to this object.

Equivalent WinUI property: Microsoft.UI.Composition.CompositionObject.ImplicitAnimations.

(Inherited from CompositionObject)
Properties

The collection of properties associated with the CompositionObject.

Equivalent WinUI property: Microsoft.UI.Composition.CompositionObject.Properties.

(Inherited from CompositionObject)

Methods

Close()

Closes the CompositionObject and releases system resources.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionObject.Close.

(Inherited from CompositionObject)
ConnectAnimation(String, CompositionAnimation)

Connects and animation.

(Inherited from CompositionObject)
DisconnectAnimation(String)

Disconnects an animation.

(Inherited from CompositionObject)
Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

(Inherited from CompositionObject)
InsertBoolean(String, Boolean)

Inserts a boolean key-value pair.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.InsertBoolean.

InsertColor(String, Color)

Inserts a Color key-value pair.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.InsertColor.

InsertMatrix3x2(String, Matrix3x2)

Inserts a Matrix3x2 key-value pair.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.InsertMatrix3x2.

InsertMatrix4x4(String, Matrix4x4)

Inserts a Matrix4x4 key-value pair.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.InsertMatrix4x4.

InsertQuaternion(String, Quaternion)

Inserts a quaternion key-value pair.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.InsertQuaternion.

InsertScalar(String, Single)

Inserts a Single key-value pair.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.InsertScalar.

InsertVector2(String, Vector2)

Inserts a Vector2 key-value pair.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.InsertVector2.

InsertVector3(String, Vector3)

Inserts a Vector3 key-value pair.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.InsertVector3.

InsertVector4(String, Vector4)

Inserts a Vector4 key-value pair.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.InsertVector4.

PopulatePropertyInfo(String, AnimationPropertyInfo)

Defines a property that can be animated.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionObject.PopulatePropertyInfo.

(Inherited from CompositionObject)
StartAnimation(String, CompositionAnimation)

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

Equivalent WinUI method: Microsoft.UI.Composition.CompositionObject.StartAnimation.

(Inherited from CompositionObject)
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.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionObject.StartAnimationGroup.

(Inherited from CompositionObject)
StopAnimation(String)

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

Equivalent WinUI method: Microsoft.UI.Composition.CompositionObject.StopAnimation.

(Inherited from CompositionObject)
StopAnimationGroup(ICompositionAnimationBase)

Stops an animation group.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionObject.StopAnimationGroup.

(Inherited from CompositionObject)
TryGetAnimationController(String)

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

Equivalent WinUI method: Microsoft.UI.Composition.CompositionObject.TryGetAnimationController.

(Inherited from CompositionObject)
TryGetBoolean(String, Boolean)

Retrieves the specified boolean property value.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.TryGetBoolean.

TryGetColor(String, Color)

Retrieves the specified Color property value.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.TryGetColor.

TryGetMatrix3x2(String, Matrix3x2)

Retrieves the specified Matrix3x2 property value.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.TryGetMatrix3x2.

TryGetMatrix4x4(String, Matrix4x4)

Retrieves the specified Matrix4x4 property value.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.TryGetMatrix4x4.

TryGetQuaternion(String, Quaternion)

Retrieves the specified quaternion property value.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.TryGetQuaternion.

TryGetScalar(String, Single)

Retrieves the specified Single property value.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.TryGetScalar.

TryGetVector2(String, Vector2)

Retrieves the specified Vector2 property value.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.TryGetVector2.

TryGetVector3(String, Vector3)

Retrieves the specified Vector3 property value.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.TryGetVector3.

TryGetVector4(String, Vector4)

Retrieves the specified Vector4 property value.

Equivalent WinUI method: Microsoft.UI.Composition.CompositionPropertySet.TryGetVector4.

Applies to

See also