{"record":{"id":"b26e7e3e0d93c2a0","repo":"dotnet/wpf","slug":"sr-animation-dependencypropertyisnotanimatable-b26e7e","errorCode":null,"errorMessage":"SR.Animation_DependencyPropertyIsNotAnimatable","messagePattern":"SR\\.Animation_DependencyPropertyIsNotAnimatable","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/generators/IAnimatableHelper.cs","lineNumber":78,"sourceCode":"                    /// <param name=\"clock\">\n                    /// The AnimationClock that will animate the property. If parameter is null\n                    /// then animations will be removed from the property if handoffBehavior is\n                    /// SnapshotAndReplace; otherwise the method call will have no result.\n                    /// </param>\n                    /// <param name=\"handoffBehavior\">\n                    /// Determines how the new AnimationClock will transition from or\n                    /// affect any current animations on the property.\n                    /// </param>\n                    public void ApplyAnimationClock(\n                        DependencyProperty dp,\n                        AnimationClock clock,\n                        HandoffBehavior handoffBehavior)\n                    {\n                        ArgumentNullException.ThrowIfNull(dp);\n\n                        if (!AnimationStorage.IsPropertyAnimatable(this, dp))\n                        {\n                            throw new ArgumentException(SR.Format(SR.Animation_DependencyPropertyIsNotAnimatable, dp.Name, this.GetType()), nameof(dp));\n                        }\n\n                        if (clock != null\n                            && !AnimationStorage.IsAnimationValid(dp, clock.Timeline))\n                        {\n                            throw new ArgumentException(SR.Format(SR.Animation_AnimationTimelineTypeMismatch, clock.Timeline.GetType(), dp.Name, dp.PropertyType), nameof(clock));\n                        }\n\n                        if (!HandoffBehaviorEnum.IsDefined(handoffBehavior))\n                        {\n                            throw new ArgumentException(SR.Animation_UnrecognizedHandoffBehavior);\n                        }\n\n                        if (IsSealed)\n                        {\n                            throw new InvalidOperationException(SR.Format(SR.IAnimatable_CantAnimateSealedDO, dp, this.GetType()));\n                        }\n                        ","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/generators/IAnimatableHelper.cs#L60-L96","documentation":"Thrown by IAnimatable.ApplyAnimationClock when the target DependencyProperty is not animatable — the property lacks an associated animation (no AnimationStorage / property is not registered as animatable). WPF validates via AnimationStorage.IsPropertyAnimatable before applying the clock.","triggerScenarios":"Calling ApplyAnimationClock(dp, clock, handoffBehavior) where dp was not registered with an animatable property (e.g. a plain CLR property wrapper or a DP registered without animation support).","commonSituations":"Animating a non-animatable DP such as a plain double-backed property, or targeting a property on a class that does not derive from Animatable; typos targeting the wrong DependencyProperty field.","solutions":["Verify the target property is registered as an animatable DP (defined on an Animatable-derived type with animation support).","Use a property known to be animatable (e.g. UIElement.Opacity, RenderTransform properties) instead.","Check that the dp argument references the correct static DependencyProperty field, not a property name string."],"exampleFix":"// before\nbutton.ApplyAnimationClock(FrameworkElement.TagProperty, clock, HandoffBehavior.SnapshotAndReplace);\n// after\nbutton.ApplyAnimationClock(UIElement.OpacityProperty, clock, HandoffBehavior.SnapshotAndReplace);","handlingStrategy":"validation","validationCode":"static bool CanAnimate(object target, DependencyProperty dp) =>\n    target is System.Windows.Media.Animation.IAnimatable && dp != null;","typeGuard":"static bool IsAnimatableProperty(DependencyObject o, DependencyProperty dp) => o != null && dp != null && System.Windows.Media.Animation.AnimationStorage.IsPropertyAnimatablePublic(o, dp); // or check dp.OwnerType.IsSubclassOf(typeof(Animatable))","tryCatchPattern":"try { target.ApplyAnimationClock(dp, clock, handoff); } catch (ArgumentException ex) when (ex.ParamName == nameof(dp)) { log.Warn($\"{dp.Name} on {target.GetType()} is not animatable\"); }","preventionTips":["Only animate properties documented as animatable (MSDN animatable properties list).","Resolve DependencyProperty fields with nameof to avoid typos: UIElement.OpacityProperty.","Prefer BeginAnimation/Storyboard on element-level properties over freezable internals."],"tags":["wpf","animation","dependency-property"],"backgroundTag":"invalid-argument-value","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}