CompositionPropertySet CompositionPropertySet CompositionPropertySet CompositionPropertySet Class

Definition

Stores values as key-value pairs. CompositionPropertySet s 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. CompositionPropertySet s are most commonly used with animations, where they maintain key-value pairs that are referenced to drive portions of composition animations. CompositionPropertySet s 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.

public : sealed class CompositionPropertySet : CompositionObject, ICompositionPropertySet, ICompositionPropertySet2
struct winrt::Windows::UI::Composition::CompositionPropertySet : CompositionObject, ICompositionPropertySet, ICompositionPropertySet2
public sealed class CompositionPropertySet : CompositionObject, ICompositionPropertySet, ICompositionPropertySet2
Public NotInheritable Class CompositionPropertySet Inherits CompositionObject Implements ICompositionPropertySet, ICompositionPropertySet2
Inheritance
CompositionPropertySetCompositionPropertySetCompositionPropertySetCompositionPropertySet
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

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 with overwrite the old value with the new one.

Methods

Close Close Close Close

Closes the CompositionObject and releases system resources.

(Inherited from CompositionObject)

InsertBoolean(String, Boolean) InsertBoolean(String, Boolean) InsertBoolean(String, Boolean) InsertBoolean(String, Boolean)

Inserts a boolean key-value pair.

public : void InsertBoolean(Platform::String propertyName, bool value)
void InsertBoolean(winrt::hstring propertyName, bool value) const;
public void InsertBoolean(String propertyName, Boolean value)
Public Function InsertBoolean(propertyName As String, value As Boolean) As void
Parameters
propertyName
String String

The key associated with the value. This key can be used to retrieve the value.

value
Boolean Boolean

The value to insert.

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

InsertColor(String, Color) InsertColor(String, Color) InsertColor(String, Color) InsertColor(String, Color)

Inserts a Color key-value pair.

public : void InsertColor(Platform::String propertyName, Color value)
void InsertColor(winrt::hstring propertyName, Color value) const;
public void InsertColor(String propertyName, Color value)
Public Function InsertColor(propertyName As String, value As Color) As void
Parameters
propertyName
String String

The key associated with the value. This key can be used to retrieve the value.

value
Color Color

The value to insert.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

InsertMatrix3x2(String, Matrix3x2) InsertMatrix3x2(String, Matrix3x2) InsertMatrix3x2(String, Matrix3x2) InsertMatrix3x2(String, Matrix3x2)

Inserts a Matrix3x2 key-value pair.

public : void InsertMatrix3x2(Platform::String propertyName, Matrix3x2 value)
void InsertMatrix3x2(winrt::hstring propertyName, Matrix3x2 value) const;
public void InsertMatrix3x2(String propertyName, Matrix3x2 value)
Public Function InsertMatrix3x2(propertyName As String, value As Matrix3x2) As void
Parameters
propertyName
String String

The key associated with the value. This key can be used to retrieve the value.

value
Matrix3x2 Matrix3x2

The value to insert.

InsertMatrix4x4(String, Matrix4x4) InsertMatrix4x4(String, Matrix4x4) InsertMatrix4x4(String, Matrix4x4) InsertMatrix4x4(String, Matrix4x4)

Inserts a Matrix4x4 key-value pair.

public : void InsertMatrix4x4(Platform::String propertyName, Matrix4x4 value)
void InsertMatrix4x4(winrt::hstring propertyName, Matrix4x4 value) const;
public void InsertMatrix4x4(String propertyName, Matrix4x4 value)
Public Function InsertMatrix4x4(propertyName As String, value As Matrix4x4) As void
Parameters
propertyName
String String

The key associated with the value. This key can be used to retrieve the value.

value
Matrix4x4 Matrix4x4

The value to insert.

InsertQuaternion(String, Quaternion) InsertQuaternion(String, Quaternion) InsertQuaternion(String, Quaternion) InsertQuaternion(String, Quaternion)

