مشاركة عبر


CompositionPropertySet Class

Definition

Stores values as key-value pairs.

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
Object Platform::Object IInspectable CompositionObject 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 CompositionObjects 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.

(Inherited from CompositionObject)
Compositor

The Compositor used to create this CompositionObject.

(Inherited from CompositionObject)
Dispatcher

The dispatcher for the CompositionObject.

(Inherited from CompositionObject)
DispatcherQueue

Gets the DispatcherQueue for the CompostionObject.

(Inherited from CompositionObject)
ImplicitAnimations

The collection of implicit animations attached to this object.

(Inherited from CompositionObject)
Properties

The collection of properties associated with the CompositionObject.

(Inherited from CompositionObject)

Methods

Close()

Closes the CompositionObject and releases system resources.

(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.

InsertColor(String, Color)

Inserts a Color key-value pair.

InsertMatrix3x2(String, Matrix3x2)

Inserts a Matrix3x2 key-value pair.

InsertMatrix4x4(String, Matrix4x4)

Inserts a Matrix4x4 key-value pair.

InsertQuaternion(String, Quaternion)

Inserts a quaternion key-value pair.

InsertScalar(String, Single)

Inserts a Single key-value pair.

InsertVector2(String, Vector2)

Inserts a Vector2 key-value pair.

InsertVector3(String, Vector3)

Inserts a Vector3 key-value pair.

InsertVector4(String, Vector4)

Inserts a Vector4 key-value pair.

PopulatePropertyInfo(String, AnimationPropertyInfo)

Defines a property that can be animated.

(Inherited from CompositionObject)
StartAnimation(String, CompositionAnimation, AnimationController)

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

(Inherited from CompositionObject)
StartAnimation(String, CompositionAnimation)

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

(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.

(Inherited from CompositionObject)
StopAnimation(String)

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

(Inherited from CompositionObject)
StopAnimationGroup(ICompositionAnimationBase)

Stops an animation group.

(Inherited from CompositionObject)
TryGetAnimationController(String)

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

(Inherited from CompositionObject)
TryGetBoolean(String, Boolean)

Retrieves the specified boolean property value.

TryGetColor(String, Color)

Retrieves the specified Color property value.

TryGetMatrix3x2(String, Matrix3x2)

Retrieves the specified Matrix3x2 property value.

TryGetMatrix4x4(String, Matrix4x4)

Retrieves the specified Matrix4x4 property value.

TryGetQuaternion(String, Quaternion)

Retrieves the specified quaternion property value.

TryGetScalar(String, Single)

Retrieves the specified Single property value.

TryGetVector2(String, Vector2)

Retrieves the specified Vector2 property value.

TryGetVector3(String, Vector3)

Retrieves the specified Vector3 property value.

TryGetVector4(String, Vector4)

Retrieves the specified Vector4 property value.

Applies to

See also