CompositionPropertySet 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
以鍵值對形式儲存值。
public ref class CompositionPropertySet sealed : CompositionObject
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.LiftedContract, 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(Microsoft.Foundation.WindowsAppSDKContract, 65536)]
class CompositionPropertySet final : CompositionObject
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.LiftedContract), 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(Microsoft.Foundation.WindowsAppSDKContract), 65536)]
public sealed class CompositionPropertySet : CompositionObject
Public NotInheritable Class CompositionPropertySet
Inherits CompositionObject
- 繼承
- 屬性
範例
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);
}
備註
CompositionPropertySet是 CompositionObject,允許儲存可跨應用程式共享且不綁定於其他組合物件壽命的鍵值對。 CompositionPropertySet最常用於動畫,它們會維持鍵值對,這些鍵值對被參考以驅動合成動畫的某些部分。 CompositionPropertySet提供插入鍵值對或取得特定鍵值的能力。 欲了解更多關於使用 CompositionPropertySet 搭配動畫的資訊,請參閱 動畫概覽 頁面。
CompositionPropertySet 不支援刪除函式——請務必使用 CompositionPropertySet 來儲存將在整個應用程式間共享的值。
Note
在已存在的鍵值中插入新值,會用新值覆蓋舊值。
屬性
| 名稱 | Description |
|---|---|
| Comment |
一個用來關聯 CompositionObject 的字串。 (繼承來源 CompositionObject) |
| Compositor |
用於建立此 CompositionObject 的合成器。 (繼承來源 CompositionObject) |
| DispatcherQueue |
取得 CompositionObject 的 DispatcherQueue。 (繼承來源 CompositionObject) |
| ImplicitAnimations |
附加於此物件的隱含動畫集合。 (繼承來源 CompositionObject) |
| Properties |
與 CompositionObject 相關聯的屬性集合。 (繼承來源 CompositionObject) |