Inserts a quaternion key-value pair.

public : void InsertQuaternion(Platform::String propertyName, Quaternion value)
void InsertQuaternion(winrt::hstring propertyName, Quaternion value) const;
public void InsertQuaternion(String propertyName, Quaternion value)
Public Function InsertQuaternion(propertyName As String, value As Quaternion) As void
Parameters
propertyName
String String

The key associated with the value. This key can be used to retrieve the value.

value
Quaternion Quaternion

The value to insert.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

InsertScalar(String, Single) InsertScalar(String, Single) InsertScalar(String, Single) InsertScalar(String, Single)

Inserts a Single key-value pair.

public : void InsertScalar(Platform::String propertyName, float value)
void InsertScalar(winrt::hstring propertyName, Single value) const;
public void InsertScalar(String propertyName, Single value)
Public Function InsertScalar(propertyName As String, value As Single) As void
Parameters
propertyName
String String

The name of the property to insert.

value
Single Single

The value of the property to insert.

InsertVector2(String, Vector2) InsertVector2(String, Vector2) InsertVector2(String, Vector2) InsertVector2(String, Vector2)

Inserts a Vector2 key-value pair.

public : void InsertVector2(Platform::String propertyName, Vector2 value)
void InsertVector2(winrt::hstring propertyName, Vector2 value) const;
public void InsertVector2(String propertyName, Vector2 value)
Public Function InsertVector2(propertyName As String, value As Vector2) As void
Parameters
propertyName
String String

The key associated with the value. This key can be used to retrieve the value.

value
Vector2 Vector2

The value to insert.

InsertVector3(String, Vector3) InsertVector3(String, Vector3) InsertVector3(String, Vector3) InsertVector3(String, Vector3)

Inserts a Vector3 key-value pair.

public : void InsertVector3(Platform::String propertyName, Vector3 value)
void InsertVector3(winrt::hstring propertyName, Vector3 value) const;
public void InsertVector3(String propertyName, Vector3 value)
Public Function InsertVector3(propertyName As String, value As Vector3) As void
Parameters
propertyName
String String

The key associated with the value. This key can be used to retrieve the value.

value
Vector3 Vector3

The value to insert.

InsertVector4(String, Vector4) InsertVector4(String, Vector4) InsertVector4(String, Vector4) InsertVector4(String, Vector4)

Inserts a Vector4 key-value pair.

public : void InsertVector4(Platform::String propertyName, Vector4 value)
void InsertVector4(winrt::hstring propertyName, Vector4 value) const;
public void InsertVector4(String propertyName, Vector4 value)
Public Function InsertVector4(propertyName As String, value As Vector4) As void
Parameters
propertyName
String String

The key associated with the value. This key can be used to retrieve the value.

value
Vector4 Vector4

The value to insert.

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)
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

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)
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

StopAnimation(String) StopAnimation(String) StopAnimation(String) StopAnimation(String)

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

(Inherited from CompositionObject)
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase)

Stops an animation group.

(Inherited from CompositionObject)
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

TryGetAnimationController(String) TryGetAnimationController(String) TryGetAnimationController(String) TryGetAnimationController(String)

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

(Inherited from CompositionObject)
Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.17095.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)

TryGetBoolean(String, Boolean) TryGetBoolean(String, Boolean) TryGetBoolean(String, Boolean) TryGetBoolean(String, Boolean)

Retrieves the specified boolean property value.

public : CompositionGetValueStatus TryGetBoolean(Platform::String propertyName, bool value)
CompositionGetValueStatus TryGetBoolean(winrt::hstring propertyName, bool value) const;
public CompositionGetValueStatus TryGetBoolean(String propertyName, Boolean value)
Public Function TryGetBoolean(propertyName As String, value As Boolean) As CompositionGetValueStatus
Parameters
propertyName
String String

The name of the property to retrieve.

value
Boolean Boolean

