UIPropertyMetadata.IsAnimationProhibited 属性


获取或设置一个值,声明是否应在应用了包含元数据实例的依赖项对象上禁用动画。Gets or sets a value declaring whether animations should be disabled on the dependency property where the containing metadata instance is applied.

 property bool IsAnimationProhibited { bool get(); void set(bool value); };
public bool IsAnimationProhibited { get; set; }
member this.IsAnimationProhibited : bool with get, set
Public Property IsAnimationProhibited As Boolean



true 指示不允许动画;false 指示允许动画。true indicates that animations are disallowed; false indicates that animations are allowed. 默认值为 false(允许动画)。The default is false (animations allowed).


通常,可以对 Windows Presentation Foundation (WPF) framework 实现 Api 中可用的默认依赖属性进行动画处理。In general, the default dependency properties available in the Windows Presentation Foundation (WPF) framework implementation APIs can be animated. 您可以 true 在自己的自定义依赖项属性的元数据中将此属性设置为,以在其上禁用动画。You might set this property to true in the metadata of your own custom dependency property to disable animations on it.

如果具有此值的属性 true 尝试用作动画目标,则会引发运行时异常。If a property with this value true attempts to be used as an animation target, a runtime exception will be raised.

的任何派生类的属性 PropertyMetadata 通常在对象模型中定义为可读写。Properties on any derived classes of PropertyMetadata are normally defined in the object model as read-write. 这样就可以在实例初始化后进行调整。This is so they can be adjusted after initialization of the instance. 但是,在调用、或的过程中使用元数据后 RegisterAddOwner OverrideMetadata 属性系统将会密封元数据实例,传达元数据的细节的任何属性现在被视为不可变。However, once the metadata is consumed as part of a call to Register, AddOwner, or OverrideMetadata, the property system will seal that metadata instance and any properties that convey the specifics of the metadata are now considered immutable. 如果尝试设置 IsAnimationProhibited 一次 IsSealedtrue 此元数据实例将引发异常。Attempting to set IsAnimationProhibited once IsSealed is true on this metadata instance will raise an exception.