If the operation is successful, this parameter will contain the specified boolean property value when the method returns.

Returns

Returns a CompositionGetValueStatus value indicating the outcome of retrieving the key-value pair.

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

TryGetColor(String, Color) TryGetColor(String, Color) TryGetColor(String, Color) TryGetColor(String, Color)

Retrieves the specified Color property value.

public : CompositionGetValueStatus TryGetColor(Platform::String propertyName, Color value)
CompositionGetValueStatus TryGetColor(winrt::hstring propertyName, Color value) const;
public CompositionGetValueStatus TryGetColor(String propertyName, Color value)
Public Function TryGetColor(propertyName As String, value As Color) As CompositionGetValueStatus
Parameters
propertyName
String String

The name of the property to retrieve.

value
Color Color

If the operation is successful, this parameter will contain the specified Color property value when the method returns.

Returns

Returns a CompositionGetValueStatus value indicating the outcome of retrieving the key-value pair.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

TryGetMatrix3x2(String, Matrix3x2) TryGetMatrix3x2(String, Matrix3x2) TryGetMatrix3x2(String, Matrix3x2) TryGetMatrix3x2(String, Matrix3x2)

Retrieves the specified Matrix3x2 property value.

public : CompositionGetValueStatus TryGetMatrix3x2(Platform::String propertyName, Matrix3x2 value)
CompositionGetValueStatus TryGetMatrix3x2(winrt::hstring propertyName, Matrix3x2 value) const;
public CompositionGetValueStatus TryGetMatrix3x2(String propertyName, Matrix3x2 value)
Public Function TryGetMatrix3x2(propertyName As String, value As Matrix3x2) As CompositionGetValueStatus
Parameters
propertyName
String String

The name of the property to retrieve.

value
Matrix3x2 Matrix3x2

If the operation is successful, this parameter will contain the specified Matrix3x2 property value when the method returns.

Returns

Returns a CompositionGetValueStatus value indicating the outcome of retrieving the key-value pair.

TryGetMatrix4x4(String, Matrix4x4) TryGetMatrix4x4(String, Matrix4x4) TryGetMatrix4x4(String, Matrix4x4) TryGetMatrix4x4(String, Matrix4x4)

Retrieves the specified Matrix4x4 property value.

public : CompositionGetValueStatus TryGetMatrix4x4(Platform::String propertyName, Matrix4x4 value)
CompositionGetValueStatus TryGetMatrix4x4(winrt::hstring propertyName, Matrix4x4 value) const;
public CompositionGetValueStatus TryGetMatrix4x4(String propertyName, Matrix4x4 value)
Public Function TryGetMatrix4x4(propertyName As String, value As Matrix4x4) As CompositionGetValueStatus
Parameters
propertyName
String String

The name of the property to retrieve.

value
Matrix4x4 Matrix4x4

If the operation is successful, this parameter will contain the specified Matrix4x4 property value when the method returns.

Returns

Returns a CompositionGetValueStatus value indicating the outcome of retrieving the key-value pair.

TryGetQuaternion(String, Quaternion) TryGetQuaternion(String, Quaternion) TryGetQuaternion(String, Quaternion) TryGetQuaternion(String, Quaternion)

Retrieves the specified quaternion property value.

public : CompositionGetValueStatus TryGetQuaternion(Platform::String propertyName, Quaternion value)
CompositionGetValueStatus TryGetQuaternion(winrt::hstring propertyName, Quaternion value) const;
public CompositionGetValueStatus TryGetQuaternion(String propertyName, Quaternion value)
Public Function TryGetQuaternion(propertyName As String, value As Quaternion) As CompositionGetValueStatus
Parameters
propertyName
String String

The name of the property to retrieve.

value
Quaternion Quaternion

If the operation is successful, this parameter will contain the specified quaternion property value when the method returns.

Returns

Returns an enumeration value indicating the outcome of retrieving the key-value pair.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

TryGetScalar(String, Single) TryGetScalar(String, Single) TryGetScalar(String, Single) TryGetScalar(String, Single)

Retrieves the specified Single property value.

public : CompositionGetValueStatus TryGetScalar(Platform::String propertyName, float value)
CompositionGetValueStatus TryGetScalar(winrt::hstring propertyName, Single value) const;
public CompositionGetValueStatus TryGetScalar(String propertyName, Single value)
Public Function TryGetScalar(propertyName As String, value As Single) As CompositionGetValueStatus
Parameters
propertyName
String String

The name of the property to retrieve.

value
Single Single

If the operation is successful, this parameter will contain the specified Single property value when the method returns.

Returns

Returns a CompositionGetValueStatus value indicating the outcome of retrieving the key-value pair.

TryGetVector2(String, Vector2) TryGetVector2(String, Vector2) TryGetVector2(String, Vector2) TryGetVector2(String, Vector2)

Retrieves the specified Vector2 property value.

public : CompositionGetValueStatus TryGetVector2(Platform::String propertyName, Vector2 value)
CompositionGetValueStatus TryGetVector2(winrt::hstring propertyName, Vector2 value) const;
public CompositionGetValueStatus TryGetVector2(String propertyName, Vector2 value)
Public Function TryGetVector2(propertyName As String, value As Vector2) As CompositionGetValueStatus
Parameters
propertyName
String String

The name of the property to retrieve.

value
Vector2 Vector2

If the operation is successful, this parameter will contain the specified Vector2 property value when the method returns.

Returns

Returns a CompositionGetValueStatus value indicating the outcome of retrieving the key-value pair.

TryGetVector3(String, Vector3) TryGetVector3(String, Vector3) TryGetVector3(String, Vector3) TryGetVector3(String, Vector3)

Retrieves the specified Vector3 property value.

public : CompositionGetValueStatus TryGetVector3(Platform::String propertyName, Vector3 value)
CompositionGetValueStatus TryGetVector3(winrt::hstring propertyName, Vector3 value) const;
public CompositionGetValueStatus TryGetVector3(String propertyName, Vector3 value)
Public Function TryGetVector3(propertyName As String, value As Vector3) As CompositionGetValueStatus
Parameters
propertyName
String String

The name of the property to retrieve.

value
Vector3 Vector3

If the operation is successful, this parameter will contain the specified Vector3 property value when the method returns.

Returns

Returns a CompositionGetValueStatus value indicating the outcome of retrieving the key-value pair.

TryGetVector4(String, Vector4) TryGetVector4(String, Vector4) TryGetVector4(String, Vector4) TryGetVector4(String, Vector4)

Retrieves the specified Vector4 property value.

public : CompositionGetValueStatus TryGetVector4(Platform::String propertyName, Vector4 value)
CompositionGetValueStatus TryGetVector4(winrt::hstring propertyName, Vector4 value) const;
public CompositionGetValueStatus TryGetVector4(String propertyName, Vector4 value)
Public Function TryGetVector4(propertyName As String, value As Vector4) As CompositionGetValueStatus
Parameters
propertyName
String String

The name of the property to retrieve.

value
Vector4 Vector4

If the operation is successful, this parameter will contain the specified Vector4 property value when the method returns.

Returns

Returns a CompositionGetValueStatus value indicating the outcome of retrieving the key-value pair.

Properties

Comment Comment Comment Comment

A string to associate with the CompositionObject.

(Inherited from CompositionObject)
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Compositor Compositor Compositor Compositor

The Compositor used to create this CompositionObject.

(Inherited from CompositionObject)

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)
Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

ImplicitAnimations ImplicitAnimations ImplicitAnimations ImplicitAnimations

The collection of implicit animations attached to this object.

(Inherited from CompositionObject)
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Properties Properties Properties Properties

The collection of properties associated with the CompositionObject.

(Inherited from CompositionObject)

See Also